summaryrefslogtreecommitdiffstats
path: root/tests/nft-parsing-test.c
diff options
context:
space:
mode:
authorArturo Borrero <arturo.borrero.glez@gmail.com>2016-09-22 16:58:13 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2016-09-23 10:04:16 +0200
commit0758d102627744847d0bd2e4744d27695edb9a14 (patch)
treed8e004ddfba5ba10f63bd857dbf82f1834cdcf3d /tests/nft-parsing-test.c
parentf3bd67823b16fb7ef1ca4e4d93535f77eb0c2b53 (diff)
src: remove libmxml support
This patch removes the libmxml integration in libnftnl, since we have JSON in place and there is no need to support two at the same time. The JSON support is much better, for example libjansson has a better parsing error reporting. Moreover, libmxml 2.10 breaks the integration with libnftnl somehow, as reported in Debian bug #83870 [0]. Also, the XML support inside libnftnl has never been in good shape, with several tiny inconsitencies. [0] https://bugs.debian.org/838370 Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/nft-parsing-test.c')
-rw-r--r--tests/nft-parsing-test.c62
1 files changed, 2 insertions, 60 deletions
diff --git a/tests/nft-parsing-test.c b/tests/nft-parsing-test.c
index ce3dc4d..d25a73e 100644
--- a/tests/nft-parsing-test.c
+++ b/tests/nft-parsing-test.c
@@ -144,43 +144,6 @@ failparsing:
return -1;
}
-static int test_xml(const char *filename, struct nftnl_parse_err *err)
-{
- int ret = -1;
- struct nftnl_ruleset *rs;
- FILE *fp;
-
- fp = fopen(filename, "r");
- if (fp == NULL) {
- printf("unable to open file %s: %s\n", filename,
- strerror(errno));
- return -1;
- }
-
- rs = nftnl_ruleset_alloc();
- if (rs == NULL) {
- perror("nftnl_ruleset_alloc");
- return -1;
- }
-
- if (nftnl_ruleset_parse_file(rs, NFTNL_PARSE_XML, fp, err) == 0)
- ret = compare_test(TEST_XML_RULESET, rs, filename, fp);
- else
- goto failparsing;
-
- nftnl_ruleset_free(rs);
- fclose(fp);
-
- return ret;
-
-failparsing:
- fclose(fp);
- printf("parsing %s: ", filename);
- printf("\033[31mFAILED\e[0m (%s)\n", strerror(errno));
- nftnl_parse_perror("Reason", err);
- return -1;
-}
-
static int execute_test(const char *dir_name)
{
DIR *d;
@@ -210,16 +173,6 @@ static int execute_test(const char *dir_name)
snprintf(path, sizeof(path), "%s/%s", dir_name, dent->d_name);
- if (strcmp(&dent->d_name[len-4], ".xml") == 0) {
- if ((ret = test_xml(path, err)) == 0) {
- if (!update) {
- printf("parsing and validating %s: ",
- path);
- printf("\033[32mOK\e[0m\n");
- }
- }
- exit_code += ret;
- }
if (strcmp(&dent->d_name[len-5], ".json") == 0) {
if ((ret = test_json(path, err)) == 0) {
if (!update) {
@@ -244,8 +197,8 @@ static int execute_test(const char *dir_name)
static int execute_test_file(const char *filename)
{
char path[PATH_MAX];
- int ret = 0;
struct nftnl_parse_err *err;
+ int ret = 0, len;
err = nftnl_parse_err_alloc();
if (err == NULL) {
@@ -255,18 +208,7 @@ static int execute_test_file(const char *filename)
snprintf(path, sizeof(path), "%s", filename);
- int len = strlen(filename);
- if (strcmp(&filename[len-4], ".xml") == 0) {
- if ((ret = test_xml(path, err)) == 0) {
- if (!update) {
- printf("parsing and validating %s: ",
- path);
- printf("\033[32mOK\e[0m\n");
- }
- }
- nftnl_parse_err_free(err);
- exit(EXIT_FAILURE);
- }
+ len = strlen(filename);
if (strcmp(&filename[len-5], ".json") == 0) {
if ((ret = test_json(path, err)) == 0) {
if (!update) {