From 80bbbe542fb0f666046a4d0e7059d41380756f19 Mon Sep 17 00:00:00 2001 From: Toni Saario Date: Thu, 23 Nov 2023 12:34:44 +0200 Subject: [PATCH] Coin: Add vxworks test instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds testrunner and emulator start for VxWorks. Change-Id: I4ae63fb2019ff154d65b5b136f0c681e36db9e79 Reviewed-by: Simo Fält --- coin/instructions/cmake_run_ctest.yaml | 13 ++- .../cmake_setup_running_tests_env_vars.yaml | 12 +++ coin/instructions/vxworks_test_env_setup.yaml | 85 +++++++++++++++++++ coin/instructions/vxworks_testrunner.yaml | 39 +++++++++ 4 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 coin/instructions/vxworks_test_env_setup.yaml create mode 100644 coin/instructions/vxworks_testrunner.yaml diff --git a/coin/instructions/cmake_run_ctest.yaml b/coin/instructions/cmake_run_ctest.yaml index e51c9bbd76f..af996fc57ed 100644 --- a/coin/instructions/cmake_run_ctest.yaml +++ b/coin/instructions/cmake_run_ctest.yaml @@ -23,6 +23,13 @@ instructions: condition: property property: target.osVersion in_values: [QNX_710] + - type: AppendToEnvironmentVariable + variableName: TESTRUNNER + variableValue: " {{.AgentWorkingDir}}/coin_vxworks_qemu_runner.sh" + enable_if: + condition: property + property: target.osVersion + in_values: [VxWorks] - type: Group enable_if: condition: property @@ -52,6 +59,8 @@ instructions: property: host.os equals_value: Windows + - !include "{{qt/qtbase}}/vxworks_test_env_setup.yaml" + # Keep the testrun quiet for ASAN testruns, since there are FAILs happening all over the place... - type: EnvironmentVariable variableName: CTEST_ARGS @@ -117,7 +126,7 @@ instructions: command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution ignoreExitCode: false - maxTimeInSeconds: 10800 + maxTimeInSeconds: 14400 maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}" userMessageOnFailure: > Failed to run tests. @@ -131,7 +140,7 @@ instructions: command: "{{.Env.TESTS_ENV_PREFIX}} ctest {{.Env.CTEST_ARGS}}" executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution ignoreExitCode: true - maxTimeInSeconds: 10800 + maxTimeInSeconds: 14400 maxTimeBetweenOutput: "{{.Env.COIN_COMMAND_OUTPUT_TIMEOUT}}" userMessageOnFailure: > Failed to run tests. diff --git a/coin/instructions/cmake_setup_running_tests_env_vars.yaml b/coin/instructions/cmake_setup_running_tests_env_vars.yaml index b9387d74c60..08bb48ac3aa 100644 --- a/coin/instructions/cmake_setup_running_tests_env_vars.yaml +++ b/coin/instructions/cmake_setup_running_tests_env_vars.yaml @@ -45,3 +45,15 @@ instructions: - condition: property property: features not_contains_value: DisableTests + - type: Group + instructions: + - !include "{{qt/qtbase}}/vxworks_testrunner.yaml" + enable_if: + condition: and + conditions: + - condition: property + property: target.osVersion + equals_value: VxWorks + - condition: property + property: features + not_contains_value: DisableTests diff --git a/coin/instructions/vxworks_test_env_setup.yaml b/coin/instructions/vxworks_test_env_setup.yaml new file mode 100644 index 00000000000..451d60c7f03 --- /dev/null +++ b/coin/instructions/vxworks_test_env_setup.yaml @@ -0,0 +1,85 @@ +type: Group +instructions: + # Allows access from NFS export. + - type: ExecuteCommand + command: "chmod -R 777 {{.AgentWorkingDir}}" + maxTimeInSeconds: 60 + maxTimeBetweenOutput: 60 + userMessageOnFailure: "Failed to set dir permissions" + - type: MakeDirectory + directory: "{{.AgentWorkingDir}}/vxworkshome" + - type: ExecuteCommand + command: "sudo chown 2001:100 {{.AgentWorkingDir}}/vxworkshome" + maxTimeInSeconds: 60 + maxTimeBetweenOutput: 60 + userMessageOnFailure: "Failed to vxworks home ownership" + - type: ExecuteCommand + command: "mkfifo /tmp/guest.in /tmp/guest.out" + maxTimeInSeconds: 60 + maxTimeBetweenOutput: 60 + userMessageOnFailure: "Failed to mkfifo" + - type: ExecuteCommand + command: "{{.Env.HOME}}/vxworks_qemu_launcher.sh" + maxTimeInSeconds: 60 + maxTimeBetweenOutput: 60 + userMessageOnFailure: "Failed to start VxWorks emulator" + - type: WriteFile + filename: "{{.AgentWorkingDir}}/coin_vxworks_vars.sh" + fileMode: 493 + fileContents: | + #!/bin/bash + sleep 10 + declare -A hosts + hosts["qt-test-server"]="172.31.1.1" + hosts["qt-test-server.qt-test-net"]="172.31.1.1" + hosts["qt-test-server.test-net.qt.local"]="172.31.1.1" + hosts["vsftpd.test-net.qt.local"]="172.31.1.1" + hosts["apache2.test-net.qt.local"]="172.31.1.1" + hosts["squid.test-net.qt.local"]="172.31.1.1" + hosts["danted.test-net.qt.local"]="172.31.1.1" + hosts["ftp-proxy.test-net.qt.local"]="172.31.1.1" + hosts["echo.test-net.qt.local"]="172.31.1.1" + hosts["cyrus.test-net.qt.local"]="172.31.1.1" + hosts["iptables.test-net.qt.local"]="172.31.1.1" + + declare -A env_vars + env_vars["LD_LIBRARY_PATH"]=$VXWORKS_TEST_LIBS_PATH + env_vars["ICU_DATA"]="/opt/fsl_imx6_2_0_6_2_VSB/3pp/ICU/icu/source/data/in/icudt73l.dat" + env_vars["TMPDIR"]="/tmp" + env_vars["QT_QPA_FONTDIR"]="/opt/fsl_imx6_2_0_6_2_VSB/fonts" + env_vars["VXWORKS_CERTS_DIR"]="/opt/fsl_imx6_2_0_6_2_VSB/certs" + env_vars["HOME"]="/home/qt/work/vxworkshome" + env_vars["QML_LOADERTHREAD_STACK_SIZE"]="131072" + env_vars["QTEST_FUNCTION_TIMEOUT"]="600000" + env_vars["QT_PLUGIN_PATH"]="/home/qt/work/install/target/plugins" + env_vars["QT_QPA_PLATFORM_PLUGIN_PATH"]="/home/qt/work/install/target/plugins/platforms" + + for i in "${!hosts[@]}" + do + echo "hostAdd \"$i\", \"${hosts[$i]}\"" > /tmp/guest.in + sleep 1 + done + + for i in "${!env_vars[@]}" + do + echo "cmd setenv \"$i\" \"${env_vars[$i]}\"" > /tmp/guest.in + sleep 1 + done + + echo "cmd sysvar set -o ipdnsc.primaryns \"10.150.153.13\"" > /tmp/guest.in + sleep 1 + + date=($(date "+%Y-%m-%d %H:%M:%S")) + echo "cmd date ${date[0]}" > /tmp/guest.in + sleep 1 + echo "cmd time ${date[1]}" > /tmp/guest.in + + - type: ExecuteCommand + command: "{{.AgentWorkingDir}}/coin_vxworks_vars.sh" + maxTimeInSeconds: 600 + maxTimeBetweenOutput: 600 + userMessageOnFailure: "Failed to run coin_vxworks_vars.sh after having started the emulator" +enable_if: + condition: property + property: target.osVersion + equals_value: VxWorks diff --git a/coin/instructions/vxworks_testrunner.yaml b/coin/instructions/vxworks_testrunner.yaml new file mode 100644 index 00000000000..8f88c3eaf3e --- /dev/null +++ b/coin/instructions/vxworks_testrunner.yaml @@ -0,0 +1,39 @@ +type: Group +instructions: + - type: WriteFile + filename: "{{.AgentWorkingDir}}/coin_vxworks_qemu_runner.sh" + fileMode: 493 + fileContents: | + #!/bin/bash + quoted_args=`python3 -c 'import sys, shlex; print(shlex.join(sys.argv[2:]))' "$@"` + + testdir="$(dirname $1)" + testexecutable="$1" + echo RUNNING via serial: "$quoted_args" + echo "cmd rtp exec -p 200 -t 0x01000000 -u 300000 $testexecutable -- $quoted_args" > /home/qt/work/vx.sh + echo "cmd echo \"qtest_in_vxworks_complete: $?\"" >> /home/qt/work/vx.sh + #rtp exec Execute a process. + # -p : specify the initial task priority + # 200 is high, 255 max + # -t : task options for the RTPs initial task + # 0x01000000 turn on coprocessor + # -u : specify the size of the process task stack + # -- : mark the end of "rtp exec" options. + + # qtest_in_vxworks_complete echo is used to detect test process completion as it will + # be echoed after test process ends normally or crashes when normal log lines are not present. + + echo "cmd cd $testdir" > /tmp/guest.in + sleep 0.5 + echo " /tmp/guest.in + + while read -t 600 line; do + echo "$line" + if echo "$line" | /usr/bin/grep -q "qtest_in_vxworks_complete" + then + read -t 1 line