Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/bpf: Flag to continue in case of errors #16793

Merged
merged 2 commits into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/bpf/check-complexity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ if ! grep -q "CILIUM_CALL_SIZE.*25" "$BPFDIR/lib/common.h" ; then
exit 1
fi

"$TESTDIR/verifier-test.sh" -v | get_insn_cnt | annotate_section_names
"$TESTDIR/verifier-test.sh" -v -f | get_insn_cnt | annotate_section_names
25 changes: 6 additions & 19 deletions test/bpf/verifier-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ XDP_PROGS=${XDP_PROGS:-$ALL_XDP_PROGS}
IGNORED_PROGS="bpf_alignchecker tests/bpf_ct_tests custom/bpf_custom"
ALL_PROGS="${IGNORED_PROGS} ${ALL_CG_PROGS} ${ALL_TC_PROGS} ${ALL_XDP_PROGS}"
VERBOSE=false
FORCE=false
RUN_ALL_TESTS=false

BPFFS=${BPFFS:-"/sys/fs/bpf"}
Expand Down Expand Up @@ -72,7 +73,7 @@ function load_prog {
echo "=> Loading ${name}..."
if $VERBOSE; then
# Redirect stderr to stdout to assist caller parsing
${loader} $args verbose 2>&1
${loader} $args verbose 2>&1 || $FORCE
else
# Only run verbose mode if loading fails.
${loader} $args 2>/dev/null \
Expand Down Expand Up @@ -156,23 +157,6 @@ function cg_prog_type_init {
fi
}

function load_sock_prog {
prog=$1
pinpath=$2
prog_type=$3
attach_type=$4
section=$5

local args="pin $pinpath obj ${prog}.o type $prog_type \
attach_type $attach_type sec $section"
if $VERBOSE; then
$TC exec bpf $args verbose 2>&1
else
$TC exec bpf $args 2>/dev/null \
|| $TC exec bpf $args verbose
fi
}

function load_sockops_prog {
prog="$1"
pinpath="$2"
Expand All @@ -192,7 +176,7 @@ function load_sockops_prog {

echo "=> Loading ${p}.c:${section}..."
if $VERBOSE; then
$BPFTOOL -m prog load "$prog.o" "$pinpath" $map_args 2>&1
$BPFTOOL -m prog load "$prog.o" "$pinpath" $map_args 2>&1 || $FORCE
else
$BPFTOOL -m prog load "$prog.o" "$pinpath" $map_args 2>/dev/null \
|| $BPFTOOL -m prog load "$prog.o" "$pinpath" $map_args
Expand Down Expand Up @@ -268,6 +252,9 @@ function handle_args {
-v|--verbose)
VERBOSE=true
shift;;
-f|--force)
FORCE=true
shift;;
*)
echo "Unrecognized argument '$1'" 1>&2
exit 1
Expand Down