2020-02-12 12:20:53 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2020-08-21 19:06:43 -07:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
source $(cd $(dirname $0) && pwd)/helpers.sh
|
2020-02-12 12:20:53 -08:00
|
|
|
|
2021-11-11 15:17:43 -08:00
|
|
|
ARCH=$(uname -m)
|
|
|
|
|
|
2021-11-30 00:01:24 +00:00
|
|
|
STATUS_FILE=/exitstatus
|
|
|
|
|
|
2021-03-26 14:39:33 +01:00
|
|
|
read_lists() {
|
|
|
|
|
(for path in "$@"; do
|
|
|
|
|
if [[ -s "$path" ]]; then
|
|
|
|
|
cat "$path"
|
|
|
|
|
fi;
|
|
|
|
|
done) | cut -d'#' -f1 | tr -s ' \t\n' ','
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-26 15:18:09 -08:00
|
|
|
test_progs() {
|
2020-08-06 21:30:15 -07:00
|
|
|
if [[ "${KERNEL}" != '4.9.0' ]]; then
|
2022-07-11 14:43:25 -07:00
|
|
|
foldable start test_progs "Testing test_progs"
|
2021-11-30 00:01:24 +00:00
|
|
|
# "&& true" does not change the return code (it is not executed
|
|
|
|
|
# if the Python script fails), but it prevents exiting on a
|
|
|
|
|
# failure due to the "set -e".
|
2022-08-09 10:23:11 -07:00
|
|
|
./test_progs ${DENYLIST:+-d$DENYLIST} ${ALLOWLIST:+-a$ALLOWLIST} && true
|
2021-11-30 00:01:24 +00:00
|
|
|
echo "test_progs:$?" >> "${STATUS_FILE}"
|
2022-07-11 14:43:25 -07:00
|
|
|
foldable end test_progs
|
2020-08-06 21:30:15 -07:00
|
|
|
fi
|
2022-08-15 14:42:57 -07:00
|
|
|
}
|
2020-07-07 00:46:30 -07:00
|
|
|
|
2022-08-23 16:18:19 -07:00
|
|
|
test_progs_no_alu32() {
|
2022-07-11 14:43:25 -07:00
|
|
|
foldable start test_progs-no_alu32 "Testing test_progs-no_alu32"
|
2022-08-09 10:23:11 -07:00
|
|
|
./test_progs-no_alu32 ${DENYLIST:+-d$DENYLIST} ${ALLOWLIST:+-a$ALLOWLIST} && true
|
2021-11-30 00:01:24 +00:00
|
|
|
echo "test_progs-no_alu32:$?" >> "${STATUS_FILE}"
|
2022-07-11 14:43:25 -07:00
|
|
|
foldable end test_progs-no_alu32
|
2020-02-26 15:18:09 -08:00
|
|
|
}
|
2020-02-21 21:16:40 -08:00
|
|
|
|
2020-02-26 15:18:09 -08:00
|
|
|
test_maps() {
|
2022-08-15 15:24:41 -07:00
|
|
|
if [[ "${KERNEL}" == 'latest' ]]; then
|
|
|
|
|
foldable start test_maps "Testing test_maps"
|
|
|
|
|
./test_maps && true
|
|
|
|
|
echo "test_maps:$?" >> "${STATUS_FILE}"
|
|
|
|
|
foldable end test_maps
|
|
|
|
|
fi
|
2020-02-26 15:18:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
test_verifier() {
|
2022-08-15 15:24:41 -07:00
|
|
|
if [[ "${KERNEL}" == 'latest' ]]; then
|
|
|
|
|
foldable start test_verifier "Testing test_verifier"
|
|
|
|
|
./test_verifier && true
|
|
|
|
|
echo "test_verifier:$?" >> "${STATUS_FILE}"
|
|
|
|
|
foldable end test_verifier
|
|
|
|
|
fi
|
2020-02-26 15:18:09 -08:00
|
|
|
}
|
2020-02-26 00:09:02 -08:00
|
|
|
|
2022-07-11 14:43:25 -07:00
|
|
|
foldable end vm_init
|
2020-08-21 19:06:43 -07:00
|
|
|
|
2022-08-09 10:23:34 -07:00
|
|
|
configs_path=/${PROJECT_NAME}/selftests/bpf
|
|
|
|
|
local_configs_path=${PROJECT_NAME}/vmtest/configs
|
|
|
|
|
DENYLIST=$(read_lists \
|
|
|
|
|
"$configs_path/DENYLIST" \
|
|
|
|
|
"$configs_path/DENYLIST.${ARCH}" \
|
|
|
|
|
"$local_configs_path/DENYLIST-${KERNEL}" \
|
|
|
|
|
"$local_configs_path/DENYLIST-${KERNEL}.${ARCH}" \
|
|
|
|
|
)
|
|
|
|
|
ALLOWLIST=$(read_lists \
|
|
|
|
|
"$configs_path/ALLOWLIST" \
|
|
|
|
|
"$configs_path/ALLOWLIST.${ARCH}" \
|
|
|
|
|
"$local_configs_path/ALLOWLIST-${KERNEL}" \
|
|
|
|
|
"$local_configs_path/ALLOWLIST-${KERNEL}.${ARCH}" \
|
|
|
|
|
)
|
2020-02-12 12:20:53 -08:00
|
|
|
|
2022-08-09 10:36:36 -07:00
|
|
|
echo "DENYLIST: ${DENYLIST}"
|
|
|
|
|
echo "ALLOWLIST: ${ALLOWLIST}"
|
|
|
|
|
|
2021-11-11 15:17:43 -08:00
|
|
|
cd ${PROJECT_NAME}/selftests/bpf
|
2020-02-12 12:20:53 -08:00
|
|
|
|
2022-08-15 15:34:09 -07:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
|
test_progs
|
2022-08-23 16:18:19 -07:00
|
|
|
test_progs_no_alu32
|
2022-12-06 13:41:16 -08:00
|
|
|
# test_maps
|
2022-08-15 15:34:09 -07:00
|
|
|
test_verifier
|
|
|
|
|
else
|
|
|
|
|
for test_name in "$@"; do
|
|
|
|
|
"${test_name}"
|
|
|
|
|
done
|
|
|
|
|
fi
|