Skip to content

Commit da314e0

Browse files
committed
adding/updating ci files
1 parent 0bd818d commit da314e0

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

ci/vmtest/configs/DENYLIST

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ kprobe_multi_test/bench_attach
44
core_reloc/enum64val
55
core_reloc/size___diff_sz
66
core_reloc/type_based___diff_sz
7-
verify_pkcs7_sig

ci/vmtest/run_selftests.sh

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
#!/bin/bash
22

3+
# run_selftest.sh will run the tests within /${PROJECT_NAME}/selftests/bpf
4+
# If no specific test names are given, all test will be ran, otherwise, it will
5+
# run the test passed as parameters.
6+
# There is 2 ways to pass test names.
7+
# 1) command-line arguments to this script
8+
# 2) a comma-separated list of test names passed as `run_tests` boot parameters.
9+
# test names passed as any of those methods will be ran.
10+
311
set -euo pipefail
412

513
source $(cd $(dirname $0) && pwd)/helpers.sh
@@ -8,6 +16,8 @@ ARCH=$(uname -m)
816

917
STATUS_FILE=/exitstatus
1018

19+
declare -a TEST_NAMES=()
20+
1121
read_lists() {
1222
(for path in "$@"; do
1323
if [[ -s "$path" ]]; then
@@ -22,6 +32,28 @@ TEST_PROGS_ARGS=""
2232
# TEST_PROGS_ARGS="-j"
2333
# fi
2434

35+
read_test_names() {
36+
foldable start read_test_names "Reading test names from boot parameters and command line arguments"
37+
# Check if test names were passed as boot parameter.
38+
# We expect `run_tests` to be a comma-separated list of test names.
39+
IFS=',' read -r -a test_names_from_boot <<< \
40+
"$(sed -n 's/.*run_tests=\([^ ]*\).*/\1/p' /proc/cmdline)"
41+
42+
echo "${#test_names_from_boot[@]} tests extracted from boot parameters: ${test_names_from_boot[*]}"
43+
# Sort and only keep unique test names from both boot params and arguments
44+
# TEST_NAMES will contain a sorted list of uniq tests to be ran.
45+
# Only do this if any of $test_names_from_boot[@] or $@ has elements as
46+
# "printf '%s\0'" will otherwise generate an empty element.
47+
if [[ ${#test_names_from_boot[@]} -gt 0 || $# -gt 0 ]]
48+
then
49+
readarray -t TEST_NAMES < \
50+
<(printf '%s\0' "${test_names_from_boot[@]}" "$@" | \
51+
sort --zero-terminated --unique | \
52+
xargs --null --max-args=1)
53+
fi
54+
foldable end read_test_names
55+
}
56+
2557
test_progs() {
2658
foldable start test_progs "Testing test_progs"
2759
# "&& true" does not change the return code (it is not executed
@@ -81,13 +113,18 @@ echo "ALLOWLIST: ${ALLOWLIST}"
81113
82114
cd ${PROJECT_NAME}/selftests/bpf
83115
84-
if [ $# -eq 0 ]; then
116+
# populate TEST_NAMES
117+
read_test_names "$@"
118+
# if we don't have any test name provided to the script, we run all tests.
119+
if [ ${#TEST_NAMES[@]} -eq 0 ]; then
85120
test_progs
86121
test_progs_no_alu32
87122
test_maps
88123
test_verifier
89124
else
90-
for test_name in "$@"; do
125+
# else we run the tests passed as command-line arguments and through boot
126+
# parameter.
127+
for test_name in "${TEST_NAMES[@]}"; do
91128
"${test_name}"
92129
done
93130
fi

0 commit comments

Comments
 (0)