summaryrefslogtreecommitdiffstats
path: root/src/tools/androidtestrunner
Commit message (Collapse)AuthorAgeFilesLines
* Capture full logcat output in Android unit testsAndreas Buhr2021-11-091-1/+69
| | | | | | | | | | | | | | | Previously, when running unit tests on Android, the log presented to the user was the log as known to the Qt logging system. This does not include log messages generated by Java code using e.g. Log.d("message"). Neither does it include log messages by system libs. This patch changes androidtestrunner to capture the full logcat output for the unit test. This improves the developer experience when working with unit tests. Fixes: QTBUG-93438 Change-Id: I580f728349041eb8a84a32d187754b7b5448f512 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* androidtestrunner: make sure that system-user is usedBartlomiej Moskal2021-10-211-1/+10
| | | | | | | | | | | | | | | | | | | | | | | It happens on Android Automotive emulator, that output file is in other directory. According android spec [1]: "If a default user isn't specified, each adb subcommand has a different user. The best practice is to retrieve the user ID with am get-current-user and then explicitly use --user <userId> for any command that supports it." That is the reason why output file can be found in /data/user/USER_ID/PACKAGE_NAME directory. Checking path related to current user was added as backup solution. [1]https://source.android.com/devices/tech/admin/multi-user-testing Pick-to: 6.2 Change-Id: Id7e6ddef74f4f20b7469a07bba6a71d3622c4e20 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Skip unnecessary commands when cross-building toolsJoerg Bornemann2021-09-271-0/+1
| | | | | | | | | | | | | | | Introduce a new macro qt_internal_return_unless_building_tools which simply calls return() if tools are not built. This macro is supposed to be called after qt_internal_add_tool(). Using this macro avoids having to special-case code for when qt_internal_add_tool() creates imported targets in cross-builds. Adjust pro2cmake accordingly. Task-number: QTBUG-85084 Change-Id: I9e1c455c29535dd8c318efa890ebd739c42effc1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Allow building android{deployqt, testrunner} under target host_toolsAssam Boudjelthia2021-09-072-4/+7
| | | | | | | | | | | When doing a cross build for Android we need only the host tools which are available under cmake's host_tools target, but androiddeployqt and androidtestrunner are not part of that. This fixes that. Pick-to: 6.2 Change-Id: Icdbc4a78ca050b66ec8df656d9ec766ef6c9f4b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Android: pass -g to testrunner to grant run time permissionsAssam Boudjelthia2021-08-291-1/+1
| | | | | | | | | | | Some Qt modules/tests go through features that require run-time Android permissions which are granted by user input, that of course is not ideally possible while running unit tests. So when installing the app adb can do that for us. Pick-to: 6.2 Change-Id: I92d33d5213c3779d7ca246ec0fb359d2ead4fa6f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* testlib: Update a few remaining instances of the deprecated -xunitxml formatTor Arne Vestbø2021-07-291-13/+16
| | | | | | | | The format was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. Pick-to: 6.2 Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Revert "Android: fix androidtestrunner passing when output file doesn't exist"Assam Boudjelthia2021-07-011-12/+1
| | | | | | | | | | | | | This reverts commit 1365a1c7a76a73838909d63acb60ebdfcbdff62e. Reason for revert: Causes the issue in QTBUG-94445. Pick-to: 6.2 Task-number: QTBUG-88508 Fixes: QTBUG-94445 Change-Id: I131234c9b1daeecd5f5f4921a9150d65a26db972 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* Android: fix androidtestrunner passing when output file doesn't existAssam Boudjelthia2021-06-071-1/+12
| | | | | | Task-number: QTBUG-88508 Change-Id: If19d2b272b1760228b6a1e6e1af6db3bfbf0ec1e Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Android: make the help print a bit easier to read and navigateAssam Boudjelthia2021-06-021-5/+14
| | | | | | | | Add new line between each argument type in the help print to make it easier to read and not a big wall of text. Change-Id: I7c7b2d2b59ef3a0889d1bb8c7af3d00b82bf820d Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Add proper dependencies to apk targetsJoerg Bornemann2021-05-171-20/+17
| | | | | | | | | | | | | | | | | | | Before, building ${target}_make_apk always re-built the apk, instead of rebuilding the apk only when inputs changed. This patch fixes that by moving the creation code from a custom target to a custom command with proper dependencies. The androidtestrunner tool now does not check for the existence of an apk anymore and always runs the make command that is supposed to build the apk. The ${target}_prepare_apk_dir target is not needed anymore by the Qt build but is still used by Qt Creator's Android support. Add a clarifying comment. Fixes: QTBUG-93431 Change-Id: I00d65d616fef9511b03b65f879c4bc6cb92dfc30 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove the qmake project filesJoerg Bornemann2021-01-071-13/+0
| | | | | | | | | | | | | | | | Remove the qmake project files for most of Qt. Leave the qmake project files for examples, because we still test those in the CI to ensure qmake does not regress. Also leave the qmake project files for utils and other minor parts that lack CMake project files. Task-number: QTBUG-88742 Change-Id: I6cdf059e6204816f617f9624f3ea9822703f73cc Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Android: add missing new line to androidtestrunner helpAssam Boudjelthia2020-10-131-1/+1
| | | | | Change-Id: Idba54c15af64b8dadcba9fa2125d6aae5e6c6bc9 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-231-1/+1
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Be verboseBogDan Vatra2020-08-241-1/+1
| | | | | | | make apk takes a LOT of time, showing that it's not hanged it's useful. Change-Id: I4fb11e0f535cf2311d71dff3710135b465ecc06b Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Fix running qml tests on AndroidBogDan Vatra2020-08-241-31/+31
| | | | | | | | | | | | | | First and foremost the condition was wrong ... In order to help running qml test cases on Android without any android specific hack on user's .pro files we copy the entire project folder to assets. I copy the entire folder and not only the tst_*.qml files because it might contain data which is needed by the tests to run. Change-Id: I06323d9d52904317410dd2f440de65a0766a48b5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* CMake: Regenerate load(qt_app) projectsAlexandru Croitor2020-07-311-2/+5
| | | | | | | To use the new qt_internal_add_app function. Change-Id: I9776ce18c3a8b01f1a42e8da346cfd0a98374ef8 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Port androidtestrunner to QRegularExpressionLars Knoll2020-04-151-9/+13
| | | | | Change-Id: If135b29996b7036d65472a1b5fa4817cd7907aba Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Merge remote-tracking branch 'origin/dev' into merge-devLeander Beernaert2020-01-241-1/+1
|\ | | | | | | Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
| * androidtestrunner: Fix warnings about missing parameter to QStringLiteralFriedemann Kleint2019-11-281-1/+1
| | | | | | | | | | | | | | | | Use QString instead, fixing: src\tools\androidtestrunner\main.cpp(474): warning C4003: not enough arguments for function-like macro invocation 'QStringLiteral' Change-Id: I88b8c0f1dfa7828460e8952510e3d4150ab68896 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Merge remote-tracking branch 'origin/dev' into wip/cmakeLeander Beernaert2019-11-191-1/+1
|\| | | | | | | Change-Id: Ifecc2d9db396d783124df8567553ba5f846f30bb
| * Fix typoBogDan Vatra2019-10-251-1/+1
| | | | | | | | | | Change-Id: I9a429805414fb50aa059677beb5f8f8a48b72d9b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* | Regenerate src/*Alexandru Croitor2019-11-141-2/+2
| | | | | | | | | | | | Change-Id: I0314b4faa1e4860e86198eea4189987e527dfec2 Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Regenerate everything under ./srcAlexandru Croitor2019-11-121-1/+0
| | | | | | | | | | | | | | Change-Id: Ibdbdc17f8c2ee41356f490dd839a47e1bcf4c586 Reviewed-by: Leander Beernaert <leander.beernaert@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Qt CMake Build Bot
* | Add --skip-install-root option to androidtestrunnerLeander Beernaert2019-10-241-4/+15
| | | | | | | | | | | | | | | | | | Add the above option to android test runner since its not required when building with Cmake. Change-Id: Ie5c9b0af29cfa76802723960071b3bd2a37a56a5 Reviewed-by: Qt CMake Build Bot Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* | Add Android test runner toolLeander Beernaert2019-10-231-0/+28
|/ | | | | Change-Id: I235bc07be0e0f7a3b0ce6297c187950a57fb31ed Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Don't excessively check all output files for failuresJan Arve Sæther2019-08-221-1/+1
| | | | | | | | | | | | | | | | | This is really just an optimization, but I suspect the author of the code assumed that the bitwise &= operator short-cicuits. (It doesn't). So this patch should then fix the code to have the intended behavior. We don't have to check for failures in the remaining output files once we've found one. pullFiles() returns just a bool indicating if one of the output files has a recorded fail, so checking the remaining output files after the first found failure is just a waste (and ideally they should contain the same failure (however, flaky tests might break this ideal)). Drive-by fix. Change-Id: I951e500a69198e7ed124be32199ac81bbddb9bf7 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix escaping of additional app parameters in adb shell commandDaniel Smith2019-08-191-1/+1
| | | | | Change-Id: I80e5b98efbc9654c684b3d78ba0d6688c21bd0f3 Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Fix 'make check' for android-mingw32Jan Arve Sæther2019-07-031-1/+1
| | | | | | | | | | | | | | | | | | | g_options.buildPath did not have native separators. This caused INSTALL_ROOT to not have native path separators, which again made 'mingw32-make check' fail to deploy the .apk. (The actual failure was that mkdir failed because it did not accept paths with forward-slashes, so the install_target rule failed. For the record, the command of that rule had the following call to mkdir: mkdir $(INSTALL_ROOT:@msyshack@%=%)\libs\x86 Change-Id: Id792c36986b52a527546d48aa9f7d9587e7a18d9 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* Fix androidtestrunner for windowsJan Arve Sæther2019-06-191-12/+6
| | | | | | | | | | | | | | | | | | | First, we cannot quote the whole command in double quotes, since the command itself very often have double quotes inside it. Secondly, we should use the same that the ssh(1) command does: Instead of adb shell setprop foo 'a b' we should use adb shell setprop foo "'a b'" as explained here: [https://developer.android.com/studio/command-line/adb#shellcommands] Last hunk in isRunning(): The pipe character got eaten by the shell if we used a single quote (so the stuff after the pipe (grep) was actually run locally). Switching to ssh-style quoting fixed that. Change-Id: I3075cdf8595ac2549cec8019f2cba79f77815e0b Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Run prebuilt android test APKsBogDan Vatra2019-06-131-11/+43
| | | | | | | | | | | | androidtestrunner now checks is the apk is build and if it is, it will skip the build phase. Now we can build the apks in parallel (which takes most of the time) and run them sequentially. This way running tests on Android is much faster. Change-Id: I82f34723ac08f7728cc0daab3366e03821335eed Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Android: Nuke ant supportBogDan Vatra2019-06-061-1/+1
| | | | | | | | | | | | | Ant is history for so many years, yet we forgot to remove it from androiddeployqt. [ChangeLog][Android] Remove ant support from androiddeployqt Change-Id: I093295e18e8710c565e9d101e21c49b3c62f6322 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
* Say hello to androidtestrunnerBogDan Vatra2019-06-062-0/+477
androidtestrunner is a tool needed to run qt tests on Android. Now you can run tests as simple as you run them on Linux, macOS, Windows. "$ make check" it's all you need to run tests on the default android device. ANDROID_DEVICE_SERIAL env variable can be used to use a specific android serial. Use cases: $ make -j1 check -j1 is needed to make sure we don't run multiple tests in parallel. $ ANDROID_DEVICE_SERIAL="emulator-5554" make check Run the test on "emulator-5554" $ make TESTARGS="-- -xml" check Switch to xml output. All params after -- are passed to test application. $ make TESTARGS="-- -o out.xml,xml -o out.txt,txt -o -,tap -vs" check Create two files out.xml and out.txt in the current folder and print "tap" format to stdout and enable logging of every signal emission. [ChangeLog][Android] Make it easy to run Qt tests on Android. "$ make check" is all it's needed to run a test on an Android device. Change-Id: I1a7f64b62608f7367b5a6aabf5d6c6e7e50242e6 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>