X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Frun_tests.py;h=09b68a217a527ec6d0d87b20c1f4465e99dd0a20;hb=55636cb623d3161da34120c01a666e36f3be7302;hp=e6a182c016b6380980ea5f3c4f1faac988374fbe;hpb=025cd9c867bef937724535033ccdb979292b7714;p=vpp.git diff --git a/test/run_tests.py b/test/run_tests.py index e6a182c016b..09b68a217a5 100644 --- a/test/run_tests.py +++ b/test/run_tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import shutil @@ -433,7 +433,17 @@ def run_forked(testcase_suites): results) or stop_run for finished_testcase in finished_testcase_suites: - finished_testcase.child.join() + # Somewhat surprisingly, the join below may + # timeout, even if client signaled that + # it finished - so we note it just in case. + join_start = time.time() + finished_testcase.child.join(test_finished_join_timeout) + join_end = time.time() + if join_end - join_start >= test_finished_join_timeout: + finished_testcase.logger.error( + "Timeout joining finished test: %s (pid %d)" % + (finished_testcase.last_test, + finished_testcase.child.pid)) finished_testcase.close_pipes() wrapped_testcase_suites.remove(finished_testcase) finished_unread_testcases.add(finished_testcase) @@ -722,10 +732,17 @@ def parse_digit_env(env_var, default): if __name__ == '__main__': + if "RND_SEED" not in os.environ: + os.environ["RND_SEED"] = str(time.time()) + print("Setting RND_SEED=%s" % os.environ["RND_SEED"]) + else: + print("Using provided RND_SEED=%s" % os.environ["RND_SEED"]) verbose = parse_digit_env("V", 0) test_timeout = parse_digit_env("TIMEOUT", 600) # default = 10 minutes + test_finished_join_timeout = 15 + retries = parse_digit_env("RETRIES", 0) debug = os.getenv("DEBUG", "n").lower() in ["gdb", "gdbserver"] @@ -760,7 +777,7 @@ if __name__ == '__main__': % (min_req_shm >> 20)) else: extra_shm = shm_free - min_req_shm - shm_max_processes += extra_shm / shm_per_process + shm_max_processes += extra_shm // shm_per_process concurrent_tests = min(cpu_count(), shm_max_processes) print('Found enough resources to run tests with %s cores' % concurrent_tests) @@ -822,7 +839,7 @@ if __name__ == '__main__': # don't fork if requiring interactive terminal print('Running tests in foreground in the current process') full_suite = unittest.TestSuite() - map(full_suite.addTests, suites) + full_suite.addTests(suites) result = VppTestRunner(verbosity=verbose, failfast=failfast, print_summary=True).run(full_suite)