aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_framework_unit_tests.py
diff options
context:
space:
mode:
authortdb3 <106488469+tdb3@users.noreply.github.com>2024-04-23 20:26:42 -0400
committertdb3 <106488469+tdb3@users.noreply.github.com>2024-04-23 20:26:42 -0400
commitf19f0a2e5af6c2a64900f1f229e21b6f1668bd3d (patch)
treee649f92d225f69e590f9024fdd547e4a57f5b099 /test/functional/feature_framework_unit_tests.py
parenta7129f827c9de1330dea1fec739ca210e6bda3cb (diff)
downloadbitcoin-f19f0a2e5af6c2a64900f1f229e21b6f1668bd3d.tar.xz
test: Run framework unit tests in parallel
Reorganize functional test framework unit tests to run in parallel with other functional tests. The option `skipunit` is removed, since unit tests no longer delay functional test execution. Unit tests are run by default when running all tests, and can be run explicitly with `feature_framework_unit_tests.py` when running a subset of tests.
Diffstat (limited to 'test/functional/feature_framework_unit_tests.py')
-rwxr-xr-xtest/functional/feature_framework_unit_tests.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/test/functional/feature_framework_unit_tests.py b/test/functional/feature_framework_unit_tests.py
new file mode 100755
index 0000000000..c9754e083c
--- /dev/null
+++ b/test/functional/feature_framework_unit_tests.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python3
+# Copyright (c) 2017-2024 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""Framework unit tests
+
+Unit tests for the test framework.
+"""
+
+import sys
+import unittest
+
+from test_framework.test_framework import TEST_EXIT_PASSED, TEST_EXIT_FAILED
+
+# List of framework modules containing unit tests. Should be kept in sync with
+# the output of `git grep unittest.TestCase ./test/functional/test_framework`
+TEST_FRAMEWORK_MODULES = [
+ "address",
+ "crypto.bip324_cipher",
+ "blocktools",
+ "crypto.chacha20",
+ "crypto.ellswift",
+ "key",
+ "messages",
+ "crypto.muhash",
+ "crypto.poly1305",
+ "crypto.ripemd160",
+ "script",
+ "segwit_addr",
+ "wallet_util",
+]
+
+
+def run_unit_tests():
+ test_framework_tests = unittest.TestSuite()
+ for module in TEST_FRAMEWORK_MODULES:
+ test_framework_tests.addTest(
+ unittest.TestLoader().loadTestsFromName(f"test_framework.{module}")
+ )
+ result = unittest.TextTestRunner(stream=sys.stdout, verbosity=1, failfast=True).run(
+ test_framework_tests
+ )
+ if not result.wasSuccessful():
+ sys.exit(TEST_EXIT_FAILED)
+ sys.exit(TEST_EXIT_PASSED)
+
+
+if __name__ == "__main__":
+ run_unit_tests()
+