forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Script to check that the lists of helpers are in sync
Checks src/cc/libbpf.c, docs/kernel-versions.md, src/cc/compat/linux/bpf.h, and src/cc/export/helpers.h.
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
ret=0 | ||
|
||
grep -oP '(?<={")\w+(?=", "\d\.\d+")' src/cc/libbpf.c | sort > /tmp/libbpf.txt | ||
grep -oP "(?<=BPF_FUNC_)\w+" docs/kernel-versions.md | sort > /tmp/doc.txt | ||
dif=`diff /tmp/libbpf.txt /tmp/doc.txt` | ||
if [ $? -ne 0 ]; then | ||
echo "The lists of helpers in src/cc/libbpf.c and docs/kernel-versions.md differ:" | ||
echo -e "$dif\n" | ||
((ret++)) | ||
fi | ||
|
||
grep -oP "(?<=^\sFN\()\w+" src/cc/compat/linux/bpf.h | tail -n +2 | sort > /tmp/compat.txt | ||
dif=`diff /tmp/doc.txt /tmp/compat.txt` | ||
if [ $? -ne 0 ]; then | ||
echo "The lists of helpers in docs/kernel-versions.md and src/cc/compat/linux/bpf.h differ:" | ||
echo -e "$dif\n" | ||
((ret++)) | ||
fi | ||
|
||
grep -oP "(?<=BPF_FUNC_)\w+" src/cc/export/helpers.h | sort -u > /tmp/export.txt | ||
dif=`diff /tmp/compat.txt /tmp/export.txt` | ||
if [ $? -ne 0 ]; then | ||
echo "The lists of helpers in src/cc/compat/linux/bpf.h and src/cc/export/helpers.h differ:" | ||
echo "$dif" | ||
((ret++)) | ||
fi | ||
|
||
exit $ret |