blob: fe79971fa655dd3bd6d382752b15f607914ea891 [file] [log] [blame]
Paul Chaignon3424fb82018-02-14 10:13:11 +01001#!/bin/bash
2ret=0
3
Paul Chaignonc5f48e02018-02-17 15:13:20 +01004libbpf=$(grep -oP '(?<={")\w+(?=", "\d\.\d+")' src/cc/libbpf.c | sort)
5doc=$(grep -oP "(?<=BPF_FUNC_)\w+" docs/kernel-versions.md | sort)
6dif=$(diff <(echo "$doc") <(echo "$libbpf"))
Paul Chaignon3424fb82018-02-14 10:13:11 +01007if [ $? -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++))
11fi
12
Paul Chaignonc5f48e02018-02-17 15:13:20 +010013compat=$(grep -oP "(?<=^\sFN\()\w+" src/cc/compat/linux/bpf.h | tail -n +2 | sort)
14dif=$(diff <(echo "$doc") <(echo "$compat"))
Paul Chaignon3424fb82018-02-14 10:13:11 +010015if [ $? -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++))
19fi
20
Paul Chaignon253691a2018-03-23 02:19:32 +010021virtual=$(grep -oP "(?<=^\sFN\()\w+" src/cc/compat/linux/virtual_bpf.h | tail -n +2 | sort -u)
22dif=$(diff <(echo "$compat") <(echo "$virtual"))
23if [ $? -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++))
27fi
28
Paul Chaignonc5f48e02018-02-17 15:13:20 +010029export=$(grep -oP "(?<=BPF_FUNC_)\w+" src/cc/export/helpers.h | sort -u)
30dif=$(diff <(echo "$compat") <(echo "$export"))
Paul Chaignon3424fb82018-02-14 10:13:11 +010031if [ $? -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++))
35fi
36
37exit $ret