diff --git a/.gitlab-ci/bare-metal/cisco-2960-poe-off.sh b/.gitlab-ci/bare-metal/cisco-2960-poe-off.sh index 2234ee79643..fdc52d3c43a 100755 --- a/.gitlab-ci/bare-metal/cisco-2960-poe-off.sh +++ b/.gitlab-ci/bare-metal/cisco-2960-poe-off.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2086 # we want word splitting if [ -z "$BM_POE_INTERFACE" ]; then echo "Must supply the PoE Interface to power down" @@ -11,7 +12,6 @@ if [ -z "$BM_POE_ADDRESS" ]; then fi SNMP_KEY="1.3.6.1.4.1.9.9.402.1.2.1.1.1.$BM_POE_INTERFACE" -SNMP_ON="i 1" SNMP_OFF="i 4" -snmpset -v2c -r 3 -t 30 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_OFF +snmpset -v2c -r 3 -t 30 -cmesaci "$BM_POE_ADDRESS" "$SNMP_KEY" $SNMP_OFF diff --git a/.gitlab-ci/bare-metal/cisco-2960-poe-on.sh b/.gitlab-ci/bare-metal/cisco-2960-poe-on.sh index 60d7d726a2c..1f80ab37889 100755 --- a/.gitlab-ci/bare-metal/cisco-2960-poe-on.sh +++ b/.gitlab-ci/bare-metal/cisco-2960-poe-on.sh @@ -1,4 +1,5 @@ #!/bin/bash +# shellcheck disable=SC2086 # we want word splitting if [ -z "$BM_POE_INTERFACE" ]; then echo "Must supply the PoE Interface to power up" @@ -16,6 +17,6 @@ SNMP_KEY="1.3.6.1.4.1.9.9.402.1.2.1.1.1.$BM_POE_INTERFACE" SNMP_ON="i 1" SNMP_OFF="i 4" -snmpset -v2c -r 3 -t 10 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_OFF +snmpset -v2c -r 3 -t 10 -cmesaci "$BM_POE_ADDRESS" "$SNMP_KEY" $SNMP_OFF sleep 3s -snmpset -v2c -r 3 -t 10 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_ON +snmpset -v2c -r 3 -t 10 -cmesaci "$BM_POE_ADDRESS" "$SNMP_KEY" $SNMP_ON diff --git a/.gitlab-ci/bare-metal/cros-servo.sh b/.gitlab-ci/bare-metal/cros-servo.sh index 018030780fe..a790a4e81d4 100755 --- a/.gitlab-ci/bare-metal/cros-servo.sh +++ b/.gitlab-ci/bare-metal/cros-servo.sh @@ -1,4 +1,7 @@ #!/bin/bash +# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime. +# shellcheck disable=SC2034 +# shellcheck disable=SC2086 # we want word splitting # Boot script for Chrome OS devices attached to a servo debug connector, using # NFS and TFTP to boot. diff --git a/.gitlab-ci/bare-metal/eth008-power-down.sh b/.gitlab-ci/bare-metal/eth008-power-down.sh index 8a270bd2c6f..d61156de192 100755 --- a/.gitlab-ci/bare-metal/eth008-power-down.sh +++ b/.gitlab-ci/bare-metal/eth008-power-down.sh @@ -7,4 +7,4 @@ if [ -z "$relay" ]; then exit 1 fi -$CI_PROJECT_DIR/install/bare-metal/eth008-power-relay.py $ETH_HOST $ETH_PORT off $relay +"$CI_PROJECT_DIR"/install/bare-metal/eth008-power-relay.py "$ETH_HOST" "$ETH_PORT" off "$relay" diff --git a/.gitlab-ci/bare-metal/eth008-power-up.sh b/.gitlab-ci/bare-metal/eth008-power-up.sh index 2d1071bb6f3..4c978ac9d53 100755 --- a/.gitlab-ci/bare-metal/eth008-power-up.sh +++ b/.gitlab-ci/bare-metal/eth008-power-up.sh @@ -7,6 +7,6 @@ if [ -z "$relay" ]; then exit 1 fi -$CI_PROJECT_DIR/install/bare-metal/eth008-power-relay.py $ETH_HOST $ETH_PORT off $relay +"$CI_PROJECT_DIR"/install/bare-metal/eth008-power-relay.py "$ETH_HOST" "$ETH_PORT" off "$relay" sleep 5 -$CI_PROJECT_DIR/install/bare-metal/eth008-power-relay.py $ETH_HOST $ETH_PORT on $relay +"$CI_PROJECT_DIR"/install/bare-metal/eth008-power-relay.py "$ETH_HOST" "$ETH_PORT" on "$relay" diff --git a/.gitlab-ci/bare-metal/expect-output.sh b/.gitlab-ci/bare-metal/expect-output.sh index db82ea097e3..425814d8794 100755 --- a/.gitlab-ci/bare-metal/expect-output.sh +++ b/.gitlab-ci/bare-metal/expect-output.sh @@ -5,26 +5,27 @@ set -e STRINGS=$(mktemp) ERRORS=$(mktemp) -trap "rm $STRINGS; rm $ERRORS;" EXIT +trap 'rm $STRINGS; rm $ERRORS;' EXIT FILE=$1 shift 1 while getopts "f:e:" opt; do case $opt in - f) echo "$OPTARG" >> $STRINGS;; - e) echo "$OPTARG" >> $STRINGS ; echo "$OPTARG" >> $ERRORS;; + f) echo "$OPTARG" >> "$STRINGS";; + e) echo "$OPTARG" >> "$STRINGS" ; echo "$OPTARG" >> "$ERRORS";; + *) exit esac done shift $((OPTIND -1)) echo "Waiting for $FILE to say one of following strings" -cat $STRINGS +cat "$STRINGS" -while ! egrep -wf $STRINGS $FILE; do +while ! grep -E -wf "$STRINGS" "$FILE"; do sleep 2 done -if egrep -wf $ERRORS $FILE; then +if grep -E -wf "$ERRORS" "$FILE"; then exit 1 fi diff --git a/.gitlab-ci/bare-metal/fastboot.sh b/.gitlab-ci/bare-metal/fastboot.sh index e4ea361b788..a7fa17137ae 100755 --- a/.gitlab-ci/bare-metal/fastboot.sh +++ b/.gitlab-ci/bare-metal/fastboot.sh @@ -1,11 +1,14 @@ #!/bin/bash +# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime. +# shellcheck disable=SC2034 +# shellcheck disable=SC2086 # we want word splitting . "$SCRIPTS_DIR"/setup-test-env.sh BM=$CI_PROJECT_DIR/install/bare-metal CI_COMMON=$CI_PROJECT_DIR/install/common -if [ -z "$BM_SERIAL" -a -z "$BM_SERIAL_SCRIPT" ]; then +if [ -z "$BM_SERIAL" ] && [ -z "$BM_SERIAL_SCRIPT" ]; then echo "Must set BM_SERIAL OR BM_SERIAL_SCRIPT in your gitlab-runner config.toml [[runners]] environment" echo "BM_SERIAL:" echo " This is the serial device to talk to for waiting for fastboot to be ready and logging from the kernel." @@ -84,10 +87,10 @@ else fi pushd rootfs - find -H | \ - egrep -v "external/(openglcts|vulkancts|amber|glslang|spirv-tools)" | - egrep -v "traces-db|apitrace|renderdoc" | \ - egrep -v $EXCLUDE_FILTER | \ + find -H . | \ + grep -E -v "external/(openglcts|vulkancts|amber|glslang|spirv-tools)" | + grep -E -v "traces-db|apitrace|renderdoc" | \ + grep -E -v $EXCLUDE_FILTER | \ cpio -H newc -o | \ xz --check=crc32 -T4 - > $CI_PROJECT_DIR/rootfs.cpio.gz popd diff --git a/.gitlab-ci/bare-metal/google-power-down.sh b/.gitlab-ci/bare-metal/google-power-down.sh index 9aa68a70d33..0404619cd92 100755 --- a/.gitlab-ci/bare-metal/google-power-down.sh +++ b/.gitlab-ci/bare-metal/google-power-down.sh @@ -7,4 +7,4 @@ if [ -z "$relay" ]; then exit 1 fi -$CI_PROJECT_DIR/install/bare-metal/google-power-relay.py off $relay +"$CI_PROJECT_DIR"/install/bare-metal/google-power-relay.py off "$relay" diff --git a/.gitlab-ci/bare-metal/google-power-up.sh b/.gitlab-ci/bare-metal/google-power-up.sh index f0c054162a2..d5c3cf77e41 100755 --- a/.gitlab-ci/bare-metal/google-power-up.sh +++ b/.gitlab-ci/bare-metal/google-power-up.sh @@ -7,6 +7,6 @@ if [ -z "$relay" ]; then exit 1 fi -$CI_PROJECT_DIR/install/bare-metal/google-power-relay.py off $relay +"$CI_PROJECT_DIR"/install/bare-metal/google-power-relay.py off "$relay" sleep 5 -$CI_PROJECT_DIR/install/bare-metal/google-power-relay.py on $relay +"$CI_PROJECT_DIR"/install/bare-metal/google-power-relay.py on "$relay" diff --git a/.gitlab-ci/bare-metal/poe-off b/.gitlab-ci/bare-metal/poe-off index f458d614fc3..3332a7b0f3d 100755 --- a/.gitlab-ci/bare-metal/poe-off +++ b/.gitlab-ci/bare-metal/poe-off @@ -10,8 +10,7 @@ if [ -z "$BM_POE_ADDRESS" ]; then exit 1 fi -SNMP_KEY="SNMPv2-SMI::mib-2.105.1.1.1.3.1.`expr 48 + $BM_POE_INTERFACE`" -SNMP_ON="i 1" +SNMP_KEY="SNMPv2-SMI::mib-2.105.1.1.1.3.1.$((48 + BM_POE_INTERFACE))" SNMP_OFF="i 2" flock /var/run/poe.lock -c "snmpset -v2c -r 3 -t 30 -cmesaci $BM_POE_ADDRESS $SNMP_KEY $SNMP_OFF" diff --git a/.gitlab-ci/bare-metal/poe-on b/.gitlab-ci/bare-metal/poe-on index 6d5653ce86d..de41fc9b819 100755 --- a/.gitlab-ci/bare-metal/poe-on +++ b/.gitlab-ci/bare-metal/poe-on @@ -10,7 +10,7 @@ if [ -z "$BM_POE_ADDRESS" ]; then exit 1 fi -SNMP_KEY="SNMPv2-SMI::mib-2.105.1.1.1.3.1.`expr 48 + $BM_POE_INTERFACE`" +SNMP_KEY="SNMPv2-SMI::mib-2.105.1.1.1.3.1.$((48 + BM_POE_INTERFACE))" SNMP_ON="i 1" SNMP_OFF="i 2" diff --git a/.gitlab-ci/bare-metal/poe-powered.sh b/.gitlab-ci/bare-metal/poe-powered.sh index b075aaec1fe..46aa7864f66 100755 --- a/.gitlab-ci/bare-metal/poe-powered.sh +++ b/.gitlab-ci/bare-metal/poe-powered.sh @@ -1,4 +1,8 @@ #!/bin/bash +# shellcheck disable=SC1091 +# shellcheck disable=SC2034 +# shellcheck disable=SC2059 +# shellcheck disable=SC2086 # we want word splitting . "$SCRIPTS_DIR"/setup-test-env.sh diff --git a/.gitlab-ci/bare-metal/rootfs-setup.sh b/.gitlab-ci/bare-metal/rootfs-setup.sh index 23226e4751b..31862d5f732 100644 --- a/.gitlab-ci/bare-metal/rootfs-setup.sh +++ b/.gitlab-ci/bare-metal/rootfs-setup.sh @@ -1,4 +1,5 @@ -#!/bin/bash +#!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting rootfs_dst=$1 diff --git a/.gitlab-ci/build/compiler-wrapper-clang++-15.sh b/.gitlab-ci/build/compiler-wrapper-clang++-15.sh index 4e0b819661d..81935d3c4a7 100755 --- a/.gitlab-ci/build/compiler-wrapper-clang++-15.sh +++ b/.gitlab-ci/build/compiler-wrapper-clang++-15.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper-clang++.sh b/.gitlab-ci/build/compiler-wrapper-clang++.sh index cf3cd3fe676..f9d6a3f1db4 100755 --- a/.gitlab-ci/build/compiler-wrapper-clang++.sh +++ b/.gitlab-ci/build/compiler-wrapper-clang++.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper-clang-15.sh b/.gitlab-ci/build/compiler-wrapper-clang-15.sh index 903bdd6f1c1..38cbcdc6b98 100755 --- a/.gitlab-ci/build/compiler-wrapper-clang-15.sh +++ b/.gitlab-ci/build/compiler-wrapper-clang-15.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper-clang.sh b/.gitlab-ci/build/compiler-wrapper-clang.sh index 99cf0cb7e60..40dbe879e86 100755 --- a/.gitlab-ci/build/compiler-wrapper-clang.sh +++ b/.gitlab-ci/build/compiler-wrapper-clang.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper-g++.sh b/.gitlab-ci/build/compiler-wrapper-g++.sh index d0451625d47..15f392a33f8 100755 --- a/.gitlab-ci/build/compiler-wrapper-g++.sh +++ b/.gitlab-ci/build/compiler-wrapper-g++.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper-gcc.sh b/.gitlab-ci/build/compiler-wrapper-gcc.sh index ef0f8b85cf3..25974812983 100755 --- a/.gitlab-ci/build/compiler-wrapper-gcc.sh +++ b/.gitlab-ci/build/compiler-wrapper-gcc.sh @@ -1,4 +1,5 @@ #!/bin/sh +# shellcheck disable=SC1091 set -e diff --git a/.gitlab-ci/build/compiler-wrapper.sh b/.gitlab-ci/build/compiler-wrapper.sh index 0567601fe18..1f674925340 100644 --- a/.gitlab-ci/build/compiler-wrapper.sh +++ b/.gitlab-ci/build/compiler-wrapper.sh @@ -1,3 +1,5 @@ +# shellcheck disable=SC1091 +# shellcheck disable=SC2086 # we want word splitting if command -V ccache >/dev/null 2>/dev/null; then CCACHE=ccache else diff --git a/.gitlab-ci/common/capture-devcoredump.sh b/.gitlab-ci/common/capture-devcoredump.sh index f40b7482523..302b9208baa 100755 --- a/.gitlab-ci/common/capture-devcoredump.sh +++ b/.gitlab-ci/common/capture-devcoredump.sh @@ -1,7 +1,10 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2035 +# shellcheck disable=SC2061 +# shellcheck disable=SC2086 # we want word splitting while true; do - devcds=`find /sys/devices/virtual/devcoredump/ -name data 2>/dev/null` + devcds=$(find /sys/devices/virtual/devcoredump/ -name data 2>/dev/null) for i in $devcds; do echo "Found a devcoredump at $i." if cp $i /results/first.devcore; then diff --git a/.gitlab-ci/common/init-stage1.sh b/.gitlab-ci/common/init-stage1.sh index 7b74123ced7..41f1112d43d 100755 --- a/.gitlab-ci/common/init-stage1.sh +++ b/.gitlab-ci/common/init-stage1.sh @@ -22,4 +22,4 @@ echo "nameserver 8.8.8.8" > /etc/resolv.conf # Set the time so we can validate certificates before we fetch anything; # however as not all DUTs have network, make this non-fatal. -for i in 1 2 3; do sntp -sS pool.ntp.org && break || sleep 2; done || true +for _ in 1 2 3; do sntp -sS pool.ntp.org && break || sleep 2; done || true diff --git a/.gitlab-ci/common/init-stage2.sh b/.gitlab-ci/common/init-stage2.sh index f291f79008d..92e6d7b89e5 100755 --- a/.gitlab-ci/common/init-stage2.sh +++ b/.gitlab-ci/common/init-stage2.sh @@ -1,4 +1,8 @@ #!/bin/bash +# shellcheck disable=SC1090 +# shellcheck disable=SC1091 +# shellcheck disable=SC2086 # we want word splitting +# shellcheck disable=SC2155 # Second-stage init, used to set up devices and our job environment before # running tests. @@ -67,12 +71,12 @@ fi # if [ "$HWCI_KVM" = "true" ]; then unset KVM_KERNEL_MODULE - grep -qs '\bvmx\b' /proc/cpuinfo && KVM_KERNEL_MODULE=kvm_intel || { + (grep -qs '\bvmx\b' /proc/cpuinfo && KVM_KERNEL_MODULE=kvm_intel) || { grep -qs '\bsvm\b' /proc/cpuinfo && KVM_KERNEL_MODULE=kvm_amd } - [ -z "${KVM_KERNEL_MODULE}" ] && \ - echo "WARNING: Failed to detect CPU virtualization extensions" || \ + ([ -z "${KVM_KERNEL_MODULE}" ] && \ + echo "WARNING: Failed to detect CPU virtualization extensions") || \ modprobe ${KVM_KERNEL_MODULE} mkdir -p /lava-files @@ -103,14 +107,14 @@ if [ "$HWCI_FREQ_MAX" = "true" ]; then head -0 /dev/dri/renderD128 # Disable GPU frequency scaling - DEVFREQ_GOVERNOR=`find /sys/devices -name governor | grep gpu || true` + DEVFREQ_GOVERNOR=$(find /sys/devices -name governor | grep gpu || true) test -z "$DEVFREQ_GOVERNOR" || echo performance > $DEVFREQ_GOVERNOR || true # Disable CPU frequency scaling echo performance | tee -a /sys/devices/system/cpu/cpufreq/policy*/scaling_governor || true # Disable GPU runtime power management - GPU_AUTOSUSPEND=`find /sys/devices -name autosuspend_delay_ms | grep gpu | head -1` + GPU_AUTOSUSPEND=$(find /sys/devices -name autosuspend_delay_ms | grep gpu | head -1) test -z "$GPU_AUTOSUSPEND" || echo -1 > $GPU_AUTOSUSPEND || true # Lock Intel GPU frequency to 70% of the maximum allowed by hardware # and enable throttling detection & reporting. @@ -139,12 +143,12 @@ fi if [ -n "$HWCI_START_XORG" ]; then echo "touch /xorg-started; sleep 100000" > /xorg-script env \ - VK_ICD_FILENAMES=/install/share/vulkan/icd.d/${VK_DRIVER}_icd.`uname -m`.json \ + VK_ICD_FILENAMES="/install/share/vulkan/icd.d/${VK_DRIVER}_icd.$(uname -m).json" \ xinit /bin/sh /xorg-script -- /usr/bin/Xorg -noreset -s 0 -dpms -logfile /Xorg.0.log & BACKGROUND_PIDS="$! $BACKGROUND_PIDS" # Wait for xorg to be ready for connections. - for i in 1 2 3 4 5; do + for _ in 1 2 3 4 5; do if [ -e /xorg-started ]; then break fi diff --git a/.gitlab-ci/common/intel-gpu-freq.sh b/.gitlab-ci/common/intel-gpu-freq.sh index e264348e071..8d0166eac40 100755 --- a/.gitlab-ci/common/intel-gpu-freq.sh +++ b/.gitlab-ci/common/intel-gpu-freq.sh @@ -1,4 +1,14 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2013 +# shellcheck disable=SC2015 +# shellcheck disable=SC2034 +# shellcheck disable=SC2046 +# shellcheck disable=SC2059 +# shellcheck disable=SC2086 # we want word splitting +# shellcheck disable=SC2154 +# shellcheck disable=SC2155 +# shellcheck disable=SC2162 +# shellcheck disable=SC2229 # # This is an utility script to manage Intel GPU frequencies. # It can be used for debugging performance problems or trying to obtain a stable @@ -193,7 +203,7 @@ compute_freq_set() { val=${FREQ_RPn} ;; *%) - val=$((${1%?} * ${FREQ_RP0} / 100)) + val=$((${1%?} * FREQ_RP0 / 100)) # Adjust freq to comply with 50 MHz increments val=$((val / 50 * 50)) ;; @@ -242,12 +252,12 @@ set_freq_max() { [ -z "${DRY_RUN}" ] || return 0 - printf "%s" ${SET_MAX_FREQ} | tee $(print_freq_sysfs_path max) \ - $(print_freq_sysfs_path boost) > /dev/null - [ $? -eq 0 ] || { + if ! printf "%s" ${SET_MAX_FREQ} | tee $(print_freq_sysfs_path max) \ + $(print_freq_sysfs_path boost) > /dev/null; + then log ERROR "Failed to set GPU max frequency" return 1 - } + fi } # @@ -272,11 +282,11 @@ set_freq_min() { [ -z "${DRY_RUN}" ] || return 0 - printf "%s" ${SET_MIN_FREQ} > $(print_freq_sysfs_path min) - [ $? -eq 0 ] || { + if ! printf "%s" ${SET_MIN_FREQ} > $(print_freq_sysfs_path min); + then log ERROR "Failed to set GPU min frequency" return 1 - } + fi } # @@ -495,7 +505,7 @@ compute_cpu_freq_set() { val=${CPU_FREQ_cpuinfo_min} ;; *%) - val=$((${1%?} * ${CPU_FREQ_cpuinfo_max} / 100)) + val=$((${1%?} * CPU_FREQ_cpuinfo_max / 100)) ;; *[!0-9]*) log ERROR "Cannot set CPU freq to invalid value: %s" "$1" @@ -538,11 +548,11 @@ set_cpu_freq_max() { local pstate_info=$(printf "${CPU_PSTATE_SYSFS_PATTERN}" max_perf_pct) [ -e "${pstate_info}" ] && { log INFO "Setting intel_pstate max perf to %s" "${target_freq}%" - printf "%s" "${target_freq}" > "${pstate_info}" - [ $? -eq 0 ] || { + if ! printf "%s" "${target_freq}" > "${pstate_info}"; + then log ERROR "Failed to set intel_pstate max perf" res=1 - } + fi } local cpu_index @@ -555,11 +565,11 @@ set_cpu_freq_max() { log INFO "Setting CPU%s max scaling freq to %s Hz" ${cpu_index} "${target_freq}" [ -n "${DRY_RUN}" ] && continue - printf "%s" ${target_freq} > $(print_cpu_freq_sysfs_path scaling_max ${cpu_index}) - [ $? -eq 0 ] || { + if ! printf "%s" ${target_freq} > $(print_cpu_freq_sysfs_path scaling_max ${cpu_index}); + then res=1 log ERROR "Failed to set CPU%s max scaling frequency" ${cpu_index} - } + fi done return ${res} diff --git a/.gitlab-ci/common/start-x.sh b/.gitlab-ci/common/start-x.sh index 4d3336fbb92..ccd132358cb 100755 --- a/.gitlab-ci/common/start-x.sh +++ b/.gitlab-ci/common/start-x.sh @@ -13,7 +13,7 @@ fi xinit /bin/sh "${_XORG_SCRIPT}" -- /usr/bin/Xorg vt45 -noreset -s 0 -dpms -logfile /Xorg.0.log & # Wait for xorg to be ready for connections. -for i in 1 2 3 4 5; do +for _ in 1 2 3 4 5; do if [ -e "${_FLAG_FILE}" ]; then break fi diff --git a/.gitlab-ci/crosvm-init.sh b/.gitlab-ci/crosvm-init.sh index d3e3d8dabd5..c4446bf3ca5 100755 --- a/.gitlab-ci/crosvm-init.sh +++ b/.gitlab-ci/crosvm-init.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash - +# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime. +# shellcheck disable=SC2086 # we want word splitting set -e VSOCK_STDOUT=$1 diff --git a/.gitlab-ci/crosvm-runner.sh b/.gitlab-ci/crosvm-runner.sh index bd941c4a8c1..317f35db313 100755 --- a/.gitlab-ci/crosvm-runner.sh +++ b/.gitlab-ci/crosvm-runner.sh @@ -1,5 +1,5 @@ -#!/bin/sh - +#!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting set -e # If run outside of a deqp-runner invoction (e.g. piglit trace replay), then act @@ -35,7 +35,7 @@ set_vsock_context() { rm -rf $VM_TEMP_DIR mkdir $VM_TEMP_DIR || return 1 - VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((${THREAD} & 0x7f) << 25))) + VSOCK_CID=$(((CI_JOB_ID & 0x1ffffff) | ((THREAD & 0x7f) << 25))) VSOCK_STDOUT=5001 VSOCK_STDERR=5002 @@ -66,7 +66,7 @@ set_vsock_context || { echo "Could not generate crosvm vsock CID" >&2; exit 1; } echo "Variables passed through:" SCRIPT_DIR=$(readlink -en "${0%/*}") ${SCRIPT_DIR}/common/generate-env.sh | tee ${VM_TEMP_DIR}/crosvm-env.sh -cp ${SCRIPTS_DIR}/setup-test-env.sh ${VM_TEMP_DIR}/setup-test-env.sh +cp ${SCRIPT_DIR}/setup-test-env.sh ${VM_TEMP_DIR}/setup-test-env.sh # Set the crosvm-script as the arguments of the current script echo ". ${VM_TEMP_DIR}/setup-test-env.sh" > ${VM_TEMP_DIR}/crosvm-script.sh diff --git a/.gitlab-ci/cuttlefish-runner.sh b/.gitlab-ci/cuttlefish-runner.sh index 56e6019d1c1..e332b547e26 100755 --- a/.gitlab-ci/cuttlefish-runner.sh +++ b/.gitlab-ci/cuttlefish-runner.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting + section_start cuttlefish_setup "cuttlefish: setup" set -xe @@ -26,6 +28,7 @@ ADB="adb -s vsock:3:5555" $ADB root sleep 1 $ADB shell echo Hi from Android +# shellcheck disable=SC2035 $ADB logcat dEQP:D *:S & # overlay vendor @@ -97,7 +100,7 @@ $ADB shell "mkdir /data/results; cd /data; strace -o /data/results/out.strace -f --flakes /data/$GPU_VERSION-flakes.txt \ --testlog-to-xml /deqp/executor/testlog-to-xml \ --fraction-start $CI_NODE_INDEX \ - --fraction `expr $CI_NODE_TOTAL \* ${DEQP_FRACTION:-1}` \ + --fraction $(( CI_NODE_TOTAL * ${DEQP_FRACTION:-1})) \ --jobs ${FDO_CI_CONCURRENT:-4} \ $DEQP_RUNNER_OPTIONS" diff --git a/.gitlab-ci/deqp-runner.sh b/.gitlab-ci/deqp-runner.sh index 62137c39eac..1121161f0bf 100755 --- a/.gitlab-ci/deqp-runner.sh +++ b/.gitlab-ci/deqp-runner.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting section_start test_setup "deqp: preparing test setup" @@ -32,8 +33,6 @@ findmnt -n tmpfs ${SHADER_CACHE_HOME} || findmnt -n tmpfs ${SHADER_CACHE_DIR} || mount -t tmpfs -o nosuid,nodev,size=2G,mode=1755 tmpfs ${SHADER_CACHE_DIR} } -HANG_DETECTION_CMD="" - if [ -z "$DEQP_SUITE" ]; then if [ -z "$DEQP_VER" ]; then echo 'DEQP_SUITE must be set to the name of your deqp-gpu_version.toml, or DEQP_VER must be set to something like "gles2", "gles31-khr" or "vk" for the test run' @@ -50,7 +49,7 @@ if [ -z "$DEQP_SUITE" ]; then DEQP_OPTIONS="$DEQP_OPTIONS --deqp-gl-config-name=$DEQP_CONFIG" DEQP_OPTIONS="$DEQP_OPTIONS --deqp-visibility=hidden" - if [ "$DEQP_VER" = "vk" -a -z "$VK_DRIVER" ]; then + if [ "$DEQP_VER" = "vk" ] && [ -z "$VK_DRIVER" ]; then echo 'VK_DRIVER must be to something like "radeon" or "intel" for the test run' exit 1 fi @@ -59,11 +58,10 @@ if [ -z "$DEQP_SUITE" ]; then if [ "$DEQP_VER" = "vk" ]; then MUSTPASS=/deqp/mustpass/vk-$DEQP_VARIANT.txt DEQP=/deqp/external/vulkancts/modules/vulkan/deqp-vk - HANG_DETECTION_CMD="/parallel-deqp-runner/build/bin/hang-detection" - elif [ "$DEQP_VER" = "gles2" -o "$DEQP_VER" = "gles3" -o "$DEQP_VER" = "gles31" -o "$DEQP_VER" = "egl" ]; then + elif [ "$DEQP_VER" = "gles2" ] || [ "$DEQP_VER" = "gles3" ] || [ "$DEQP_VER" = "gles31" ] || [ "$DEQP_VER" = "egl" ]; then MUSTPASS=/deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt DEQP=/deqp/modules/$DEQP_VER/deqp-$DEQP_VER - elif [ "$DEQP_VER" = "gles2-khr" -o "$DEQP_VER" = "gles3-khr" -o "$DEQP_VER" = "gles31-khr" -o "$DEQP_VER" = "gles32-khr" ]; then + elif [ "$DEQP_VER" = "gles2-khr" ] || [ "$DEQP_VER" = "gles3-khr" ] || [ "$DEQP_VER" = "gles31-khr" ] || [ "$DEQP_VER" = "gles32-khr" ]; then MUSTPASS=/deqp/mustpass/$DEQP_VER-$DEQP_VARIANT.txt DEQP=/deqp/external/openglcts/modules/glcts else @@ -129,7 +127,7 @@ export VK_LAYER_SETTINGS_PATH=$INSTALL/$GPU_VERSION-validation-settings.txt report_load() { echo "System load: $(cut -d' ' -f1-3 < /proc/loadavg)" - echo "# of CPU cores: $(cat /proc/cpuinfo | grep processor | wc -l)" + echo "# of CPU cores: $(grep -c processor /proc/cpuinfo)" } if [ "$GALLIUM_DRIVER" = "virpipe" ]; then @@ -149,10 +147,11 @@ fi if [ -z "$DEQP_SUITE" ]; then if [ -n "$DEQP_EXPECTED_RENDERER" ]; then - export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --renderer-check "$DEQP_EXPECTED_RENDERER"" + export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --renderer-check $DEQP_EXPECTED_RENDERER" fi - if [ $DEQP_VER != vk -a $DEQP_VER != egl ]; then - export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --version-check `cat $INSTALL/VERSION | sed 's/[() ]/./g'`" + if [ $DEQP_VER != vk ] && [ $DEQP_VER != egl ]; then + VER=$(sed 's/[() ]/./g' "$INSTALL/VERSION") + export DEQP_RUNNER_OPTIONS="$DEQP_RUNNER_OPTIONS --version-check $VER" fi fi @@ -181,7 +180,7 @@ else --flakes $INSTALL/$GPU_VERSION-flakes.txt \ --testlog-to-xml /deqp/executor/testlog-to-xml \ --fraction-start $CI_NODE_INDEX \ - --fraction `expr $CI_NODE_TOTAL \* ${DEQP_FRACTION:-1}` \ + --fraction $((CI_NODE_TOTAL * ${DEQP_FRACTION:-1})) \ --jobs ${FDO_CI_CONCURRENT:-4} \ $DEQP_RUNNER_OPTIONS fi diff --git a/.gitlab-ci/download-git-cache.sh b/.gitlab-ci/download-git-cache.sh index e66f989278c..5fcb36ebf1c 100644 --- a/.gitlab-ci/download-git-cache.sh +++ b/.gitlab-ci/download-git-cache.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set +e set -o xtrace @@ -16,12 +16,9 @@ fi TMP_DIR=$(mktemp -d) echo "Downloading archived master..." -/usr/bin/wget \ +if ! /usr/bin/wget \ -O "$TMP_DIR/$CI_PROJECT_NAME.tar.gz" \ - "https://${MINIO_HOST}/git-cache/${FDO_UPSTREAM_REPO}/$CI_PROJECT_NAME.tar.gz" - -# check wget error code -if [[ $? -ne 0 ]] + "https://${MINIO_HOST}/git-cache/${FDO_UPSTREAM_REPO}/$CI_PROJECT_NAME.tar.gz"; then echo "Repository cache not available" exit diff --git a/.gitlab-ci/fossilize-runner.sh b/.gitlab-ci/fossilize-runner.sh index e19544f065f..f236892d109 100755 --- a/.gitlab-ci/fossilize-runner.sh +++ b/.gitlab-ci/fossilize-runner.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -ex @@ -7,15 +7,15 @@ if [ -z "$VK_DRIVER" ]; then exit 1 fi -INSTALL=`pwd`/install +INSTALL=$PWD/install # Set up the driver environment. -export LD_LIBRARY_PATH=`pwd`/install/lib/ -export VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.x86_64.json -export LD_PRELOAD=`pwd`/install/lib/libamdgpu_noop_drm_shim.so +export LD_LIBRARY_PATH="$INSTALL/lib/" +export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json" +export LD_PRELOAD="$INSTALL/lib/libamdgpu_noop_drm_shim.so" # To store Fossilize logs on failure. -RESULTS=`pwd`/results +RESULTS="$PWD/results" mkdir -p results "$INSTALL/fossils/fossils.sh" "$INSTALL/fossils.yml" "$RESULTS" diff --git a/.gitlab-ci/fossils/fossils.sh b/.gitlab-ci/fossils/fossils.sh index 0dffa4776f7..e50312d6488 100755 --- a/.gitlab-ci/fossils/fossils.sh +++ b/.gitlab-ci/fossils/fossils.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting +# shellcheck disable=SC2155 FOSSILS_SCRIPT_DIR="$(dirname "$(readlink -f "$0")")" FOSSILS_YAML="$(readlink -f "$1")" @@ -10,7 +12,7 @@ clone_fossils_db() local commit="$2" rm -rf fossils-db git clone --no-checkout "$repo" fossils-db - (cd fossils-db; git reset "$commit" || git reset "origin/$commit") + (cd fossils-db || return; git reset "$commit" || git reset "origin/$commit") } query_fossils_yaml() @@ -51,7 +53,7 @@ fetch_fossil() if [[ -n "$(query_fossils_yaml fossils_db_repo)" ]]; then clone_fossils_db "$(query_fossils_yaml fossils_db_repo)" \ "$(query_fossils_yaml fossils_db_commit)" - cd fossils-db + cd fossils-db || return else echo "Warning: No fossils-db entry in $FOSSILS_YAML, assuming fossils-db is current directory" fi @@ -65,8 +67,8 @@ create_clean_git for fossil in $(query_fossils_yaml fossils) do fetch_fossil "$fossil" || exit $? - fossilize-replay --num-threads 4 $fossil 1>&2 2> $FOSSILS_RESULTS/fossil_replay.txt - if [ $? != 0 ]; then + if ! fossilize-replay --num-threads 4 $fossil 1>&2 2> $FOSSILS_RESULTS/fossil_replay.txt; + then echo "Replay of $fossil failed" grep "pipeline crashed or hung" $FOSSILS_RESULTS/fossil_replay.txt exit 1 diff --git a/.gitlab-ci/gtest-runner.sh b/.gitlab-ci/gtest-runner.sh index 1e66101f245..8dfa374c288 100755 --- a/.gitlab-ci/gtest-runner.sh +++ b/.gitlab-ci/gtest-runner.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting set -ex diff --git a/.gitlab-ci/lava/lava-pytest.sh b/.gitlab-ci/lava/lava-pytest.sh index 4f5ca501589..786a669b917 100755 --- a/.gitlab-ci/lava/lava-pytest.sh +++ b/.gitlab-ci/lava/lava-pytest.sh @@ -1,35 +1,17 @@ #!/usr/bin/env bash -# -# Copyright (C) 2022 Collabora Limited +# SPDX-License-Identifier: MIT +# © Collabora Limited # Author: Guilherme Gallo -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. # This script runs unit/integration tests related with LAVA CI tools +# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime. set -ex # Use this script in a python virtualenv for isolation python3 -m venv .venv . .venv/bin/activate -python3 -m pip install --break-system-packages -r ${CI_PROJECT_DIR}/.gitlab-ci/lava/requirements-test.txt +python3 -m pip install --break-system-packages -r "${CI_PROJECT_DIR}/.gitlab-ci/lava/requirements-test.txt" TEST_DIR=${CI_PROJECT_DIR}/.gitlab-ci/tests diff --git a/.gitlab-ci/lava/lava-submit.sh b/.gitlab-ci/lava/lava-submit.sh index f2b4fc5a0d7..bf1ba7fe54c 100755 --- a/.gitlab-ci/lava/lava-submit.sh +++ b/.gitlab-ci/lava/lava-submit.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting -set -e -set -x +set -ex # If we run in the fork (not from mesa or Marge-bot), reuse mainline kernel and rootfs, if exist. BASE_SYSTEM_HOST_PATH="${BASE_SYSTEM_MAINLINE_HOST_PATH}" diff --git a/.gitlab-ci/meson/build.sh b/.gitlab-ci/meson/build.sh index f6e57e77841..978fcd12f2b 100755 --- a/.gitlab-ci/meson/build.sh +++ b/.gitlab-ci/meson/build.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# shellcheck disable=SC1003 # works for us now... +# shellcheck disable=SC2086 # we want word splitting section_switch meson-configure "meson: configure" @@ -19,9 +21,9 @@ printf > native.file "%s\n" \ # tweak the cross file or generate a native file to do so. if test -n "$LLVM_VERSION"; then LLVM_CONFIG="llvm-config-${LLVM_VERSION}" - echo "llvm-config = '`which $LLVM_CONFIG`'" >> native.file + echo "llvm-config = '$(which "$LLVM_CONFIG")'" >> native.file if [ -n "$CROSS" ]; then - sed -i -e '/\[binaries\]/a\' -e "llvm-config = '`which $LLVM_CONFIG`'" $CROSS_FILE + sed -i -e '/\[binaries\]/a\' -e "llvm-config = '$(which "$LLVM_CONFIG")'" $CROSS_FILE fi $LLVM_CONFIG --version fi @@ -71,7 +73,7 @@ meson setup _build \ --wrap-mode=nofallback \ --force-fallback-for perfetto \ ${CROSS+--cross "$CROSS_FILE"} \ - -D prefix=`pwd`/install \ + -D prefix=$PWD/install \ -D libdir=lib \ -D buildtype=${BUILDTYPE:-debug} \ -D build-tests=true \ @@ -101,7 +103,7 @@ fi uncollapsed_section_switch meson-test "meson: test" -LC_ALL=C.UTF-8 meson test --num-processes ${FDO_CI_CONCURRENT:-4} --print-errorlogs ${MESON_TEST_ARGS} +LC_ALL=C.UTF-8 meson test --num-processes "${FDO_CI_CONCURRENT:-4}" --print-errorlogs ${MESON_TEST_ARGS} if command -V mold &> /dev/null ; then mold --run ninja install else diff --git a/.gitlab-ci/meson/time-strace.sh b/.gitlab-ci/meson/time-strace.sh index dab628a89e7..53bfd6ac367 100755 --- a/.gitlab-ci/meson/time-strace.sh +++ b/.gitlab-ci/meson/time-strace.sh @@ -1,7 +1,8 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting -if [ "x$STRACEDIR" = "x" ]; then - STRACEDIR=meson-logs/strace/$(for i in $@; do basename -z -- $i; echo -n _; done).$$ +if [[ -z "$STRACEDIR" ]]; then + STRACEDIR=meson-logs/strace/$(for i in "$@"; do basename -z -- $i; echo -n _; done).$$ fi mkdir -p $STRACEDIR diff --git a/.gitlab-ci/piglit/piglit-runner.sh b/.gitlab-ci/piglit/piglit-runner.sh index 0a98e72856e..188df6f8dc9 100755 --- a/.gitlab-ci/piglit/piglit-runner.sh +++ b/.gitlab-ci/piglit/piglit-runner.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2086 # we want word splitting set -ex @@ -7,14 +8,14 @@ if [ -z "$GPU_VERSION" ]; then exit 1 fi -INSTALL=`pwd`/install +INSTALL="$PWD/install" # Set up the driver environment. -export LD_LIBRARY_PATH=`pwd`/install/lib/ +export LD_LIBRARY_PATH="$INSTALL/lib/" export EGL_PLATFORM=surfaceless -export VK_ICD_FILENAMES=`pwd`/install/share/vulkan/icd.d/"$VK_DRIVER"_icd.${VK_CPU:-`uname -m`}.json +export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.${VK_CPU:-$(uname -m)}.json" -RESULTS=`pwd`/${PIGLIT_RESULTS_DIR:-results} +RESULTS=$PWD/${PIGLIT_RESULTS_DIR:-results} mkdir -p $RESULTS # Ensure Mesa Shader Cache resides on tmpfs. @@ -42,8 +43,8 @@ if [ "$GALLIUM_DRIVER" = "virpipe" ]; then sleep 1 fi -if [ -n "$PIGLIT_FRACTION" -o -n "$CI_NODE_INDEX" ]; then - FRACTION=`expr ${PIGLIT_FRACTION:-1} \* ${CI_NODE_TOTAL:-1}` +if [ -n "$PIGLIT_FRACTION" ] || [ -n "$CI_NODE_INDEX" ]; then + FRACTION=$((${PIGLIT_FRACTION:-1} * ${CI_NODE_TOTAL:-1})) PIGLIT_RUNNER_OPTIONS="$PIGLIT_RUNNER_OPTIONS --fraction $FRACTION" fi diff --git a/.gitlab-ci/piglit/piglit-traces.sh b/.gitlab-ci/piglit/piglit-traces.sh index 5e0675db4f5..941afb1679e 100755 --- a/.gitlab-ci/piglit/piglit-traces.sh +++ b/.gitlab-ci/piglit/piglit-traces.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# shellcheck disable=SC2035 # FIXME glob +# shellcheck disable=SC2086 # we want word splitting set -ex @@ -26,7 +28,7 @@ esac #PATH="/opt/wine-stable/bin/:$PATH" # WineHQ path # Avoid asking about Gecko or Mono instalation -export WINEDLLOVERRIDES=mscoree=d;mshtml=d +export WINEDLLOVERRIDES="mscoree=d;mshtml=d" # FIXME: drop, not needed anymore? (wine dir is already created) # Set environment for DXVK. export DXVK_LOG_LEVEL="info" @@ -40,20 +42,12 @@ export DXVK_STATE_CACHE=0 # using a command wrapper. Hence, we will just set it when running the # command. export __LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$INSTALL/lib/" -export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.${VK_CPU:-`uname -m`}.json" +export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.${VK_CPU:-$(uname -m)}.json" # Sanity check to ensure that our environment is sufficient to make our tests # run against the Mesa built by CI, rather than any installed distro version. MESA_VERSION=$(head -1 "$INSTALL/VERSION" | sed 's/\./\\./g') -print_red() { - RED='\033[0;31m' - NC='\033[0m' # No Color - printf "${RED}" - "$@" - printf "${NC}" -} - # wrapper to supress +x to avoid spamming the log quiet() { set +x @@ -79,14 +73,14 @@ HANG_DETECTION_CMD="" # Set up the platform windowing system. -if [ "x$EGL_PLATFORM" = "xsurfaceless" ]; then +if [ "$EGL_PLATFORM" = "surfaceless" ]; then # Use the surfaceless EGL platform. export DISPLAY= export WAFFLE_PLATFORM="surfaceless_egl" SANITY_MESA_VERSION_CMD="$SANITY_MESA_VERSION_CMD --platform surfaceless_egl --api gles2" - if [ "x$GALLIUM_DRIVER" = "xvirpipe" ]; then + if [ "$GALLIUM_DRIVER" = "virpipe" ]; then # piglit is to use virpipe, and virgl_test_server llvmpipe export GALLIUM_DRIVER="$GALLIUM_DRIVER" @@ -98,9 +92,9 @@ if [ "x$EGL_PLATFORM" = "xsurfaceless" ]; then sleep 1 fi -elif [ "x$PIGLIT_PLATFORM" = "xgbm" ]; then +elif [ "$PIGLIT_PLATFORM" = "gbm" ]; then SANITY_MESA_VERSION_CMD="$SANITY_MESA_VERSION_CMD --platform gbm --api gl" -elif [ "x$PIGLIT_PLATFORM" = "xmixed_glx_egl" ]; then +elif [ "$PIGLIT_PLATFORM" = "mixed_glx_egl" ]; then # It is assumed that you have already brought up your X server before # calling this script. SANITY_MESA_VERSION_CMD="$SANITY_MESA_VERSION_CMD --platform glx --api gl" @@ -115,6 +109,7 @@ if [ -n "$CI_NODE_INDEX" ]; then USE_CASELIST=1 fi +# shellcheck disable=SC2317 replay_minio_upload_images() { find "$RESULTS/$__PREFIX" -type f -name "*.png" -printf "%P\n" \ | while read -r line; do @@ -167,7 +162,7 @@ PIGLIT_CMD="./piglit run -l verbose --timeout 300 -j${FDO_CI_CONCURRENT:-4} $PIG RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD && $HANG_DETECTION_CMD $PIGLIT_CMD" if [ "$RUN_CMD_WRAPPER" ]; then - RUN_CMD="set +e; $RUN_CMD_WRAPPER "$(/usr/bin/printf "%q" "$RUN_CMD")"; set -e" + RUN_CMD="set +e; $RUN_CMD_WRAPPER \"$(/usr/bin/printf "%q" "$RUN_CMD")\"; set -e" fi # The replayer doesn't do any size or checksum verification for the traces in @@ -177,9 +172,8 @@ fi # run. rm -rf replayer-db -eval $RUN_CMD - -if [ $? -ne 0 ]; then +if ! eval $RUN_CMD; +then printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION" fi @@ -217,7 +211,7 @@ find "$RESULTS"/summary -type f -name "*.html" -print0 \ find "$RESULTS"/summary -type f -name "*.html" -print0 \ | xargs -0 sed -i 's% $RESULTS/vkd3d-proton.log - -if [ $? != 0 ]; then - quiet print_red printf "%s\n" "Failed, see vkd3d-proton.log!" +if ! /vkd3d-proton-tests/x64/bin/d3d12 > "$RESULTS/vkd3d-proton.log"; +then + error printf "%s\n" "Failed, see vkd3d-proton.log!" # Collect all the failures VKD3D_PROTON_RESULTS="${VKD3D_PROTON_RESULTS:-vkd3d-proton-results}" @@ -82,7 +73,7 @@ if [ $? != 0 ]; then # Make sure that the failures found in this run match the current expectation if ! diff -q ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE"; then - quiet print_red printf "%s\n" "Changes found, see vkd3d-proton.log!" + error printf "%s\n" "Changes found, see vkd3d-proton.log!" quiet diff --color=always -u ".gitlab-ci/vkd3d-proton/$VKD3D_PROTON_RESULTS.txt.baseline" "$RESULTSFILE" fi