All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>, netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v4 2/8] tests: py: Enable JSON and JSON schema by default
Date: Thu, 4 Sep 2025 18:56:08 +0200	[thread overview]
Message-ID: <aLnEqJBm6tNK4IrQ@calendula> (raw)
In-Reply-To: <aLm6kp0mJfge4_Me@orbyte.nwl.cc>

On Thu, Sep 04, 2025 at 06:13:06PM +0200, Phil Sutter wrote:
> On Thu, Sep 04, 2025 at 05:29:54PM +0200, Pablo Neira Ayuso wrote:
> > On Thu, Sep 04, 2025 at 05:24:48PM +0200, Phil Sutter wrote:
> > > Introduce -J/--disable-json and -S/--no-schema to explicitly disable
> > > them if desired.
> > > 
> > > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > > ---
> > >  tests/py/nft-test.py | 16 ++++++++++++----
> > >  1 file changed, 12 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py
> > > index 984f2b937a077..12c6174b01257 100755
> > > --- a/tests/py/nft-test.py
> > > +++ b/tests/py/nft-test.py
> > > @@ -1488,7 +1488,11 @@ def set_delete_elements(set_element, set_name, table, filename=None,
> > >  
> > >      parser.add_argument('-j', '--enable-json', action='store_true',
> > >                          dest='enable_json',
> > > -                        help='test JSON functionality as well')
> > > +                        help='test JSON functionality as well (default)')
> > > +
> > > +    parser.add_argument('-J', '--disable-json', action='store_true',
> > > +                        dest='disable_json',
> > > +                        help='Do not test JSON functionality as well')
> > 
> > Would it be possible to have common options to the different tests?
> > 
> > 1/8 uses -s and -j.
> > 
> > I am not sure we have to worry about breaking backward for test
> > syntax, we only run this.
> 
> It's a bit of a mess with nft-test.py as it always performs standard
> syntax testing and JSON syntax is an add-on one may enable (or not). So
> to test JSON only, I'd have to refactor the ~300 lines long rule_add()
> function. Not the worst thing to do, but much more work than "just"
> having --enable-json being the default.

Oh, I see, so this is:

* no -j, then only standard is tested.
* -j, both standard and json are tested.

Maybe more simple is to reverse this logic, ie.

* no -j, then both standard and json syntax are tested.
* -s, only standard is tested.

Does this help?

  reply	other threads:[~2025-09-04 16:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 15:24 [nft PATCH v4 0/8] Run all test suites via 'make check' Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 1/8] tests: monitor: Excercise all syntaxes and variants by default Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 2/8] tests: py: Enable JSON and JSON schema " Phil Sutter
2025-09-04 15:29   ` Pablo Neira Ayuso
2025-09-04 16:13     ` Phil Sutter
2025-09-04 16:56       ` Pablo Neira Ayuso [this message]
2025-09-04 18:33         ` Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 3/8] tests: Prepare exit codes for automake Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 4/8] tests: json_echo: Skip if run as non-root Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 5/8] tests: shell: Skip packetpath/nat_ftp in fake root env Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 6/8] tests: build: Do not assume caller's CWD Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 7/8] tests: build: Avoid a recursive 'make check' run Phil Sutter
2025-09-04 15:24 ` [nft PATCH v4 8/8] Makefile: Enable support for 'make check' Phil Sutter
2025-09-11 16:14 ` [nft PATCH v4 0/8] Run all test suites via " Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aLnEqJBm6tNK4IrQ@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.