]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
tests: nft-parsing-test: Display error reason when testing XML
authorAna Rey <anarey@gmail.com>
Wed, 11 Jun 2014 15:50:47 +0000 (17:50 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 11 Jun 2014 17:13:47 +0000 (19:13 +0200)
Add the use of system errors (nft_parse_perror) in test_xml to know which
node is not found.

Example:
parsing xmlfiles/75-ruleset.xml: FAILED (Invalid argument)
Reason : Node "flags" not found

[ I have mangled this patch to rename this the current 'fail' message
  to 'Reason' --pablo ]

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
tests/nft-parsing-test.c

index 2a15109b5876e3714cde7f88f7f28776838dcd00..57a5730333a8e5c2a7f400598c5425ffe57622fd 100644 (file)
@@ -140,7 +140,7 @@ failparsing:
        fclose(fp);
        printf("parsing %s: ", filename);
        printf("\033[31mFAILED\e[0m (%s)\n", strerror(errno));
-       nft_parse_perror("fail", err);
+       nft_parse_perror("Reason", err);
        return -1;
 }
 
@@ -177,6 +177,7 @@ failparsing:
        fclose(fp);
        printf("parsing %s: ", filename);
        printf("\033[31mFAILED\e[0m (%s)\n", strerror(errno));
+       nft_parse_perror("Reason", err);
        return -1;
 }