diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-08-02 16:05:07 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2021-08-10 18:06:36 +0200 |
commit | f6c7eb5f0f59f183d327b732a088646f972805d7 (patch) | |
tree | 6e349078a7c920e2a2f98a8bd85e70bfc6f10de3 /tests/auto/testlib/selftests/generate_expected_output.py | |
parent | 825e4291cd44b82c0566e86e60bb77f434196a44 (diff) |
testlib: Only generate expecations for silent test with plain logger
The -silent option to tests is only supported with the plain text
logger, so we don't need to maintain expectation files for the
others.
Pick-to: 6.2
Change-Id: I0f42bfe90d82b7ce04f550c747d4a80e99621e74
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/auto/testlib/selftests/generate_expected_output.py')
-rwxr-xr-x | tests/auto/testlib/selftests/generate_expected_output.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/auto/testlib/selftests/generate_expected_output.py b/tests/auto/testlib/selftests/generate_expected_output.py index 7dd9aa4576..5695f03df9 100755 --- a/tests/auto/testlib/selftests/generate_expected_output.py +++ b/tests/auto/testlib/selftests/generate_expected_output.py @@ -281,6 +281,15 @@ def testEnv(testname, data.update(extraEnv[testname]) return data +# See TestLogger::shouldIgnoreTest() in tst_selftest.cpp +def shouldIgnoreTest(testname, format): + if testname == "junit" and not format == "junitxml": + return True + if testname in ["float", "silent"] and not format == "txt": + return True + + return False + def generateTestData(test_path, expected_path, clean, formats): """Run one test and save its cleaned results. @@ -296,18 +305,11 @@ def generateTestData(test_path, expected_path, clean, formats): print("Warning: directory", testname, "contains no test executable") return - # See TestLogger::shouldIgnoreTest() in tst_selftest.cpp for these - # single-format tests: - if testname == 'junit': - formats = ( 'junitxml', ) if 'junitxml' in formats else () - elif testname == 'float': - formats = ( 'txt', ) if 'txt' in formats else () - # Prepare environment in which to run tests: env = testEnv(testname) for format in formats: - if testname == "junit" and not format == "junitxml": + if shouldIgnoreTest(testname, format): continue print(f' running {testname}/{format}') cmd = [path, f'-{format}'] |