Skip to content

Commit 0daf644

Browse files
committed
zephyr-cp: run the tests in parallel
The suite runs one test at a time and is 17 of the zephyr-tests job's 34 to 44 minutes. 84% of that is bsim, where every test starts a phy and one or two simulated devices, and the asan board from adafruit#11317 doubled the native tests, 220 -> 322. Run pytest with one worker per CPU. --dist loadfile keeps each file on one worker, which test_web_workflow.py needs for its fixed port 8090; the rest is already per test, tmp_path for the flash images and a sim id from the test's node id. Measured on four cores, whole suite, 322 passed each time: 758 s with one worker, 350 s with two, 249 s with three, 224 s with four. -n auto counts physical cores, so it picks 2 on the runner and the host's count inside a container. sysctl is the macOS spelling of nproc, as in tools/ci.sh.
1 parent d36f869 commit 0daf644

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

‎ports/zephyr-cp/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@ $(foreach board,$(TEST_BOARDS),$(eval $(call test_board_rule,$(board))))
141141

142142
test: $(TEST_BOARDS:%=test-build-%)
143143
pytest cptools/tests
144-
pytest tests/ -v
144+
pytest tests/ -v -n $$(nproc 2>/dev/null || sysctl -n hw.ncpu) --dist loadfile

‎requirements-dev.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ setuptools
4646
tomlkit
4747
pytest
4848
pytest-rerunfailures
49+
pytest-xdist
4950
perfetto

0 commit comments

Comments
 (0)