diff options
author | Dimitrios Apostolou <jimis@qt.io> | 2022-01-13 13:28:55 +0100 |
---|---|---|
committer | Dimitrios Apostolou <jimis@qt.io> | 2022-02-14 12:56:06 +0100 |
commit | c37d0e84bc4e6bc9840190eaf73f5a39fbfa0b1d (patch) | |
tree | 5ff005559f9d64c67540d897da437d5a438e2130 /coin | |
parent | d6c4a3edf9adb02b6f96d43768db9f90a6623de7 (diff) |
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>
Diffstat (limited to 'coin')
4 files changed, 25 insertions, 54 deletions
diff --git a/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml b/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml index c2560be37e..4f067cca58 100644 --- a/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml +++ b/coin/instructions/cmake_run_ctest_enforce_exit_code.yaml @@ -15,6 +15,13 @@ instructions: condition: property property: host.os 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 variableName: TESTRUNNER variableValue: "{{.InstallDir}}\\bin\\qt-testrunner.py --" diff --git a/coin/instructions/cmake_setup_running_qnxqemu_tests_env_vars.yaml b/coin/instructions/cmake_setup_running_qnxqemu_tests_env_vars.yaml index 031e3eb4c1..0fb9768a15 100644 --- a/coin/instructions/cmake_setup_running_qnxqemu_tests_env_vars.yaml +++ b/coin/instructions/cmake_setup_running_qnxqemu_tests_env_vars.yaml @@ -1,40 +1,20 @@ type: Group instructions: - type: WriteFile + filename: "{{.SourceDir}}/coin_qnx_qemu_runner.sh" + fileMode: 493 fileContents: | - #!/usr/bin/python3 - import subprocess - import calendar - import datetime - import time - import sys - import os - import re + #!/bin/sh - 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 + # Many tests require changing into their directory, in order to find + # files they depend on. + testdir=`dirname "$1"` + + # The remote SSH server executes everything we send under "sh -c". So + # the only way to preserve arguments is to shell-quote them and send + # them as a single string. We use python's shlex module for that. + + quoted_args=`python3 -c 'import sys, shlex; print(shlex.join(sys.argv[1:]))' "$@"` + + ssh "$QNX_QEMU_SSH" \ + cd "$testdir" \; $QNX_TEST_ENV "$quoted_args" diff --git a/coin/instructions/coin_module_test_qnx_start_emulator.yaml b/coin/instructions/coin_module_test_qnx_start_emulator.yaml index 8e50313a88..2d2976f7ae 100644 --- a/coin/instructions/coin_module_test_qnx_start_emulator.yaml +++ b/coin/instructions/coin_module_test_qnx_start_emulator.yaml @@ -56,20 +56,10 @@ instructions: done exit $RESULT filename: "{{.Env.QNX_QEMU}}/start_qnx_qemu.sh" - fileMode: 755 + fileMode: 493 - 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 diff --git a/coin/instructions/prepare_building_env.yaml b/coin/instructions/prepare_building_env.yaml index 6c52381f4e..674eb15fce 100644 --- a/coin/instructions/prepare_building_env.yaml +++ b/coin/instructions/prepare_building_env.yaml @@ -280,14 +280,14 @@ instructions: enable_if: condition: property property: target.osVersion - in_values: [QEMU, QNX_710] + in_values: [QEMU] - type: EnvironmentVariable variableName: TARGET_ENV_PREFIX variableValue: "" disable_if: condition: property property: target.osVersion - in_values: [QEMU, QNX_710] + in_values: [QEMU] # Windows on Arm, cross-compilation with MSVC - type: Group @@ -312,12 +312,6 @@ 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" |