summaryrefslogtreecommitdiffstats
path: root/tests/nft-parsing-test.c
Commit message (Collapse)AuthorAgeFilesLines
* src: add low-level ruleset APIArturo Borrero2013-10-011-0/+40
| | | | | | | | This patch adds a low level ruleset API for libnftables. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: set: add json parsing supportÁlvaro Neira Ayuso2013-08-281-0/+11
| | | | | | | Test the functions for parsing set in JSON. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: remove unnecessary variable initializationÁlvaro Neira Ayuso2013-08-281-10/+10
| | | | | Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: rule: add json parsing supportÁlvaro Neira Ayuso2013-08-201-0/+11
| | | | | | Test the functions for parsing rules in JSON. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
* tests: fix memory leaks in jansson testÁlvaro Neira Ayuso2013-08-171-2/+4
| | | | | | | Fixed a string leak and a jansson leak. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: remove superfluous if checking in test_jsonPablo Neira Ayuso2013-08-111-3/+0
| | | | | | It's already done a couple of lines above. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: better parsing validationÁlvaro Neira Ayuso2013-08-111-16/+168
| | | | | | | | | | | | | | | | | | | | | | | | | Before this patch, the test only verified that we could parse the file. After this, it also compares what it has parsed with the original file. Basically, the idea is that: file -> buffer -> object -> buffer' read snprintf So we also compare that buffer = buffer' which should be true since our tests should be based on the output that the library generates. This is an example output for the OK and FAILED cases: parsing and validating xmlfiles/25-rule-exthdr.xml: OK validating xmlfiles/27-rule-limit.xml: FAILED from file: it"><rate>123123</ra from snprintf: it"><rate>321321</ra Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: chain: add json parsing supportÁlvaro Neira Ayuso2013-07-311-0/+9
| | | | | | | Test the functions for parsing chains in JSON. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* set: add XML parsingArturo Borrero2013-07-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sets are now parsed, following this previous snprintf pattern: <set> <set_name>string</set_name> <set_table>table</set_table> <set_xml_version>int</set_xml_version> <set_flags>uint32_t</set_flags> <key_type>uint32_t</key_type> <key_len>size_t</key_len> <data_type>uint32_t</data_type> <data_len>size_t</data_len> <set_elem> <set_elem_flags>uint32_t</set_elem_flags> <set_elem_key> <data_reg type="value"> <len></len> <dataN></dataN> </data_reg> </set_elem_key> <set_elem_data> <data_reg type="xx"> [...] </data_reg> </set_elem_data> </set_elem> </set> Signed-off-by: Arturo Borrero González <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: table: test json parsing supportÁlvaro Neira Ayuso2013-07-251-0/+49
| | | | | | | Test the functions for parsing tables in JSON Support Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* tests: nft-parsing-test: restore default terminal color after testPablo Neira Ayuso2013-06-271-2/+2
| | | | Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
* test: add testbench for XMLArturo Borrero Gonzalez2013-06-271-0/+111
This patch add a testbench for XML parsing, which may be extended to test JSON as well. To use it: $ cd test/ $ make nft-parsing-test $ ./nft-parsing-test xmlfiles/ This testbench supersedes old .sh test scripts, so they are deleted. [ I have mangled this patch to rename/mangle files, to colorize the test output and not to compile XML inconditionally --pablo ] Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>