On Fri, 2019-08-09 at 11:22 -0400, Paul Moore wrote: > On Thu, Aug 1, 2019 at 7:12 AM Richard Haines > <richard_c_haines@xxxxxxxxxxxxxx> wrote: > > This adds basic BPF tests for map and prog functions. > > > > The check-syntax script has been modified to exclude files listed > > in tools/chk_c_exclude. This is because of macros in bpf_common.c > > that get horribly reformatted by check-syntax. > > > > Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx> > > --- > > V2 Change - Split BPF code into bpf_common.c for others to use. > > > > README.md | 4 +- > > defconfig | 5 +++ > > policy/Makefile | 4 ++ > > policy/test_bpf.te | 77 ++++++++++++++++++++++++++++++++ > > tests/Makefile | 4 ++ > > tests/bpf/.gitignore | 2 + > > tests/bpf/Makefile | 12 +++++ > > tests/bpf/bpf_common.c | 99 > > ++++++++++++++++++++++++++++++++++++++++++ > > tests/bpf/bpf_test.c | 83 +++++++++++++++++++++++++++++++++++ > > tests/bpf/test | 57 ++++++++++++++++++++++++ > > tools/check-syntax | 2 +- > > tools/chk_c_exclude | 1 + > > 12 files changed, 348 insertions(+), 2 deletions(-) > > create mode 100644 policy/test_bpf.te > > create mode 100644 tests/bpf/.gitignore > > create mode 100644 tests/bpf/Makefile > > create mode 100644 tests/bpf/bpf_common.c > > create mode 100644 tests/bpf/bpf_test.c > > create mode 100755 tests/bpf/test > > create mode 100644 tools/chk_c_exclude > > ... > > > diff --git a/tools/check-syntax b/tools/check-syntax > > index 7f9768d..5b7c211 100755 > > --- a/tools/check-syntax > > +++ b/tools/check-syntax > > @@ -11,7 +11,7 @@ > > # > > > > CHK_C_LIST="$(find tests/ -name "*.c") $(find tests/ -name "*.h")" > > -CHK_C_EXCLUDE="" > > +CHK_C_EXCLUDE="$(cat tools/chk_c_exclude)" > > > > CHK_PERL_LIST="$(find tests/ -name "*.pl") $(find tests/ -name > > "test")" > > CHK_PERL_EXCLUDE="" > > diff --git a/tools/chk_c_exclude b/tools/chk_c_exclude > > new file mode 100644 > > index 0000000..20facbf > > --- /dev/null > > +++ b/tools/chk_c_exclude > > @@ -0,0 +1 @@ > > +tests/bpf/bpf_common.c > > Why are we excluding bpf_common.c from the style checks? Because check-syntax reformats a macro and it is not neat and tidy said Mr Neat to Mr Tidy >