blob: 2989b2e2d856d3f546338b70fe5ad2ad3952c416 [file] [log] [blame]
Jesper Dangaard Brouerf09b2e32018-02-08 12:48:27 +01001#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3
4export TESTNAME=test_libbpf
5
6# Determine selftest success via shell exit code
7exit_handler()
8{
Quentin Monnetc5fa5d62018-10-20 22:58:44 +01009 if [ $? -eq 0 ]; then
Jesper Dangaard Brouerf09b2e32018-02-08 12:48:27 +010010 echo "selftests: $TESTNAME [PASS]";
11 else
12 echo "$TESTNAME: failed at file $LAST_LOADED" 1>&2
13 echo "selftests: $TESTNAME [FAILED]";
14 fi
15}
16
17libbpf_open_file()
18{
19 LAST_LOADED=$1
20 if [ -n "$VERBOSE" ]; then
21 ./test_libbpf_open $1
22 else
23 ./test_libbpf_open --quiet $1
24 fi
25}
26
27# Exit script immediately (well catched by trap handler) if any
28# program/thing exits with a non-zero status.
29set -e
30
31# (Use 'trap -l' to list meaning of numbers)
32trap exit_handler 0 2 3 6 9
33
34libbpf_open_file test_l4lb.o
35
Quentin Monnetf96afa72018-11-07 12:28:45 +000036# Load a program with BPF-to-BPF calls
37libbpf_open_file test_l4lb_noinline.o
Jesper Dangaard Brouerf09b2e32018-02-08 12:48:27 +010038
Quentin Monnetf96afa72018-11-07 12:28:45 +000039# Load a program compiled without the "-target bpf" flag
40libbpf_open_file test_xdp.o
Jesper Dangaard Brouerf09b2e32018-02-08 12:48:27 +010041
42# Success
43exit 0