Skip to content

Commit 0da22b2

Browse files
agattidpgeorge
authored andcommitted
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 c1c73d9 commit 0da22b2

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
@@ -527,13 +527,26 @@ function ci_unix_run_tests_helper {
527527
make -C ports/unix "$@" test
528528
}
529529

530+
function ci_unix_run_tests_full_extra {
531+
micropython=$1
532+
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-multitests.py multi_net/*.py)
533+
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-perfbench.py 1000 1000)
534+
}
535+
536+
function ci_unix_run_tests_full_no_native_helper {
537+
variant=$1
538+
shift
539+
micropython=../ports/unix/build-$variant/micropython
540+
make -C ports/unix VARIANT=$variant "$@" test_full_no_native
541+
ci_unix_run_tests_full_extra $micropython
542+
}
543+
530544
function ci_unix_run_tests_full_helper {
531545
variant=$1
532546
shift
533547
micropython=../ports/unix/build-$variant/micropython
534548
make -C ports/unix VARIANT=$variant "$@" test_full
535-
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-multitests.py multi_net/*.py)
536-
(cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=$micropython ./run-perfbench.py 1000 1000)
549+
ci_unix_run_tests_full_extra $micropython
537550
}
538551

539552
function ci_native_mpy_modules_build {
@@ -673,7 +686,7 @@ function ci_unix_nanbox_build {
673686
}
674687

675688
function ci_unix_nanbox_run_tests {
676-
ci_unix_run_tests_full_helper nanbox PYTHON=python2.7
689+
ci_unix_run_tests_full_no_native_helper nanbox PYTHON=python2.7
677690
}
678691

679692
function ci_unix_float_build {

0 commit comments

Comments
 (0)