Clean up QNX platform configs and improve testrunner scripts

QNX requires its own TESTRUNNER script in order to SSH to the QEMU guest
and run the tests. Simplify it a lot and fix the way it passes arguments
so that they retain spaces and quotation.

Also wrap it with the generic TESTRUNNER script for CI, which is
qt-testrunner.py, so that tests can re-run in case of flakiness.

Delete prefix.sh as the environment variables are now properly set in
the Coin platform config files.

Avoid executing extra chmod commands to make scripts executable,
but use the right Coin instruction for that. For reference, we
use 493 for file mode which equals to 755 in octal, as Coin expects
the file mode in decimal.

Change-Id: Ife4d1caef606f48b92ba1da1cfb14ec0dea11ef2
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
This commit is contained in:
Dimitrios Apostolou 2022-01-13 13:28:55 +01:00
parent d6c4a3edf9
commit c37d0e84bc
5 changed files with 32 additions and 54 deletions

View File

@ -15,6 +15,13 @@ instructions:
condition: property condition: property
property: host.os property: host.os
equals_value: Windows equals_value: Windows
- type: AppendToEnvironmentVariable
variableName: TESTRUNNER
variableValue: " {{.SourceDir}}/coin_qnx_qemu_runner.sh"
enable_if:
condition: property
property: target.osVersion
in_values: [QNX_710]
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: TESTRUNNER variableName: TESTRUNNER
variableValue: "{{.InstallDir}}\\bin\\qt-testrunner.py --" variableValue: "{{.InstallDir}}\\bin\\qt-testrunner.py --"

View File

@ -1,40 +1,20 @@
type: Group type: Group
instructions: instructions:
- type: WriteFile - type: WriteFile
filename: "{{.SourceDir}}/coin_qnx_qemu_runner.sh"
fileMode: 493
fileContents: | fileContents: |
#!/usr/bin/python3 #!/bin/sh
import subprocess
import calendar
import datetime
import time
import sys
import os
import re
file=os.path.basename(sys.argv[1]) # Many tests require changing into their directory, in order to find
timestamp = str(round(time.time() * 1000)) # files they depend on.
resultdir = os.getenv('COIN_CTEST_RESULTSDIR') testdir=`dirname "$1"`
results_file = resultdir + "/testresults/" + file +"-" + timestamp + ".xml,xml"
testargs = [" -o", results_file, "-o", "-,txt"] # The remote SSH server executes everything we send under "sh -c". So
if re.search("testlib.selftests.tst_selftests", sys.argv[1]): # the only way to preserve arguments is to shell-quote them and send
testargs = [] # them as a single string. We use python's shlex module for that.
testcmd = sys.argv[1]
testcmd += ' '.join(testargs) quoted_args=`python3 -c 'import sys, shlex; print(shlex.join(sys.argv[1:]))' "$@"`
qemuargs = os.getenv('TESTARGS')
sshcmd, ldenv, backend, qpa = qemuargs.split() ssh "$QNX_QEMU_SSH" \
testdir = sys.argv[1][::-1].split('/', 1)[1][::-1] cd "$testdir" \; $QNX_TEST_ENV "$quoted_args"
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

View File

@ -56,19 +56,9 @@ instructions:
done done
exit $RESULT exit $RESULT
filename: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh" filename: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh"
fileMode: 755 fileMode: 493
- type: ChangeDirectory - type: ChangeDirectory
directory: "{{.Env.QNX_QEMU}}" 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 - type: ExecuteCommand
command: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh" command: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh"
maxTimeInSeconds: 100 maxTimeInSeconds: 100

View File

@ -280,14 +280,14 @@ instructions:
enable_if: enable_if:
condition: property condition: property
property: target.osVersion property: target.osVersion
in_values: [QEMU, QNX_710] in_values: [QEMU]
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: TARGET_ENV_PREFIX variableName: TARGET_ENV_PREFIX
variableValue: "" variableValue: ""
disable_if: disable_if:
condition: property condition: property
property: target.osVersion property: target.osVersion
in_values: [QEMU, QNX_710] in_values: [QEMU]
# Windows on Arm, cross-compilation with MSVC # Windows on Arm, cross-compilation with MSVC
- type: Group - type: Group
@ -312,12 +312,6 @@ instructions:
property: target.os property: target.os
equals_value: QNX equals_value: QNX
instructions: 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 - type: EnvironmentVariable
variableName: QNX_TARGET variableName: QNX_TARGET
variableValue: "{{.Env.QNX_710}}/target/qnx7" variableValue: "{{.Env.QNX_710}}/target/qnx7"

View File

@ -157,9 +157,16 @@ Default flags: --max-repeats 5 --passes-needed 1
args.log_dir = "." args.log_dir = "."
args.test_basename = os.path.basename(args.testargs[0]) args.test_basename = os.path.basename(args.testargs[0])
if args.test_basename.endswith(".exe"): if args.test_basename.endswith(".exe"):
args.test_basename = args.test_basename[:-4] args.test_basename = args.test_basename[:-4]
# QNX test wrapper just needs to be skipped to figure out test_basename
if args.test_basename == "coin_qnx_qemu_runner.sh":
args.test_basename = os.path.basename(args.testargs[1])
L.info("Detected coin_qnx_qemu_runner, test will be handled specially. Detected test basename: %s",
args.test_basename)
# On Android emulated platforms, "androidtestrunner" is invoked by CMake # On Android emulated platforms, "androidtestrunner" is invoked by CMake
# to wrap the tests. We have to append the test arguments to it after # to wrap the tests. We have to append the test arguments to it after
# "--". Besides that we have to detect the basename to avoid saving the # "--". Besides that we have to detect the basename to avoid saving the