From 7abf1d864b90022ec920491b0000599b77ec8ee8 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 16 Feb 2023 10:46:41 +0100 Subject: [PATCH] nwfilterxml2xmltest: Add test case for parser and formatter quirks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The parser and formatter for nwfilter rules is very strange and has weird quirks. Add a test case trying to capture some of the quirks to visualize how it will change when the code is refactored. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- tests/nwfilterxml2xmlin/quirks-invalid.xml | 13 +++++++++++++ tests/nwfilterxml2xmlout/quirks-invalid.xml | 7 +++++++ tests/nwfilterxml2xmltest.c | 5 +++++ 3 files changed, 25 insertions(+) create mode 100644 tests/nwfilterxml2xmlin/quirks-invalid.xml create mode 100644 tests/nwfilterxml2xmlout/quirks-invalid.xml diff --git a/tests/nwfilterxml2xmlin/quirks-invalid.xml b/tests/nwfilterxml2xmlin/quirks-invalid.xml new file mode 100644 index 0000000000..dab0e5035f --- /dev/null +++ b/tests/nwfilterxml2xmlin/quirks-invalid.xml @@ -0,0 +1,13 @@ + + 01a992d2-f8c8-7c27-f69b-ab0a9d377379 + + + + + + + + + + + diff --git a/tests/nwfilterxml2xmlout/quirks-invalid.xml b/tests/nwfilterxml2xmlout/quirks-invalid.xml new file mode 100644 index 0000000000..f244d45e08 --- /dev/null +++ b/tests/nwfilterxml2xmlout/quirks-invalid.xml @@ -0,0 +1,7 @@ + + 01a992d2-f8c8-7c27-f69b-ab0a9d377379 + + + + + diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c index 5c84c2fee9..c2481481ee 100644 --- a/tests/nwfilterxml2xmltest.c +++ b/tests/nwfilterxml2xmltest.c @@ -117,6 +117,11 @@ mymain(void) DO_TEST("example-1", false); DO_TEST("example-2", false); + /* The parser and formatter for nwfilter rules was written in a quirky way. + * Validate that it still works. Note that the files don't conform to the + * schema */ + DO_TEST("quirks-invalid", false); + DO_TEST("chain_prefixtest1-invalid", true); /* derived from arp-test */ DO_TEST("attr-value-test", false);