From 352fef644eb62e5a6c535260e35ac265a71161c8 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Tue, 2 May 2017 15:20:57 +0200 Subject: [PATCH] Check for unimplemented RR types --- .travis.yml | 1 + .../080-iana-rr-types.dsc | 15 ++++++ .../080-iana-rr-types.test | 51 +++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.dsc create mode 100644 src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.test diff --git a/.travis.yml b/.travis.yml index a447c7f1..98b98d95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ addons: - libev-dev - valgrind - clang + - wget script: - mkdir tests - cd tests diff --git a/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.dsc b/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.dsc new file mode 100644 index 00000000..9276794f --- /dev/null +++ b/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.dsc @@ -0,0 +1,15 @@ +BaseName: 080-iana-rr-types +Version: 1.0 +Description: Fetch dns-parameters.xml from iana and check all RR types +CreationDate: di 2 mei 2017 15:11:53 CEST +Maintainer: Willem Toorop +Category: +Component: +Depends: +CmdDepends: wget, grep +Pre: +Post: +Test: 080-iana-rr-types.test +AuxFiles: +Passed: +Failure: diff --git a/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.test b/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.test new file mode 100644 index 00000000..8605a6cf --- /dev/null +++ b/src/test/tpkg/080-iana-rr-types.tpkg/080-iana-rr-types.test @@ -0,0 +1,51 @@ +# source the master var file when it's there +[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master +# use .tpkg.var.test for in test variable passing +[ -f .tpkg.var.test ] && source .tpkg.var.test +# svnserve resets the path, you may need to adjust it, like this: +PATH=$PATH:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:. + +# first arg is the build dir +TPKG_BUILD=$1 +PARAM_XML="dns-parameters.xml" +PARAM_URL="http://www.iana.org/assignments/dns-parameters/$PARAM_XML" + +if [ -f $PARAM_XML ] +then + mv $PARAM_XML ${PARAM_XML}.aandekant +fi +if which wget +then + wget "$PARAM_URL" +elif ! ( echo quit | ftp "$PARAM_URL" ) +then + echo "Don't have wget or ftp to get $PARAM_URL" + exit -1 +fi + +EXIT_STATUS=0 + +for TYPE_VAL in `awk '/[^<>]*<\/type>/{ a=$1; getline; b=$1; print a""b }' dns-parameters.xml | sed -e 's///g' -e 's/<\/type>//g' -e 's//:/g' -e 's/<\/value>//g'|egrep -v '^(Unassigned|Private|Reserved)'` +do + TYPE=${TYPE_VAL%:*} + VALUE=${TYPE_VAL#*:} + case "x$TYPE" in + x\*) TYPE="ANY" + ;; + xNSAP-PTR) TYPE="NSAP_PTR" + ;; + esac + if ! grep -q "LDNS_RR_TYPE_${TYPE} = ${VALUE}" ${SRCROOT}/src/gldns/rrdef.h + then + echo "RR type ${TYPE} (value ${VALUE}) not in rrdef.h" + EXIT_STATUS=1 + fi + if ! grep -q "GETDNS_RRTYPE_${TYPE}[ ][ ]*${VALUE}" ${SRCROOT}/src/getdns/getdns.h.in + then + echo "RR type ${TYPE} (value ${VALUE}) not in getdns.h.in" + EXIT_STATUS=1 + fi +done + +exit $EXIT_STATUS +