diff options
| author | Dimitrios Apostolou <[email protected]> | 2025-08-30 01:24:23 +0200 |
|---|---|---|
| committer | Dimitrios Apostolou <[email protected]> | 2025-10-06 15:35:07 +0200 |
| commit | 5450e813158ff759bc10b908f67866d45fcbd16b (patch) | |
| tree | 7a35c8ee18ab4ea087df00c6870d93ab6f7212fb /util/testrunner/qt-testrunner.py | |
| parent | 6f5cdac6b6fec6b217629b0bf3e217e81384f39c (diff) | |
qt-testrunner: detect test filename for androidtestrunner --aab
Tests on android are wrapped by androidtestrunner.
Previously the test was passed to it with --apk testname.apk.
A new way was recently added: --aab testname.aab.
qt-testrunner now supports these two ways to detect the filename.
Additionally, it now exits with error if the testname is undetected.
This way we'll avoid all tests being recorded as "androidtestrunner" in
the future.
Fixes: QTQAINFRA-7351
Pick-to: 6.10 6.9 6.8
Change-Id: I571b617b28cdb4ea51d0b61e629d9bc8ec8e1917
Reviewed-by: Edward Welbourne <[email protected]>
Reviewed-by: Assam Boudjelthia <[email protected]>
Diffstat (limited to 'util/testrunner/qt-testrunner.py')
| -rwxr-xr-x | util/testrunner/qt-testrunner.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/util/testrunner/qt-testrunner.py b/util/testrunner/qt-testrunner.py index 9bc0d2c4658..41e81e83122 100755 --- a/util/testrunner/qt-testrunner.py +++ b/util/testrunner/qt-testrunner.py @@ -152,12 +152,19 @@ Default flags: --max-repeats 5 --passes-needed 1 args.test_basename = args.test_basename[:-4] # On Android emulated platforms, "androidtestrunner" is invoked by CMake - # to wrap the tests. We have to append the test arguments to it after - # "--". Besides that we have to detect the basename to avoid saving the - # XML log as "androidtestrunner.xml" for all tests. + # to wrap the tests. We have to invoke it with all its arguments, and + # then append "--" and append our QTest-specific arguments. + # + # Besides that we have to detect the basename to avoid saving the XML log + # as "androidtestrunner.xml" for all tests. To do that we look for the + # "--apk" or "--aab" option and read its argument. if args.test_basename == "androidtestrunner": + if "--" in args.testargs: + L.critical("qt-testrunner can't handle pre-existing '--' argument to androidtestrunner") + sys.exit(1) args.specific_extra_args = [ "--" ] apk_arg = False + aab_arg = False for a in args.testargs[1:]: if a == "--apk": apk_arg = True @@ -166,8 +173,19 @@ Default flags: --max-repeats 5 --passes-needed 1 if a.endswith(".apk"): args.test_basename = os.path.basename(a)[:-4] break + elif a == "--aab": + aab_arg = True + elif aab_arg: + aab_arg = False + if a.endswith(".aab"): + args.test_basename = os.path.basename(a)[:-4] + break L.info("Detected androidtestrunner, test will be handled specially. Detected test basename: %s", args.test_basename) + if args.test_basename == "androidtestrunner": + L.critical("Couldn't detect the test's basename") + sys.exit(1) + # Test wrapper just needs to be skipped to figure out test_basename. elif args.test_basename in TEST_RUNNER_WRAPPERS: args.test_basename = os.path.basename(args.testargs[1]) |
