Skip to content

Commit bb7d8f9

Browse files
committed
tests/run-tests.py: Make skip logic work irregardless of test path.
Test file paths which get passed to the run_tests function can be absolute or relative and with or without leading slash in the latter case, depending on the arguments to run-tests.py, but the skip_tests list with tests to skip only contains relative paths so using simple string equality comparison easily leads to false negatives. Compare the full absolute path instead such that it doesn't matter anymore in which form the tests are passed. Note: - use realpath to resolve symlinks plus make the comparison case insensitive on windows - the path passed to run_one_test is not altered by this commit, such that when the user inputs relative paths the tests are also still displayed with relative paths In practice this means that it used to be so that the only forms of running tests for which the skip_tests lists actually worked were: >python ./run-tests.py >python ./run-tests.py -d extmod whereas it now works consistently so also for these invocations, which in the end all point to the exact same path: >python ./run-tests.py -d ./extmod >python ./run-tests.py -d ../tests/extmod >python ./run-tests.py -d /full/path/to/tests/extmod These examples used to not skip any of the tests in the extmod/ directory thereby leading to test failures. Signed-off-by: stijn <stijn@ignitron.net>
1 parent 9fffb57 commit bb7d8f9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/run-tests.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,9 +838,11 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
838838
# Works but CPython uses '\' path separator
839839
skip_tests.add("import/import_file.py")
840840

841+
skip_tests = [os.path.realpath(base_path(skip_test)) for skip_test in skip_tests]
842+
841843
def run_one_test(test_file):
844+
test_file_abspath = os.path.realpath(test_file)
842845
test_file = test_file.replace("\\", "/")
843-
test_file_abspath = os.path.abspath(test_file).replace("\\", "/")
844846

845847
if args.filters:
846848
# Default verdict is the opposite of the first action
@@ -869,7 +871,7 @@ def run_one_test(test_file):
869871
is_fstring = test_name.startswith("string_fstring")
870872
is_inlineasm = test_name.startswith("asm")
871873

872-
skip_it = test_file in skip_tests
874+
skip_it = test_file_abspath in skip_tests
873875
skip_it |= skip_native and is_native
874876
skip_it |= skip_endian and is_endian
875877
skip_it |= skip_int_big and is_int_big

0 commit comments

Comments
 (0)