Skip to content

Commit fd7d12f

Browse files
committed
veristat-kernel: dump verifier log on failure
If veristat reports a verification failure of a program that's expected to pass the verification according to the baseline, run veristat on it again with -v to extract the verification log. Signed-off-by: Ihor Solodrai <isolodrai@meta.com>
1 parent 1f3056d commit fd7d12f

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

.github/scripts/compare-veristat-results.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,36 @@ if [[ ! -f "${BASELINE_PATH}" ]]; then
77
echo "Printing veristat results"
88
cat "${VERISTAT_OUTPUT}"
99

10-
exit
10+
exit 0
1111
fi
1212

13-
selftests/bpf/veristat \
13+
veristat=$(realpath selftests/bpf/veristat)
14+
cmp_out=$(mktemp veristate_compare_out_XXXXXX.csv)
15+
16+
$veristat \
1417
--output-format csv \
1518
--emit file,prog,verdict,states \
16-
--compare "${BASELINE_PATH}" "${VERISTAT_OUTPUT}" > compare.csv
19+
--compare "${BASELINE_PATH}" "${VERISTAT_OUTPUT}" > $cmp_out
20+
21+
python3 ./.github/scripts/veristat_compare.py $cmp_out
22+
exit_code=$?
23+
24+
echo
25+
# if comparison failed, print verifier log for failure mismatches
26+
if [[ -n "$VERISTAT_DUMP_LOG_ON_FAILURE" && $exit_code -ne 0 ]]; then
27+
cat $cmp_out | tail -n +1 | \
28+
while read -r line; do
29+
verdict=$(echo $line | cut -d',' -f4)
30+
verdict_diff=$(echo $line | cut -d',' -f5)
31+
if [[ "$verdict" == "failure" && "$verdict_diff" == "MISMATCH" ]]; then
32+
file=$(echo $line | cut -d',' -f1)
33+
prog=$(echo $line | cut -d',' -f2)
34+
echo "VERIFIER LOG FOR $file/$prog:"
35+
echo "=================================================================="
36+
$veristat -v $VERISTAT_OBJECTS_DIR/$file -f $prog 2>&1
37+
echo "=================================================================="
38+
fi
39+
done
40+
fi
1741

18-
python3 ./.github/scripts/veristat_compare.py compare.csv
42+
exit $exit_code

.github/workflows/veristat-kernel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
REPO_PATH: ""
3131
KBUILD_OUTPUT: kbuild-output/
3232
ARCH_AND_TOOL: ${{ inputs.arch }}-${{ inputs.toolchain_full }}
33+
VERISTAT_DUMP_LOG_ON_FAILURE: 'true'
3334

3435
steps:
3536

@@ -62,4 +63,3 @@ jobs:
6263
with:
6364
veristat_output: veristat-kernel
6465
baseline_name: ${{ env.ARCH_AND_TOOL}}-baseline-veristat-kernel
65-

0 commit comments

Comments
 (0)