mbox series

[nft,v2,0/5] add infrastructure for unit tests

Message ID 20231105150955.349966-1-thaller@redhat.com
Headers show
Series add infrastructure for unit tests | expand

Message

Thomas Haller Nov. 5, 2023, 3:08 p.m. UTC
Changes to v1:

- rename some `make targets`
- add `make check-unit` to alias `make check-TESTS`. These targets
  run the tests hooked up as "TESTS=" (which for now are the tests
  in tests/unit).
- improve commit messages and various minor code changes.

Thomas Haller (5):
  build: add basic "check-{local,more,all}" and "build-all" make targets
  build: add `make check-build` to run `./tests/build/run-tests.sh`
  build: add `make check-tree` to check consistency of source tree
  build: cleanup if-blocks for conditional compilation in "Makefile.am"
  tests/unit: add unit tests for libnftables

 .gitignore                           |  15 +-
 Makefile.am                          | 134 ++++++++++++---
 src/.gitignore                       |   5 -
 tests/unit/nft-test.h                |  14 ++
 tests/unit/test-libnftables-static.c |  16 ++
 tests/unit/test-libnftables.c        |  21 +++
 tools/test-runner.sh                 | 235 +++++++++++++++++++++++++++
 7 files changed, 412 insertions(+), 28 deletions(-)
 create mode 100644 tests/unit/nft-test.h
 create mode 100644 tests/unit/test-libnftables-static.c
 create mode 100644 tests/unit/test-libnftables.c
 create mode 100755 tools/test-runner.sh

Comments

Thomas Haller Nov. 21, 2023, 12:34 p.m. UTC | #1
On Sun, 2023-11-05 at 16:08 +0100, Thomas Haller wrote:
> Changes to v1:
> 
> - rename some `make targets`
> - add `make check-unit` to alias `make check-TESTS`. These targets
>   run the tests hooked up as "TESTS=" (which for now are the tests
>   in tests/unit).
> - improve commit messages and various minor code changes.
> 
> Thomas Haller (5):
>   build: add basic "check-{local,more,all}" and "build-all" make
> targets
>   build: add `make check-build` to run `./tests/build/run-tests.sh`
>   build: add `make check-tree` to check consistency of source tree
>   build: cleanup if-blocks for conditional compilation in
> "Makefile.am"
>   tests/unit: add unit tests for libnftables
> 
>  .gitignore                           |  15 +-
>  Makefile.am                          | 134 ++++++++++++---
>  src/.gitignore                       |   5 -
>  tests/unit/nft-test.h                |  14 ++
>  tests/unit/test-libnftables-static.c |  16 ++
>  tests/unit/test-libnftables.c        |  21 +++
>  tools/test-runner.sh                 | 235
> +++++++++++++++++++++++++++
>  7 files changed, 412 insertions(+), 28 deletions(-)
>  create mode 100644 tests/unit/nft-test.h
>  create mode 100644 tests/unit/test-libnftables-static.c
>  create mode 100644 tests/unit/test-libnftables.c
>  create mode 100755 tools/test-runner.sh


Hi Pablo,

any concerns about this? Could it be merged?

Thank you,
Thomas
Pablo Neira Ayuso Nov. 21, 2023, 12:37 p.m. UTC | #2
On Tue, Nov 21, 2023 at 01:34:54PM +0100, Thomas Haller wrote:
> Hi Pablo,
> 
> any concerns about this? Could it be merged?

Sorry. JSON support is not working, I had to locally revert those
patches to run tests on -stable 5.4 here.

Let's agree on some basic rule from now on: One series at a time only,
anything else coming after will be marked as deferred in patchwork.

Thanks.
Thomas Haller Dec. 6, 2023, 7:53 a.m. UTC | #3
On Tue, 2023-11-21 at 13:37 +0100, Pablo Neira Ayuso wrote:
> On Tue, Nov 21, 2023 at 01:34:54PM +0100, Thomas Haller wrote:
> > Hi Pablo,
> > 
> > any concerns about this? Could it be merged?
> 
> Sorry. JSON support is not working, I had to locally revert those
> patches to run tests on -stable 5.4 here.
> 
> Let's agree on some basic rule from now on: One series at a time
> only,
> anything else coming after will be marked as deferred in patchwork.
> 
> Thanks.
> 


Hi,

Could this be considered?

This provides the basis for unit tests (and the possibility to even add
any such tests).

It also hooks up tests to `make check`. Which would be desirable to
build upon. `make check` currently does nothing. For example, Florian's
afl++ patches could hook into `make check` (or `make check-more`), if
this basis was there.


Thomas
Pablo Neira Ayuso Dec. 6, 2023, 5:18 p.m. UTC | #4
On Wed, Dec 06, 2023 at 08:53:23AM +0100, Thomas Haller wrote:
> On Tue, 2023-11-21 at 13:37 +0100, Pablo Neira Ayuso wrote:
> > On Tue, Nov 21, 2023 at 01:34:54PM +0100, Thomas Haller wrote:
> > > Hi Pablo,
> > > 
> > > any concerns about this? Could it be merged?
> > 
> > Sorry. JSON support is not working, I had to locally revert those
> > patches to run tests on -stable 5.4 here.
> > 
> > Let's agree on some basic rule from now on: One series at a time
> > only,
> > anything else coming after will be marked as deferred in patchwork.
> > 
> > Thanks.
> > 
> 
> 
> Hi,
> 
> Could this be considered?
> 
> This provides the basis for unit tests (and the possibility to even add
> any such tests).

We are still discussing the json integration into tests/shell. I
suggest, let dust settle on each front before making more changes.

> It also hooks up tests to `make check`. Which would be desirable to
> build upon. `make check` currently does nothing. For example, Florian's
> afl++ patches could hook into `make check` (or `make check-more`), if
> this basis was there.

I still doubt `make check` provides any benefit to the release
process, which will exercise this path because of `make distcheck'
which I might have to relax it to `make dist' to skip this to ensure
release process is reliable.

I think all these tests should continously and provide reports to us,
but not necessarily integrate them into `make check'.