Paul Chaignon | 3424fb8 | 2018-02-14 10:13:11 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | ret=0 |
| 3 | |
Paul Chaignon | c5f48e0 | 2018-02-17 15:13:20 +0100 | [diff] [blame] | 4 | libbpf=$(grep -oP '(?<={")\w+(?=", "\d\.\d+")' src/cc/libbpf.c | sort) |
| 5 | doc=$(grep -oP "(?<=BPF_FUNC_)\w+" docs/kernel-versions.md | sort) |
| 6 | dif=$(diff <(echo "$doc") <(echo "$libbpf")) |
Paul Chaignon | 3424fb8 | 2018-02-14 10:13:11 +0100 | [diff] [blame] | 7 | if [ $? -ne 0 ]; then |
| 8 | echo "The lists of helpers in src/cc/libbpf.c and docs/kernel-versions.md differ:" |
| 9 | echo -e "$dif\n" |
| 10 | ((ret++)) |
| 11 | fi |
| 12 | |
Paul Chaignon | c5f48e0 | 2018-02-17 15:13:20 +0100 | [diff] [blame] | 13 | compat=$(grep -oP "(?<=^\sFN\()\w+" src/cc/compat/linux/bpf.h | tail -n +2 | sort) |
| 14 | dif=$(diff <(echo "$doc") <(echo "$compat")) |
Paul Chaignon | 3424fb8 | 2018-02-14 10:13:11 +0100 | [diff] [blame] | 15 | if [ $? -ne 0 ]; then |
| 16 | echo "The lists of helpers in docs/kernel-versions.md and src/cc/compat/linux/bpf.h differ:" |
| 17 | echo -e "$dif\n" |
| 18 | ((ret++)) |
| 19 | fi |
| 20 | |
Paul Chaignon | 253691a | 2018-03-23 02:19:32 +0100 | [diff] [blame] | 21 | virtual=$(grep -oP "(?<=^\sFN\()\w+" src/cc/compat/linux/virtual_bpf.h | tail -n +2 | sort -u) |
| 22 | dif=$(diff <(echo "$compat") <(echo "$virtual")) |
| 23 | if [ $? -ne 0 ]; then |
| 24 | echo "The lists of helpers in src/cc/compat/linux/bpf.h and src/cc/compat/linux/virtual_bpf.h differ:" |
| 25 | echo "$dif" |
| 26 | ((ret++)) |
| 27 | fi |
| 28 | |
Paul Chaignon | c5f48e0 | 2018-02-17 15:13:20 +0100 | [diff] [blame] | 29 | export=$(grep -oP "(?<=BPF_FUNC_)\w+" src/cc/export/helpers.h | sort -u) |
| 30 | dif=$(diff <(echo "$compat") <(echo "$export")) |
Paul Chaignon | 3424fb8 | 2018-02-14 10:13:11 +0100 | [diff] [blame] | 31 | if [ $? -ne 0 ]; then |
| 32 | echo "The lists of helpers in src/cc/compat/linux/bpf.h and src/cc/export/helpers.h differ:" |
| 33 | echo "$dif" |
| 34 | ((ret++)) |
| 35 | fi |
| 36 | |
| 37 | exit $ret |