From 6129b8e401c36cc68e0f7ba8180da27a40d17621 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 11 Mar 2021 16:09:27 +1100 Subject: [PATCH] tests: Rename run-tests to run-tests.py for consistency. Signed-off-by: Damien George --- .github/workflows/ports_unix.yml | 22 +++++++++++----------- docs/develop/gettingstarted.rst | 2 +- docs/develop/writingtests.rst | 12 ++++++------ ports/cc3200/tools/smoke.py | 2 +- ports/javascript/Makefile | 4 ++-- ports/qemu-arm/Makefile.test | 2 +- ports/unix/Makefile | 16 ++++++++-------- ports/windows/.appveyor.yml | 14 +++++++------- ports/windows/README.md | 4 ++-- ports/zephyr/make-bin-testsuite | 4 ++-- tests/README | 6 +++--- tests/esp32/partition_ota.py | 2 +- tests/feature_check/README | 2 +- tests/jni/README | 2 +- tests/net_hosted/README | 2 +- tests/net_inet/README | 2 +- tests/run-internalbench.py | 2 +- tests/run-tests-exp.py | 4 ++-- tests/run-tests-exp.sh | 4 ++-- tests/{run-tests => run-tests.py} | 12 ++++++------ tools/ci.sh | 4 ++-- 21 files changed, 62 insertions(+), 62 deletions(-) rename tests/{run-tests => run-tests.py} (98%) diff --git a/.github/workflows/ports_unix.yml b/.github/workflows/ports_unix.yml index eb1416045c..aa4b8abdc9 100644 --- a/.github/workflows/ports_unix.yml +++ b/.github/workflows/ports_unix.yml @@ -24,7 +24,7 @@ jobs: run: source tools/ci.sh && ci_unix_minimal_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures reproducible: runs-on: ubuntu-latest @@ -49,7 +49,7 @@ jobs: run: source tools/ci.sh && ci_unix_standard_run_perfbench - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures coverage: runs-on: ubuntu-latest @@ -76,7 +76,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures coverage_32bit: runs-on: ubuntu-latest @@ -94,7 +94,7 @@ jobs: run: source tools/ci.sh && ci_unix_coverage_32bit_run_native_mpy_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures nanbox: runs-on: ubuntu-latest @@ -108,7 +108,7 @@ jobs: run: source tools/ci.sh && ci_unix_nanbox_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures float: runs-on: ubuntu-latest @@ -120,7 +120,7 @@ jobs: run: source tools/ci.sh && ci_unix_float_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures stackless_clang: runs-on: ubuntu-20.04 @@ -134,7 +134,7 @@ jobs: run: source tools/ci.sh && ci_unix_stackless_clang_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures float_clang: runs-on: ubuntu-20.04 @@ -148,7 +148,7 @@ jobs: run: source tools/ci.sh && ci_unix_float_clang_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures settrace: runs-on: ubuntu-latest @@ -160,7 +160,7 @@ jobs: run: source tools/ci.sh && ci_unix_settrace_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures settrace_stackless: runs-on: ubuntu-latest @@ -172,7 +172,7 @@ jobs: run: source tools/ci.sh && ci_unix_settrace_stackless_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures macos: runs-on: macos-11.0 @@ -185,4 +185,4 @@ jobs: run: source tools/ci.sh && ci_unix_macos_run_tests - name: Print failures if: failure() - run: tests/run-tests --print-failures + run: tests/run-tests.py --print-failures diff --git a/docs/develop/gettingstarted.rst b/docs/develop/gettingstarted.rst index 3dd00a579a..32435ebe1c 100644 --- a/docs/develop/gettingstarted.rst +++ b/docs/develop/gettingstarted.rst @@ -273,7 +273,7 @@ To run a selection of tests on a board/device connected over USB use: .. code-block:: bash $ cd tests - $ ./run-tests --target minimal --device /dev/ttyACM0 + $ ./run-tests.py --target minimal --device /dev/ttyACM0 See also :ref:`writingtests`. diff --git a/docs/develop/writingtests.rst b/docs/develop/writingtests.rst index 4bdf4dd7a6..9bb5178f55 100644 --- a/docs/develop/writingtests.rst +++ b/docs/develop/writingtests.rst @@ -4,7 +4,7 @@ Writing tests ============= Tests in MicroPython are located at the path ``tests/``. The following is a listing of -key directories and the run-tests runner script: +key directories and the run-tests.py runner script: .. code-block:: bash @@ -13,7 +13,7 @@ key directories and the run-tests runner script: ├── extmod ├── float ├── micropython - ├── run-tests + ├── run-tests.py ... There are subfolders maintained to categorize the tests. Add a test by creating a new file in one of the @@ -54,17 +54,17 @@ The other way to run tests, which is useful when running on targets other than t .. code-block:: bash $ cd tests - $ ./run-tests + $ ./run-tests.py Then to run on a board: .. code-block:: bash - $ ./run-tests --target minimal --device /dev/ttyACM0 + $ ./run-tests.py --target minimal --device /dev/ttyACM0 And to run only a certain set of tests (eg a directory): .. code-block:: bash - $ ./run-tests -d basics - $ ./run-tests float/builtin*.py + $ ./run-tests.py -d basics + $ ./run-tests.py float/builtin*.py diff --git a/ports/cc3200/tools/smoke.py b/ports/cc3200/tools/smoke.py index 4ccc700c6c..463a485c4d 100644 --- a/ports/cc3200/tools/smoke.py +++ b/ports/cc3200/tools/smoke.py @@ -6,7 +6,7 @@ import os """ Execute it like this: -python3 run-tests --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py +python3 run-tests.py --target wipy --device 192.168.1.1 ../cc3200/tools/smoke.py """ pin_map = [23, 24, 11, 12, 13, 14, 15, 16, 17, 22, 28, 10, 9, 8, 7, 6, 30, 31, 3, 0, 4, 5] diff --git a/ports/javascript/Makefile b/ports/javascript/Makefile index 4f9dd444be..3962e93f5f 100644 --- a/ports/javascript/Makefile +++ b/ports/javascript/Makefile @@ -63,8 +63,8 @@ $(BUILD)/micropython.js: $(OBJ) library.js wrapper.js min: $(BUILD)/micropython.js uglifyjs $< -c -o $(BUILD)/micropython.min.js -test: $(BUILD)/micropython.js $(TOP)/tests/run-tests +test: $(BUILD)/micropython.js $(TOP)/tests/run-tests.py $(eval DIRNAME=ports/$(notdir $(CURDIR))) - cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests + cd $(TOP)/tests && MICROPY_MICROPYTHON=../ports/javascript/node_run.sh ./run-tests.py include $(TOP)/py/mkrules.mk diff --git a/ports/qemu-arm/Makefile.test b/ports/qemu-arm/Makefile.test index 340e1c3b90..6b7f1dc7ab 100644 --- a/ports/qemu-arm/Makefile.test +++ b/ports/qemu-arm/Makefile.test @@ -10,7 +10,7 @@ CFLAGS += -DTEST $(BUILD)/test_main.o: $(BUILD)/genhdr/tests.h $(BUILD)/genhdr/tests.h: - (cd $(TOP)/tests; ./run-tests --target=qemu-arm --write-exp) + (cd $(TOP)/tests; ./run-tests.py --target=qemu-arm --write-exp) $(Q)echo "Generating $@";(cd $(TOP)/tests; ../tools/tinytest-codegen.py) > $@ $(BUILD)/lib/tinytest/tinytest.o: CFLAGS += -DNO_FORKING diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 6a936a2425..fe86018aa0 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -292,17 +292,17 @@ include $(TOP)/py/mkrules.mk .PHONY: test test_full -test: $(PROG) $(TOP)/tests/run-tests +test: $(PROG) $(TOP)/tests/run-tests.py $(eval DIRNAME=ports/$(notdir $(CURDIR))) - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py -test_full: $(PROG) $(TOP)/tests/run-tests +test_full: $(PROG) $(TOP)/tests/run-tests.py $(eval DIRNAME=ports/$(notdir $(CURDIR))) - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests -d thread - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --emit native - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython - cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py -d thread + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --emit native + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) -d basics float micropython + cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --via-mpy $(RUN_TESTS_MPY_CROSS_FLAGS) --emit native -d basics float micropython cat $(TOP)/tests/basics/0prelim.py | ./$(PROG) | grep -q 'abc' test_gcov: test_full diff --git a/ports/windows/.appveyor.yml b/ports/windows/.appveyor.yml index 4d2d6bd11d..1ec72bbb38 100644 --- a/ports/windows/.appveyor.yml +++ b/ports/windows/.appveyor.yml @@ -37,14 +37,14 @@ build: test_script: - ps: | cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests') - & $env:MICROPY_CPYTHON3 run-tests + & $env:MICROPY_CPYTHON3 run-tests.py if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests --print-failures + & $env:MICROPY_CPYTHON3 run-tests.py --print-failures throw "Test failure" } - & $env:MICROPY_CPYTHON3 run-tests --via-mpy -d basics float micropython + & $env:MICROPY_CPYTHON3 run-tests.py --via-mpy -d basics float micropython if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests --print-failures + & $env:MICROPY_CPYTHON3 run-tests.py --print-failures throw "Test failure" } @@ -71,17 +71,17 @@ after_test: throw "$env:MSYSTEM mpy_cross build exited with code $LASTEXITCODE" } cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests') - $testArgs = @('run-tests') + $testArgs = @('run-tests.py') foreach ($skipTest in @('math_fun', 'float2int_double', 'float_parse', 'math_domain_special')) { $testArgs = $testArgs + '-e' + $skipTest } & $env:MICROPY_CPYTHON3 $testArgs if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests --print-failures + & $env:MICROPY_CPYTHON3 run-tests.py --print-failures throw "Test failure" } & $env:MICROPY_CPYTHON3 ($testArgs + @('--via-mpy', '-d', 'basics', 'float', 'micropython')) if ($LASTEXITCODE -ne 0) { - & $env:MICROPY_CPYTHON3 run-tests --print-failures + & $env:MICROPY_CPYTHON3 run-tests.py --print-failures throw "Test failure" } diff --git a/ports/windows/README.md b/ports/windows/README.md index 1b904f8f5e..553e87513e 100644 --- a/ports/windows/README.md +++ b/ports/windows/README.md @@ -90,11 +90,11 @@ Running the tests This is similar for all ports: cd ../../tests - python ./run-tests + python ./run-tests.py Though when running on Cygwin and using Cygwin's Python installation you'll need: - python3 ./run-tests + python3 ./run-tests.py Depending on the combination of platform and Python version used it might be needed to first set the MICROPY_MICROPYTHON environment variable to diff --git a/ports/zephyr/make-bin-testsuite b/ports/zephyr/make-bin-testsuite index f6aeb83f8a..9a8c329772 100755 --- a/ports/zephyr/make-bin-testsuite +++ b/ports/zephyr/make-bin-testsuite @@ -8,8 +8,8 @@ # ./make-bin-testsuite BOARD=qemu_cortex_m3 run # -(cd ../../tests; ./run-tests --write-exp) -(cd ../../tests; ./run-tests --list-tests --target=minimal \ +(cd ../../tests; ./run-tests.py --write-exp) +(cd ../../tests; ./run-tests.py --list-tests --target=minimal \ -e async -e intbig -e int_big -e builtin_help -e memstats -e bytes_compare3 -e class_reverse_op \ -e /set -e frozenset -e complex -e const -e native -e viper \ -e 'float_divmod\.' -e float_parse_doubleprec -e float/true_value -e float/types \ diff --git a/tests/README b/tests/README index f2cd89bb93..8794202e15 100644 --- a/tests/README +++ b/tests/README @@ -1,15 +1,15 @@ This directory contains tests for various functionality areas of MicroPython. -To run all stable tests, run "run-tests" script in this directory. +To run all stable tests, run "run-tests.py" script in this directory. Tests of capabilities not supported on all platforms should be written to check for the capability being present. If it is not, the test should merely output 'SKIP' followed by the line terminator, and call sys.exit() to raise SystemExit, instead of attempting to test the -missing capability. The testing framework (run-tests in this +missing capability. The testing framework (run-tests.py in this directory, test_main.c in qemu_arm) recognizes this as a skipped test. There are a few features for which this mechanism cannot be used to -condition a test. The run-tests script uses small scripts in the +condition a test. The run-tests.py script uses small scripts in the feature_check directory to check whether each such feature is present, and skips the relevant tests if not. diff --git a/tests/esp32/partition_ota.py b/tests/esp32/partition_ota.py index 765630c8ce..212fcf0338 100644 --- a/tests/esp32/partition_ota.py +++ b/tests/esp32/partition_ota.py @@ -95,7 +95,7 @@ def copy_partition(src, dest): if sz - addr < 4096: blk = blk[: sz - addr] if addr & 0xFFFF == 0: - # need to show progress to run-tests else it times out + # need to show progress to run-tests.py else it times out print(" ... 0x{:06x}".format(addr)) src.readblocks(addr >> 12, blk) dest.writeblocks(addr >> 12, blk) diff --git a/tests/feature_check/README b/tests/feature_check/README index d062020f7b..3b7b6cba41 100644 --- a/tests/feature_check/README +++ b/tests/feature_check/README @@ -1,4 +1,4 @@ This directory doesn't contain real tests, but code snippets to detect various interpreter features, which can't be/inconvenient to detecte by -other means. Scripts here are executed by run-tests at the beginning of +other means. Scripts here are executed by run-tests.py at the beginning of testsuite to decide what other test groups to run/exclude. diff --git a/tests/jni/README b/tests/jni/README index 8418bb84f4..f1e1b0eca0 100644 --- a/tests/jni/README +++ b/tests/jni/README @@ -8,5 +8,5 @@ of JVM. For example, for OpenJDK 7 on x86_64, following may work: -LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py +LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests.py jni/*.py diff --git a/tests/net_hosted/README b/tests/net_hosted/README index 724dd61584..709ed50ce3 100644 --- a/tests/net_hosted/README +++ b/tests/net_hosted/README @@ -8,4 +8,4 @@ not yet fully correspond to the functional specification above. So far, these tests are not run as part of the main testsuite and need to be run seperately (from the main test/ directory): - ./run-tests net_hosted/*.py + ./run-tests.py net_hosted/*.py diff --git a/tests/net_inet/README b/tests/net_inet/README index 9a5614efa6..1d6e15b174 100644 --- a/tests/net_inet/README +++ b/tests/net_inet/README @@ -2,4 +2,4 @@ This directory contains network tests which require Internet connection. Note that these tests are not run as part of the main testsuite and need to be run seperately (from the main test/ directory): - ./run-tests net_inet/*.py + ./run-tests.py net_inet/*.py diff --git a/tests/run-internalbench.py b/tests/run-internalbench.py index 63392814a8..606fc3b772 100755 --- a/tests/run-internalbench.py +++ b/tests/run-internalbench.py @@ -67,7 +67,7 @@ def main(): cmd_parser.add_argument("files", nargs="*", help="input test files") args = cmd_parser.parse_args() - # Note pyboard support is copied over from run-tests, not testes, and likely needs revamping + # Note pyboard support is copied over from run-tests.py, not tests, and likely needs revamping if args.pyboard: import pyboard diff --git a/tests/run-tests-exp.py b/tests/run-tests-exp.py index ac32fe9869..21b6645336 100644 --- a/tests/run-tests-exp.py +++ b/tests/run-tests-exp.py @@ -1,6 +1,6 @@ # -# This is minimal MicroPython variant of run-tests script, which uses -# .exp files as generated by run-tests --write-exp. It is useful to run +# This is minimal MicroPython variant of run-tests.py script, which uses +# .exp files as generated by run-tests.py --write-exp. It is useful to run # testsuite on systems which have neither CPython3 nor unix shell. # This script is intended to be run by the same interpreter executable # which is to be tested, so should use minimal language functionality. diff --git a/tests/run-tests-exp.sh b/tests/run-tests-exp.sh index 8f81b96d2f..177090cd8d 100755 --- a/tests/run-tests-exp.sh +++ b/tests/run-tests-exp.sh @@ -1,7 +1,7 @@ #!/bin/sh # -# This is plain shell variant of run-tests script, which uses .exp files -# as generated by run-tests --write-exp. It is useful to run testsuite +# This is plain shell variant of run-tests.py script, which uses .exp files +# as generated by run-tests.py --write-exp. It is useful to run testsuite # on embedded systems which don't have CPython3. # diff --git a/tests/run-tests b/tests/run-tests.py similarity index 98% rename from tests/run-tests rename to tests/run-tests.py index b733d8a9fc..5863b23b41 100755 --- a/tests/run-tests +++ b/tests/run-tests.py @@ -258,7 +258,7 @@ def run_tests(pyb, tests, args, result_dir): if not (args.list_tests or args.write_exp): # Even if we run completely different tests in a different directory, # we need to access feature_checks from the same directory as the - # run-tests script itself so use base_path. + # run-tests.py script itself so use base_path. # Check if micropython.native is supported, and skip such tests if it's not output = run_feature_check(pyb, args, base_path, 'native_check.py') @@ -582,19 +582,19 @@ Tests are discovered by scanning test directories for .py files or using the specified test files. If test files nor directories are specified, the script expects to be ran in the tests directory (where this file is located) and the builtin tests suitable for the target platform are ran. -When running tests, run-tests compares the MicroPython output of the test with the output +When running tests, run-tests.py compares the MicroPython output of the test with the output produced by running the test through CPython unless a .exp file is found, in which case it is used as comparison. -If a test fails, run-tests produces a pair of .out and .exp files in the result +If a test fails, run-tests.py produces a pair of .out and .exp files in the result directory with the MicroPython output and the expectations, respectively. ''', epilog='''\ Options -i and -e can be multiple and processed in the order given. Regex "search" (vs "match") operation is used. An action (include/exclude) of the last matching regex is used: - run-tests -i async - exclude all, then include tests containing "async" anywhere - run-tests -e '/big.+int' - include all, then exclude by regex - run-tests -e async -i async_foo - include all, exclude async, yet still include async_foo + run-tests.py -i async - exclude all, then include tests containing "async" anywhere + run-tests.py -e '/big.+int' - include all, then exclude by regex + run-tests.py -e async -i async_foo - include all, exclude async, yet still include async_foo ''') cmd_parser.add_argument('--target', default='unix', help='the target platform') cmd_parser.add_argument('--device', default='/dev/ttyACM0', help='the serial device or the IP address of the pyboard') diff --git a/tools/ci.sh b/tools/ci.sh index a815e9483e..53cf7f878b 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -306,7 +306,7 @@ function ci_unix_minimal_build { } function ci_unix_minimal_run_tests { - (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-minimal ./run-tests -e exception_chain -e self_type_check -e subclass_native_init -d basics) + (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython-minimal ./run-tests.py -e exception_chain -e self_type_check -e subclass_native_init -d basics) } function ci_unix_standard_build { @@ -441,7 +441,7 @@ function ci_unix_macos_run_tests { # - OSX has poor time resolution and these uasyncio tests do not have correct output # - import_pkg7 has a problem with relative imports # - urandom_basic has a problem with getrandbits(0) - (cd tests && ./run-tests --exclude 'uasyncio_(basic|heaplock|lock|wait_task)' --exclude 'import_pkg7.py' --exclude 'urandom_basic.py') + (cd tests && ./run-tests.py --exclude 'uasyncio_(basic|heaplock|lock|wait_task)' --exclude 'import_pkg7.py' --exclude 'urandom_basic.py') } ########################################################################################