Skip to content

Commit e801a72

Browse files
committed
tools/ci.sh: Fix nanbox CI test runs.
This commit fixes CI test runs for the `nanbox` target, which were broken by the unconditional native emitter code output changes in the test runner. The `nanbox` configuration does not enable native emitters of any kind, and with a full test run that includes executing emitted native code things would break when doing CI runs. This is worked around by introducing a common subset of tests that do not involve the native emitter, and a more comprehensive set of tests that include both non-emitter and emitter tests. The `nanbox` CI test run will stop at the first subset, whilst other configurations will run that and execute further tests. Function names have been kept the same for steps that involve native code, with the `nanbox` subset having another one. This should not trigger any breakage in existing CI configurations or external scripts. Signed-off-by: Alessandro Gatti <[email protected]>
1 parent 0d4598e commit e801a72

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

ports/unix/Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,21 +256,24 @@ endif
256256

257257
include $(TOP)/py/mkrules.mk
258258

259-
.PHONY: test test_full
259+
.PHONY: test test_full_no_native test_full
260260

261261
test: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
262262
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
263263
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py
264264

265-
test_full: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
265+
test_full_no_native: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py
266266
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
267267
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py
268268
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py -d thread
269-
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --emit native
270269
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython
271-
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
272270
cat $(TOP)/tests/basics/0prelim.py | ./$(BUILD)/$(PROG) | grep -q 'abc'
273271

272+
test_full: $(BUILD)/$(PROG) $(TOP)/tests/run-tests.py test_full_no_native
273+
$(eval DIRNAME=ports/$(notdir $(CURDIR)))
274+
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --emit native
275+
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(BUILD)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython
276+
274277
test_gcov: test_full
275278
gcov -o $(BUILD)/py $(TOP)/py/*.c
276279
gcov -o $(BUILD)/extmod $(TOP)/extmod/*.c

tools/ci.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,13 +509,26 @@ function ci_unix_run_tests_helper {
509509
make -C ports/unix "$@" test
510510
}
511511

512+
function ci_unix_run_tests_full_extra {
513+
micropython=$1
514+
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-multitests.py multi_net/*.py)
515+
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-perfbench.py 1000 1000)
516+
}
517+
518+
function ci_unix_run_tests_full_no_native_helper {
519+
variant=$1
520+
shift
521+
micropython=../ports/unix/build-$variant/micropython
522+
make -C ports/unix VARIANT=$variant "$@" test_full_no_native
523+
ci_unix_run_tests_full_extra $micropython
524+
}
525+
512526
function ci_unix_run_tests_full_helper {
513527
variant=$1
514528
shift
515529
micropython=../ports/unix/build-$variant/micropython
516530
make -C ports/unix VARIANT=$variant "$@" test_full
517-
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-multitests.py multi_net/*.py)
518-
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-perfbench.py 1000 1000)
531+
ci_unix_run_tests_full_extra $micropython
519532
}
520533

521534
function ci_native_mpy_modules_build {
@@ -655,7 +668,7 @@ function ci_unix_nanbox_build {
655668
}
656669

657670
function ci_unix_nanbox_run_tests {
658-
ci_unix_run_tests_full_helper nanbox PYTHON=python2.7
671+
ci_unix_run_tests_full_no_native_helper nanbox PYTHON=python2.7
659672
}
660673

661674
function ci_unix_float_build {

0 commit comments

Comments
 (0)