CI: Add QNX qemu support
* Script used to parse env variables and run test over ssh on qemu * Script to start qnx qemu * Script used to set env variables for ssh so they are correct in qemu * Add b2qt sdk host toolchain to path for actual qemu binaries Task-number: QTBUG-87628 Pick-to: 6.2 Change-Id: I951172211c2963654899491568771310a410e616 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
This commit is contained in:
parent
c91b5dae9a
commit
6c22f7e39c
@ -0,0 +1,40 @@
|
||||
type: Group
|
||||
instructions:
|
||||
- type: WriteFile
|
||||
fileContents: |
|
||||
#!/usr/bin/python3
|
||||
import subprocess
|
||||
import calendar
|
||||
import datetime
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
file=os.path.basename(sys.argv[1])
|
||||
timestamp = str(round(time.time() * 1000))
|
||||
resultdir = os.getenv('COIN_CTEST_RESULTSDIR')
|
||||
results_file = resultdir + "/testresults/" + file +"-" + timestamp + ".xml,xml"
|
||||
testargs = [" -o", results_file, "-o", "-,txt"]
|
||||
if re.search("testlib.selftests.tst_selftests", sys.argv[1]):
|
||||
testargs = []
|
||||
testcmd = sys.argv[1]
|
||||
testcmd += ' '.join(testargs)
|
||||
qemuargs = os.getenv('TESTARGS')
|
||||
sshcmd, ldenv, backend, qpa = qemuargs.split()
|
||||
testdir = sys.argv[1][::-1].split('/', 1)[1][::-1]
|
||||
testcmd = "cd " + testdir + ";" + ldenv + " " + backend + " " + qpa + " " + testcmd
|
||||
proc = subprocess.run(["ssh", sshcmd, testcmd])
|
||||
exit(proc.returncode)
|
||||
filename: "{{.SourceDir}}/coin_qnx_qemu_runner.py"
|
||||
fileMode: 755
|
||||
- type: ExecuteCommand
|
||||
command: "chmod 755 {{.SourceDir}}/coin_qnx_qemu_runner.py"
|
||||
maxTimeInSeconds: 10
|
||||
maxTimeBetweenOutput: 10
|
||||
userMessageOnFailure: >
|
||||
Failed to change file permission.
|
||||
disable_if:
|
||||
condition: property
|
||||
property: host.os
|
||||
equals_value: Windows
|
@ -50,7 +50,7 @@ instructions:
|
||||
equals_property: target.os
|
||||
- condition: property
|
||||
property: target.osVersion
|
||||
not_equals_value: QEMU
|
||||
not_in_values: [QEMU, QNX_710]
|
||||
- type: Group
|
||||
instructions:
|
||||
- type: EnvironmentVariable
|
||||
@ -64,4 +64,16 @@ instructions:
|
||||
equals_property: target.os
|
||||
- condition: property
|
||||
property: target.osVersion
|
||||
not_equals_value: QEMU
|
||||
not_in_values: [QEMU, QNX_710]
|
||||
- type: Group
|
||||
instructions:
|
||||
- !include "{{qt/qtbase}}/cmake_setup_running_qnxqemu_tests_env_vars.yaml"
|
||||
enable_if:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: property
|
||||
property: target.osVersion
|
||||
equals_value: QNX_710
|
||||
- condition: property
|
||||
property: features
|
||||
not_contains_value: DisableTests
|
||||
|
90
coin/instructions/coin_module_test_qnx_start_emulator.yaml
Normal file
90
coin/instructions/coin_module_test_qnx_start_emulator.yaml
Normal file
@ -0,0 +1,90 @@
|
||||
type: Group
|
||||
instructions:
|
||||
- type: Group
|
||||
instructions:
|
||||
- type: WriteFile
|
||||
fileContents: |
|
||||
#!/bin/bash
|
||||
RESULT=1 # 0 upon success
|
||||
TIMEOUT=60
|
||||
COUNT=0
|
||||
QEMUPID=0
|
||||
QEMUIPADDR="{{.Env.QNX_QEMU_IPADDR}}"
|
||||
mkqnximage --type=qemu --hostname=QNX_QEMU_CI --graphics=no --ip=${QEMUIPADDR} --build --run=-h </dev/null &>/dev/null & disown
|
||||
|
||||
while [[ "QEMUPID" -eq 0 ]]
|
||||
do
|
||||
QEMUPID=`pidof qemu-system-x86_64`
|
||||
|
||||
if [[ "QEMUPID" -eq 0 ]]; then
|
||||
echo "QEMU not yet started, wait 1 sec."
|
||||
COUNT=$((COUNT+1))
|
||||
sleep 1
|
||||
else
|
||||
echo "QEMU running with PID: $QEMUPID"
|
||||
fi
|
||||
|
||||
if [[ "COUNT" -eq "TIMEOUT" ]]; then
|
||||
echo "Timeout waiting QEMU to start"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
while :; do
|
||||
echo "Waiting QEMU SSH coming up"
|
||||
status=$(ssh -o BatchMode=yes -o ConnectTimeout=1 ${QEMUIPADDR} echo ok 2>&1)
|
||||
RESULT=$?
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
echo "QEMU SSH Connected ok"
|
||||
break
|
||||
fi
|
||||
if [ $RESULT -eq 255 ]; then
|
||||
# connection refused also gets you here
|
||||
if [[ $status == *"Permission denied"* ]] ; then
|
||||
# permission denied indicates the ssh link is okay
|
||||
echo "QEMU SSH server up"
|
||||
RESULT=0
|
||||
break
|
||||
fi
|
||||
fi
|
||||
TIMEOUT=$((TIMEOUT-1))
|
||||
if [ $TIMEOUT -eq 0 ]; then
|
||||
echo "QEMU SSH timed out"
|
||||
exit $RESULT
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
exit $RESULT
|
||||
filename: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh"
|
||||
fileMode: 755
|
||||
- type: ChangeDirectory
|
||||
directory: "{{.Env.QNX_QEMU}}"
|
||||
- type: ExecuteCommand
|
||||
command: "chmod 755 {{.Env.QNX_QEMU}}/start_qnx_qemu.sh"
|
||||
maxTimeInSeconds: 10
|
||||
maxTimeBetweenOutput: 10
|
||||
userMessageOnFailure: >
|
||||
Failed to change file permission.
|
||||
disable_if:
|
||||
condition: property
|
||||
property: host.os
|
||||
equals_value: Windows
|
||||
- type: ExecuteCommand
|
||||
command: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh"
|
||||
maxTimeInSeconds: 100
|
||||
maxTimeBetweenOutput: 100
|
||||
userMessageOnFailure: >
|
||||
Failed to start QNX qemu, check logs.
|
||||
disable_if:
|
||||
condition: property
|
||||
property: host.os
|
||||
equals_value: Windows
|
||||
enable_if:
|
||||
condition: and
|
||||
conditions:
|
||||
- condition: property
|
||||
property: target.osVersion
|
||||
equals_value: QNX_710
|
||||
- condition: property
|
||||
property: features
|
||||
not_contains_value: DisableTests
|
@ -3,6 +3,7 @@ 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"
|
||||
- !include "{{qt/qtbase}}/coin_module_test_qnx_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"
|
||||
|
@ -273,14 +273,14 @@ instructions:
|
||||
enable_if:
|
||||
condition: property
|
||||
property: target.osVersion
|
||||
equals_value: QEMU
|
||||
in_values: [QEMU, QNX_710]
|
||||
- type: EnvironmentVariable
|
||||
variableName: TARGET_ENV_PREFIX
|
||||
variableValue: ""
|
||||
disable_if:
|
||||
condition: property
|
||||
property: target.osVersion
|
||||
equals_value: QEMU
|
||||
in_values: [QEMU, QNX_710]
|
||||
|
||||
# Windows on Arm, cross-compilation with MSVC
|
||||
- type: Group
|
||||
@ -305,6 +305,12 @@ instructions:
|
||||
property: target.os
|
||||
equals_value: QNX
|
||||
instructions:
|
||||
- type: WriteFile
|
||||
fileContents: "#!/bin/bash\nexport TESTARGS={{.Env.TESTARGS}}\nexport TESTRUNNER={{.Env.TESTRUNNER}}\nexport COIN_CTEST_RESULTSDIR={{.Env.COIN_CTEST_RESULTSDIR}}\n$*"
|
||||
filename: "{{.Env.HOME}}/prefix.sh"
|
||||
fileMode: 493
|
||||
maxTimeInSeconds: 20
|
||||
maxTimeBetweenOutput: 20
|
||||
- type: EnvironmentVariable
|
||||
variableName: QNX_TARGET
|
||||
variableValue: "{{.Env.QNX_710}}/target/qnx7"
|
||||
@ -326,6 +332,9 @@ instructions:
|
||||
- type: EnvironmentVariable
|
||||
variableName: QNX_HOST
|
||||
variableValue: "{{.Env.QNX_710}}/host/linux/x86_64"
|
||||
- type: AppendToEnvironmentVariable
|
||||
variableName: PATH
|
||||
variableValue: ":{{.Env.QEMUARMV7_TOOLCHAIN_SYSROOT}}/../x86_64-pokysdk-linux/usr/bin:"
|
||||
enable_if:
|
||||
condition: property
|
||||
property: host.os
|
||||
|
Loading…
Reference in New Issue
Block a user