#!/bin/bash
+# shellcheck disable=SC2086 # we want word splitting
if [ -z "$BM_POE_INTERFACE" ]; then
echo "Must supply the PoE Interface to power down"
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
#!/bin/bash
+# shellcheck disable=SC2086 # we want word splitting
if [ -z "$BM_POE_INTERFACE" ]; then
echo "Must supply the PoE Interface to power up"
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
#!/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.
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"
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"
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
#!/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."
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
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"
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"
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"
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"
#!/bin/bash
+# shellcheck disable=SC1091
+# shellcheck disable=SC2034
+# shellcheck disable=SC2059
+# shellcheck disable=SC2086 # we want word splitting
. "$SCRIPTS_DIR"/setup-test-env.sh
-#!/bin/bash
+#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
rootfs_dst=$1
#!/bin/sh
+# shellcheck disable=SC1091
set -e
#!/bin/sh
+# shellcheck disable=SC1091
set -e
#!/bin/sh
+# shellcheck disable=SC1091
set -e
#!/bin/sh
+# shellcheck disable=SC1091
set -e
#!/bin/sh
+# shellcheck disable=SC1091
set -e
#!/bin/sh
+# shellcheck disable=SC1091
set -e
+# shellcheck disable=SC1091
+# shellcheck disable=SC2086 # we want word splitting
if command -V ccache >/dev/null 2>/dev/null; then
CCACHE=ccache
else
-#!/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
# 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
#!/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.
#
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
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.
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
-#!/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
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))
;;
[ -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
}
#
[ -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
}
#
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"
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
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}
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
#!/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
-#!/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
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
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
#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
+
section_start cuttlefish_setup "cuttlefish: setup"
set -xe
$ADB root
sleep 1
$ADB shell echo Hi from Android
+# shellcheck disable=SC2035
$ADB logcat dEQP:D *:S &
# overlay vendor
--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"
#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
section_start test_setup "deqp: preparing test setup"
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'
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
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
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
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
--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
-#!/bin/bash
+#!/usr/bin/env bash
set +e
set -o xtrace
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
-#!/bin/sh
+#!/usr/bin/env bash
set -ex
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"
#!/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")"
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()
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
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
#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
set -ex
#!/usr/bin/env bash
-#
-# Copyright (C) 2022 Collabora Limited
+# SPDX-License-Identifier: MIT
+# © Collabora Limited
# Author: Guilherme Gallo <guilherme.gallo@collabora.com>
-#
-# 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
#!/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}"
#!/usr/bin/env bash
+# shellcheck disable=SC1003 # works for us now...
+# shellcheck disable=SC2086 # we want word splitting
section_switch meson-configure "meson: configure"
# 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
--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 \
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
-#!/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
-#!/bin/sh
+#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
set -ex
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.
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
#!/usr/bin/env bash
+# shellcheck disable=SC2035 # FIXME glob
+# shellcheck disable=SC2086 # we want word splitting
set -ex
#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"
# 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
# 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"
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"
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
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
# 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
find "$RESULTS"/summary -type f -name "*.html" -print0 \
| xargs -0 sed -i 's%<img src="file://%<img src="https://'"${PIGLIT_REPLAY_REFERENCE_IMAGES_BASE}"'/%g'
-quiet print_red echo "Failures in traces:"
+echo "Failures in traces:"
cat $RESULTSFILE
-quiet print_red echo "Review the image changes and get the new checksums at: ${ARTIFACTS_BASE_URL}/results/summary/problems.html"
+error echo "Review the image changes and get the new checksums at: ${ARTIFACTS_BASE_URL}/results/summary/problems.html"
exit 1
#!/usr/bin/env bash
+# shellcheck disable=SC2038 # TODO: rewrite the find
+# shellcheck disable=SC2086 # we want word splitting
section_switch prepare-artifacts "artifacts: prepare"
#!/usr/bin/env bash
-CHECKPATH=".gitlab-ci/container" # TODO: expand to cover whole .gitlab-ci/
+CHECKPATH=".gitlab-ci"
is_bash() {
[[ $1 == *.sh ]] && return 0
#!/usr/bin/env bash
+# shellcheck disable=SC2048
+# shellcheck disable=SC2086 # we want word splitting
+# shellcheck disable=SC2155 # mktemp usually not failing
function x_off {
if [[ "$-" == *"x"* ]]; then
-#!/bin/sh
+#!/usr/bin/env bash
+# shellcheck disable=SC2086 # we want word splitting
set -ex
-if [ "x$VK_DRIVER" = "x" ]; then
+if [[ -z "$VK_DRIVER" ]]; then
exit 1
fi
# 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=$(cat "$INSTALL/VERSION" | sed 's/\./\\./g')
+MESA_VERSION=$(sed 's/\./\\./g' "$INSTALL/VERSION")
# Force the stdout and stderr streams to be unbuffered in python.
export PYTHONUNBUFFERED=1
# Set the Vulkan driver to use.
export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json"
-if [ ${VK_DRIVER} = "radeon" ]; then
+if [ "${VK_DRIVER}" = "radeon" ]; then
# Disable vsync
export MESA_VK_WSI_PRESENT_MODE=mailbox
export vblank_mode=0
# Set up the Window System Interface (WSI)
# TODO: Can we get away with GBM?
-if [ ${TEST_START_XORG:-0} -eq 1 ]; then
+if [ "${TEST_START_XORG:-0}" -eq 1 ]; then
"$INSTALL"/common/start-x.sh "$INSTALL"
export DISPLAY=:0
fi
RUN_CMD="export LD_LIBRARY_PATH=$__LD_LIBRARY_PATH; $SANITY_MESA_VERSION_CMD"
set +e
-eval $RUN_CMD
-
-if [ $? -ne 0 ]; then
+if ! eval $RUN_CMD;
+then
printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION"
fi
set -e
-#!/bin/sh
+#!/usr/bin/env bash
+# shellcheck disable=SC2035 # FIXME glob
set -ex
-if [ "x$VK_DRIVER" = "x" ]; then
+if [[ -z "$VK_DRIVER" ]]; then
exit 1
fi
# 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=$(cat "$INSTALL/VERSION" | sed 's/\./\\./g')
+MESA_VERSION=$(sed 's/\./\\./g' "$INSTALL/VERSION")
# Set the Vulkan driver to use.
export VK_ICD_FILENAMES="$INSTALL/share/vulkan/icd.d/${VK_DRIVER}_icd.x86_64.json"
export WINEPREFIX="/vkd3d-proton-wine64"
export WINEESYNC=1
-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
}
set +e
-vulkaninfo | tee /tmp/version.txt | grep \"Mesa $MESA_VERSION\(\s\|$\)\"
-
-if [ $? -ne 0 ]; then
+if ! vulkaninfo | tee /tmp/version.txt | grep "\"Mesa $MESA_VERSION\(\s\|$\)\"";
+then
printf "%s\n" "Found $(cat /tmp/version.txt), expected $MESA_VERSION"
fi
set -e
quiet printf "%s\n" "Running vkd3d-proton testsuite..."
set +e
-/vkd3d-proton-tests/x64/bin/d3d12 > $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}"
# 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