summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Fält <simo.falt@qt.io>2020-09-09 08:32:21 +0300
committerSimo Fält <simo.falt@qt.io>2020-11-20 13:28:31 +0000
commit13c460d0ff1a4eecfb7b1bc43a863783ed59a2bd (patch)
tree5aa2fd5f9657c86f00f74767405ddc4870e998ae
parent612a01be6513894ab1ec5a36b699a2142ba7f35c (diff)
Add coin instructions to run Android test in emulator
Task-number: QTQAINFRA-3867 Pick-to: 6.0 Change-Id: Ie6dd9c2dfeeccd526c2133d7ac03efce5b7ed091 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
-rw-r--r--coin/instructions/call_cmake_for_standalone_tests.yaml14
-rw-r--r--coin/instructions/cmake_regular_test_instructions_common.yaml10
-rw-r--r--coin/instructions/coin_module_test_android_start_emulator.yaml24
-rw-r--r--coin/instructions/coin_module_test_template_common.yaml1
-rw-r--r--coin/instructions/coin_module_test_template_v3.yaml3
-rw-r--r--coin/instructions/coin_qtbase_build_template_v2.yaml20
-rwxr-xr-xutil/android/android_cmakelist_patcher.sh36
7 files changed, 93 insertions, 15 deletions
diff --git a/coin/instructions/call_cmake_for_standalone_tests.yaml b/coin/instructions/call_cmake_for_standalone_tests.yaml
index 501ab3abab..7ab936cf87 100644
--- a/coin/instructions/call_cmake_for_standalone_tests.yaml
+++ b/coin/instructions/call_cmake_for_standalone_tests.yaml
@@ -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
diff --git a/coin/instructions/cmake_regular_test_instructions_common.yaml b/coin/instructions/cmake_regular_test_instructions_common.yaml
index ec6f23a3f7..3a9e75c576 100644
--- a/coin/instructions/cmake_regular_test_instructions_common.yaml
+++ b/coin/instructions/cmake_regular_test_instructions_common.yaml
@@ -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
diff --git a/coin/instructions/coin_module_test_android_start_emulator.yaml b/coin/instructions/coin_module_test_android_start_emulator.yaml
new file mode 100644
index 0000000000..fc5f259043
--- /dev/null
+++ b/coin/instructions/coin_module_test_android_start_emulator.yaml
@@ -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
diff --git a/coin/instructions/coin_module_test_template_common.yaml b/coin/instructions/coin_module_test_template_common.yaml
index 716a4bb1e7..bd610a2281 100644
--- a/coin/instructions/coin_module_test_template_common.yaml
+++ b/coin/instructions/coin_module_test_template_common.yaml
@@ -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"
diff --git a/coin/instructions/coin_module_test_template_v3.yaml b/coin/instructions/coin_module_test_template_v3.yaml
index 9984305a03..fa521f0d54 100644
--- a/coin/instructions/coin_module_test_template_v3.yaml
+++ b/coin/instructions/coin_module_test_template_v3.yaml
@@ -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
diff --git a/coin/instructions/coin_qtbase_build_template_v2.yaml b/coin/instructions/coin_qtbase_build_template_v2.yaml
index ec3856d5a5..3421a51598 100644
--- a/coin/instructions/coin_qtbase_build_template_v2.yaml
+++ b/coin/instructions/coin_qtbase_build_template_v2.yaml
@@ -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]
diff --git a/util/android/android_cmakelist_patcher.sh b/util/android/android_cmakelist_patcher.sh
new file mode 100755
index 0000000000..36888d8825
--- /dev/null
+++ b/util/android/android_cmakelist_patcher.sh
@@ -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