From 0dd26f53100121cc001ed259af722a9ca962cdf2 Mon Sep 17 00:00:00 2001 From: Paul Hoffman Date: Fri, 22 Nov 2019 13:46:37 +0800 Subject: [PATCH] Changed output to JSON, added jq to test infrastructure --- .../123-run-getdns_validate.test | 8 ++++---- src/tools/getdns_validate.c | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/tpkg/123-run-getdns_validate.tpkg/123-run-getdns_validate.test b/src/test/tpkg/123-run-getdns_validate.tpkg/123-run-getdns_validate.test index 15df16e8..be585c5f 100644 --- a/src/test/tpkg/123-run-getdns_validate.tpkg/123-run-getdns_validate.test +++ b/src/test/tpkg/123-run-getdns_validate.tpkg/123-run-getdns_validate.test @@ -10,16 +10,16 @@ function FAIL () { } "${GETDNS_VALIDATE}" -k root.ds -s root.keys -d 2019-11-19 www.test.heggggg.A www.test.heggggg \ -| grep ^400 || FAIL -k root.ds -s root.keys -d 2019-11-19 www.test.heggggg.A www.test.heggggg +| jq ".code" | grep 400 || FAIL -k root.ds -s root.keys -d 2019-11-19 www.test.heggggg.A www.test.heggggg "${GETDNS_VALIDATE}" -k root.ds -s root.keys -d 2019-11-19 nl.DS \ -| grep ^400 || FAIL -k root.ds -s root.keys -d 2019-11-19 nl.DS +| jq ".code" | grep 400 || FAIL -k root.ds -s root.keys -d 2019-11-19 nl.DS cat root.keys nl.DS nl.keys >support "${GETDNS_VALIDATE}" -k root.ds -s support -d 2019-11-19 nlnetlabs.DS \ -| grep ^400 || FAIL -k root.ds -s support -d 2019-11-19 nlnetlabs.DS +| jq ".code" | grep 400 || FAIL -k root.ds -s support -d 2019-11-19 nlnetlabs.DS cat root.keys nl.DS nl.keys nlnetlabs.DS nlnetlabs.keys >support "${GETDNS_VALIDATE}" -k root.ds -s support -d 2019-11-19 www.nlnetlabs.nl.AAAA \ -| grep ^400 || FAIL -k root.ds -s support -d 2019-11-19 www.nlnetlabs.nl.AAAA +| jq ".code" | grep 400 || FAIL -k root.ds -s support -d 2019-11-19 www.nlnetlabs.nl.AAAA diff --git a/src/tools/getdns_validate.c b/src/tools/getdns_validate.c index 82b50a40..3034b76a 100644 --- a/src/tools/getdns_validate.c +++ b/src/tools/getdns_validate.c @@ -108,7 +108,8 @@ getdns_return_t print_dnssec_status(int status) case GETDNS_DNSSEC_INSECURE: case GETDNS_DNSSEC_INDETERMINATE: case GETDNS_DNSSEC_BOGUS: - printf("%i %s\n", status, getdns_get_errorstr_by_id(status)); + /* printf("%i %s\n", status, getdns_get_errorstr_by_id(status)); */ + printf("{\"code\": %i, \"desc\": \"%s\"}\n", status, getdns_get_errorstr_by_id(status)); return GETDNS_RETURN_GOOD; default: fprintf(stderr, "Error validating");