Re: [nft PATCH v4 2/8] tests: py: Enable JSON and JSON schema by default

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
> > ---
> >  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.

Cheers, Phil




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux