tests: Rename run-tests to run-tests.py for consistency.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-03-11 16:09:27 +11:00
parent b24fcd7aec
commit 6129b8e401
21 changed files with 62 additions and 62 deletions

View File

@ -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

View File

@ -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`.

View File

@ -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

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"
}

View File

@ -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

View File

@ -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 \

View File

@ -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.

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.
#

View File

@ -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 <test>.exp file is found, in which
case it is used as comparison.
If a test fails, run-tests produces a pair of <test>.out and <test>.exp files in the result
If a test fails, run-tests.py produces a pair of <test>.out and <test>.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')

View File

@ -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')
}
########################################################################################