MCPcopy Create free account
hub / github.com/FDio/vpp / run_forked

Function run_forked

test/run_tests.py:392–609  ·  view source on GitHub ↗
(testcase_suites)

Source from the content-addressed store, hash-verified

390
391
392def run_forked(testcase_suites):
393 wrapped_testcase_suites = set()
394 solo_testcase_suites = []
395
396 # suites are unhashable, need to use list
397 results = []
398 unread_testcases = set()
399 finished_unread_testcases = set()
400 manager = StreamQueueManager()
401 manager.start()
402 tests_running = 0
403 free_cpus = list(available_cpus)
404
405 def on_suite_start(tc):
406 nonlocal tests_running
407 nonlocal free_cpus
408 tests_running = tests_running + 1
409
410 def on_suite_finish(tc):
411 nonlocal tests_running
412 nonlocal free_cpus
413 tests_running = tests_running - 1
414 assert tests_running >= 0
415 free_cpus.extend(tc.get_assigned_cpus())
416
417 def run_suite(suite):
418 nonlocal manager
419 nonlocal wrapped_testcase_suites
420 nonlocal unread_testcases
421 nonlocal free_cpus
422 suite.assign_cpus(free_cpus[: suite.cpus_used])
423 free_cpus = free_cpus[suite.cpus_used :]
424 wrapper = TestCaseWrapper(suite, manager)
425 wrapped_testcase_suites.add(wrapper)
426 unread_testcases.add(wrapper)
427 on_suite_start(suite)
428
429 def can_run_suite(suite):
430 return tests_running < max_concurrent_tests and (
431 suite.cpus_used <= len(free_cpus) or suite.cpus_used > max_vpp_cpus
432 )
433
434 while free_cpus and testcase_suites:
435 a_suite = testcase_suites[0]
436 if a_suite.is_tagged_run_solo:
437 a_suite = testcase_suites.pop(0)
438 solo_testcase_suites.append(a_suite)
439 continue
440 if can_run_suite(a_suite):
441 a_suite = testcase_suites.pop(0)
442 run_suite(a_suite)
443 else:
444 break
445
446 if tests_running == 0 and solo_testcase_suites:
447 a_suite = solo_testcase_suites.pop(0)
448 run_suite(a_suite)
449

Callers 1

run_tests.pyFile · 0.85

Calls 15

is_core_presentFunction · 0.90
StreamQueueManagerClass · 0.85
can_run_suiteFunction · 0.85
run_suiteFunction · 0.85
on_suite_finishFunction · 0.85
TestResultClass · 0.85
handle_coresFunction · 0.85
appendMethod · 0.80
process_resultMethod · 0.80
recvMethod · 0.80

Tested by

no test coverage detected