File: test_libbpf.sh

package info (click to toggle)
linux 4.19.249-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 968,784 kB
  • sloc: ansic: 16,810,930; asm: 272,263; makefile: 38,450; sh: 33,900; perl: 27,702; python: 21,148; cpp: 5,068; yacc: 4,650; lex: 2,584; awk: 1,386; ruby: 25; sed: 5
file content (43 lines) | stat: -rwxr-xr-x 851 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0

export TESTNAME=test_libbpf

# Determine selftest success via shell exit code
exit_handler()
{
	if [ $? -eq 0 ]; then
		echo "selftests: $TESTNAME [PASS]";
	else
		echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2
		echo "selftests: $TESTNAME [FAILED]";
	fi
}

libbpf_open_file()
{
	LAST_LOADED=$1
	if [ -n "$VERBOSE" ]; then
	    ./test_libbpf_open $1
	else
	    ./test_libbpf_open --quiet $1
	fi
}

# Exit script immediately (well catched by trap handler) if any
# program/thing exits with a non-zero status.
set -e

# (Use 'trap -l' to list meaning of numbers)
trap exit_handler 0 2 3 6 9

libbpf_open_file test_l4lb.o

# Load a program with BPF-to-BPF calls
libbpf_open_file test_l4lb_noinline.o

# Load a program compiled without the "-target bpf" flag
libbpf_open_file test_xdp.o

# Success
exit 0