diff options
5 files changed, 32 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" diff --git a/util/testrunner/qt-testrunner.py b/util/testrunner/qt-testrunner.py index 20ef2ccbb7..8a9b469977 100755 --- a/util/testrunner/qt-testrunner.py +++ b/util/testrunner/qt-testrunner.py @@ -157,9 +157,16 @@ Default flags: --max-repeats 5 --passes-needed 1 args.log_dir = "." args.test_basename = os.path.basename(args.testargs[0]) + if args.test_basename.endswith(".exe"): 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 # 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 |