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>
This commit is contained in:
Simo Fält 2020-09-09 08:32:21 +03:00
parent 612a01be65
commit 13c460d0ff
7 changed files with 93 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -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]

View File

@ -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