Skip to content

Commit

Permalink
Add coin instructions to run Android test in emulator
Browse files Browse the repository at this point in the history
Task-number: QTQAINFRA-3867
Pick-to: 6.0
Change-Id: Ie6dd9c2dfeeccd526c2133d7ac03efce5b7ed091
Reviewed-by: Assam Boudjelthia <[email protected]>
  • Loading branch information
faltsi committed Nov 20, 2020
1 parent 612a01b commit 13c460d
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 15 deletions.
14 changes: 14 additions & 0 deletions coin/instructions/call_cmake_for_standalone_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
type: Group
instructions:
- type: ChangeDirectory
directory: "{{.SourceDir}}"
- type: ExecuteCommand
command: "{{.SourceDir}}/util/android/android_cmakelist_patcher.sh"
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200
userMessageOnFailure: >
Failed to patch CMakeLists.txt.
enable_if:
condition: property
property: features
contains_value: AndroidTestRun
- type: ChangeDirectory
directory: "{{.BuildDir}}"
- type: ExecuteCommand
command: "{{.Env.TESTS_ENV_PREFIX}} {{.Env.INSTALL_DIR_FOR_CMAKE_TESTS}}\\bin\\qt-internal-configure-tests {{.Env.COIN_CMAKE_ARGS}}"
executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
Expand Down
10 changes: 10 additions & 0 deletions coin/instructions/cmake_regular_test_instructions_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,13 @@ instructions:
Failed to install tests archive.
- type: ChangeDirectory
directory: "{{.SourceDir}}_standalone_tests"
- type: ExecuteCommand
command: "ln -s {{.InstallDir}}/target fake_prefix"
maxTimeInSeconds: 6000
maxTimeBetweenOutput: 1200
userMessageOnFailure: >
Failed to run android hack. See QTBUG-88579 to check if this can be removed
enable_if:
condition: property
property: features
contains_value: AndroidTestRun
24 changes: 24 additions & 0 deletions coin/instructions/coin_module_test_android_start_emulator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
type: Group
instructions:
- type: Group
instructions:
- type: ExecuteCommand
command: ["{{.Env.ANDROID_SDK_HOME}}/tools/emulator", "@x86emulator","-no-audio","-no-window","-gpu","swiftshader_indirect","-partition-size","4000"]
maxTimeInSeconds: 1800
maxTimeBetweenOutput: 600
userMessageOnFailure: "Failed to run emulator, check logs."
startInBackground: True
- type: ExecuteCommand
command: ["{{.Env.ANDROID_SDK_HOME}}/platform-tools/adb","devices"]
maxTimeInSeconds: 1800
maxTimeBetweenOutput: 600
userMessageOnFailure: "Failed to run adb, check logs."
- type: ExecuteCommand
command: ["{{.Env.ANDROID_SDK_HOME}}/platform-tools/adb","wait-for-device"]
maxTimeInSeconds: 1800
maxTimeBetweenOutput: 1800
userMessageOnFailure: "Failed to run adb, check logs."
enable_if:
condition: property
property: features
contains_value: AndroidTestRun
1 change: 1 addition & 0 deletions coin/instructions/coin_module_test_template_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ type: Group
instructions:
# The build env is needed on MSVC so that tst_qmake can properly build apps / libraries.
- !include "{{qt/qtbase}}/prepare_building_env.yaml"
- !include "{{qt/qtbase}}/coin_module_test_android_start_emulator.yaml"
# The test env vars are needed to pick the proper prefix.bat file.
- !include "{{qt/qtbase}}/cmake_setup_running_tests_env_vars.yaml"
- !include "{{qt/qtbase}}/coin_module_test_qemu_env_vars.yaml"
3 changes: 3 additions & 0 deletions coin/instructions/coin_module_test_template_v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ instructions:
- condition: property
property: target.osVersion
equals_value: QEMU
- condition: property
property: features
contains_value: AndroidTestRun
disable_if:
condition: property
property: features
Expand Down
20 changes: 5 additions & 15 deletions coin/instructions/coin_qtbase_build_template_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@ instructions:
instructions:
- !include "{{qt/qtbase}}/cmake_build_and_upload_test_artifacts_target.yaml"
enable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_property: target.os
- condition: property
condition: property
property: target.osVersion
equals_value: QEMU
disable_if:
condition: and
conditions:
- condition: property
property: host.os
equals_property: target.os
- condition: property
in_values: [Android_ANY, QEMU]
enable_if:
condition: property
property: target.osVersion
not_equals_value: QEMU
in_values: [IOS_ANY, Android_ANY, QEMU]
36 changes: 36 additions & 0 deletions util/android/android_cmakelist_patcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
#############################################################################
##
## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the plugins of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 3 as published by the Free Software
## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
# This util patches CMakeLists.txt files to enable running
# autotest in Android emulator in Qt CI.

tests_dir="$PWD/tests/auto"
find ${tests_dir} -iname "CMakeLists.txt" -print0 |
while IFS= read -r -d '' file; do
sed -i '/qt_internal_add_test/a\ PUBLIC_LIBRARIES\n Qt::Gui' $file
done

0 comments on commit 13c460d

Please sign in to comment.