From 71d8a5051964fe36e54e2882a30453a97205bc5e Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Wed, 16 Dec 2015 15:48:09 +0100 Subject: [PATCH] tpkg to warn if consts and symbols are out of sync --- src/const-info.c | 3 +++ src/libgetdns.symbols | 2 +- src/mk-symfiles.sh | 2 +- .../tpkg/050-constants.tpkg/050-constants.dsc | 16 ++++++++++++++++ .../tpkg/050-constants.tpkg/050-constants.help | 1 + .../tpkg/050-constants.tpkg/050-constants.pre | 14 ++++++++++++++ .../tpkg/050-constants.tpkg/050-constants.test | 14 ++++++++++++++ src/test/tpkg/060-symbols.tpkg/060-symbols.dsc | 16 ++++++++++++++++ src/test/tpkg/060-symbols.tpkg/060-symbols.help | 1 + src/test/tpkg/060-symbols.tpkg/060-symbols.pre | 14 ++++++++++++++ src/test/tpkg/060-symbols.tpkg/060-symbols.test | 14 ++++++++++++++ 11 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 src/test/tpkg/050-constants.tpkg/050-constants.dsc create mode 100644 src/test/tpkg/050-constants.tpkg/050-constants.help create mode 100644 src/test/tpkg/050-constants.tpkg/050-constants.pre create mode 100644 src/test/tpkg/050-constants.tpkg/050-constants.test create mode 100644 src/test/tpkg/060-symbols.tpkg/060-symbols.dsc create mode 100644 src/test/tpkg/060-symbols.tpkg/060-symbols.help create mode 100644 src/test/tpkg/060-symbols.tpkg/060-symbols.pre create mode 100644 src/test/tpkg/060-symbols.tpkg/060-symbols.test diff --git a/src/const-info.c b/src/const-info.c index 8cdb212a..290d21db 100644 --- a/src/const-info.c +++ b/src/const-info.c @@ -22,6 +22,7 @@ static struct const_info consts_info[] = { { 309, "GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED", GETDNS_RETURN_DNSSEC_WITH_STUB_DISALLOWED_TEXT }, { 310, "GETDNS_RETURN_MEMORY_ERROR", GETDNS_RETURN_MEMORY_ERROR_TEXT }, { 311, "GETDNS_RETURN_INVALID_PARAMETER", GETDNS_RETURN_INVALID_PARAMETER_TEXT }, + { 312, "GETDNS_RETURN_NOT_IMPLEMENTED", GETDNS_RETURN_NOT_IMPLEMENTED_TEXT }, { 400, "GETDNS_DNSSEC_SECURE", GETDNS_DNSSEC_SECURE_TEXT }, { 401, "GETDNS_DNSSEC_BOGUS", GETDNS_DNSSEC_BOGUS_TEXT }, { 402, "GETDNS_DNSSEC_INDETERMINATE", GETDNS_DNSSEC_INDETERMINATE_TEXT }, @@ -66,6 +67,8 @@ static struct const_info consts_info[] = { { 616, "GETDNS_CONTEXT_CODE_TIMEOUT", GETDNS_CONTEXT_CODE_TIMEOUT_TEXT }, { 617, "GETDNS_CONTEXT_CODE_IDLE_TIMEOUT", GETDNS_CONTEXT_CODE_IDLE_TIMEOUT_TEXT }, { 618, "GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION", GETDNS_CONTEXT_CODE_TLS_AUTHENTICATION_TEXT }, + { 619, "GETDNS_CONTEXT_CODE_EDNS_CLIENT_SUBNET_PRIVATE", GETDNS_CONTEXT_CODE_EDNS_CLIENT_SUBNET_PRIVATE_TEXT }, + { 620, "GETDNS_CONTEXT_CODE_TLS_QUERY_PADDING_BLOCKSIZE", GETDNS_CONTEXT_CODE_TLS_QUERY_PADDING_BLOCKSIZE_TEXT }, { 700, "GETDNS_CALLBACK_COMPLETE", GETDNS_CALLBACK_COMPLETE_TEXT }, { 701, "GETDNS_CALLBACK_CANCEL", GETDNS_CALLBACK_CANCEL_TEXT }, { 702, "GETDNS_CALLBACK_TIMEOUT", GETDNS_CALLBACK_TIMEOUT_TEXT }, diff --git a/src/libgetdns.symbols b/src/libgetdns.symbols index dad7cc2f..c58baed6 100644 --- a/src/libgetdns.symbols +++ b/src/libgetdns.symbols @@ -13,7 +13,6 @@ getdns_context_get_dnssec_allowed_skew getdns_context_get_dnssec_trust_anchors getdns_context_get_dns_transport getdns_context_get_dns_transport_list -getdns_context_get_tls_authentication getdns_context_get_edns_client_subnet_private getdns_context_get_edns_do_bit getdns_context_get_edns_extended_rcode @@ -27,6 +26,7 @@ getdns_context_get_num_pending_requests getdns_context_get_resolution_type getdns_context_get_suffix getdns_context_get_timeout +getdns_context_get_tls_authentication getdns_context_get_tls_query_padding_blocksize getdns_context_get_update_callback getdns_context_get_upstream_recursive_servers diff --git a/src/mk-symfiles.sh b/src/mk-symfiles.sh index 35bda5cb..590a6c18 100755 --- a/src/mk-symfiles.sh +++ b/src/mk-symfiles.sh @@ -7,7 +7,7 @@ write_symbols() { | sed -e 's/(.*$//g' -e 's/^.*getdns_/getdns_/g' | sort | uniq > $OUTPUT } -write_symbols libgetdns.symbols getdns/getdns.h.in getdns/getdns_extra.h +write_symbols libgetdns.symbols getdns/getdns.h.in getdns/getdns_extra.h.in echo plain_mem_funcs_user_arg >> libgetdns.symbols echo priv_getdns_context_mf >> libgetdns.symbols write_symbols extension/libevent.symbols getdns/getdns_ext_libevent.h diff --git a/src/test/tpkg/050-constants.tpkg/050-constants.dsc b/src/test/tpkg/050-constants.tpkg/050-constants.dsc new file mode 100644 index 00000000..b746f673 --- /dev/null +++ b/src/test/tpkg/050-constants.tpkg/050-constants.dsc @@ -0,0 +1,16 @@ +BaseName: 050-constants +Version: 1.0 +Description: Check if all constants are in const-info.c +CreationDate: wo dec 16 14:26:01 CET 2015 +Maintainer: Willem Toorop +Category: +Component: +CmdDepends: +Depends: +Help: 050-constants.help +Pre: 050-constants.pre +Post: +Test: 050-constants.test +AuxFiles: +Passed: +Failure: diff --git a/src/test/tpkg/050-constants.tpkg/050-constants.help b/src/test/tpkg/050-constants.tpkg/050-constants.help new file mode 100644 index 00000000..f5bb9477 --- /dev/null +++ b/src/test/tpkg/050-constants.tpkg/050-constants.help @@ -0,0 +1 @@ +Are all constants in const-info.c diff --git a/src/test/tpkg/050-constants.tpkg/050-constants.pre b/src/test/tpkg/050-constants.tpkg/050-constants.pre new file mode 100644 index 00000000..b02dfa85 --- /dev/null +++ b/src/test/tpkg/050-constants.tpkg/050-constants.pre @@ -0,0 +1,14 @@ +# #-- 050-constants.pre--# +# source the master var file when it's there +if [ -f ../.tpkg.var.master ] +then + source ../.tpkg.var.master +else + ( + cd .. + [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ + && sh "${TPKG_SRCDIR}/setup-env.sh" + ) && source ../.tpkg.var.master +fi +# use .tpkg.var.test for in test variable passing +[ -f .tpkg.var.test ] && source .tpkg.var.test diff --git a/src/test/tpkg/050-constants.tpkg/050-constants.test b/src/test/tpkg/050-constants.tpkg/050-constants.test new file mode 100644 index 00000000..00939420 --- /dev/null +++ b/src/test/tpkg/050-constants.tpkg/050-constants.test @@ -0,0 +1,14 @@ +# #-- 050-constants.test --# +# 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 + +cp -p ${SRCROOT}/src/const-info.c const-info.c.orig +( + cd ${SRCROOT}/src + sh mk-const-info.c.sh +) +cp -p ${SRCROOT}/src/const-info.c const-info.c.new +cp -p const-info.c.orig ${SRCROOT}/src/const-info.c +diff const-info.c.orig const-info.c.new diff --git a/src/test/tpkg/060-symbols.tpkg/060-symbols.dsc b/src/test/tpkg/060-symbols.tpkg/060-symbols.dsc new file mode 100644 index 00000000..4580eb33 --- /dev/null +++ b/src/test/tpkg/060-symbols.tpkg/060-symbols.dsc @@ -0,0 +1,16 @@ +BaseName: 060-symbols +Version: 1.0 +Description: Check if all constants are in const-info.c +CreationDate: wo dec 16 15:41:23 CET 2015 +Maintainer: Willem Toorop +Category: +Component: +CmdDepends: +Depends: +Help: 060-symbols.help +Pre: 060-symbols.pre +Post: +Test: 060-symbols.test +AuxFiles: +Passed: +Failure: diff --git a/src/test/tpkg/060-symbols.tpkg/060-symbols.help b/src/test/tpkg/060-symbols.tpkg/060-symbols.help new file mode 100644 index 00000000..f5bb9477 --- /dev/null +++ b/src/test/tpkg/060-symbols.tpkg/060-symbols.help @@ -0,0 +1 @@ +Are all constants in const-info.c diff --git a/src/test/tpkg/060-symbols.tpkg/060-symbols.pre b/src/test/tpkg/060-symbols.tpkg/060-symbols.pre new file mode 100644 index 00000000..a9d07367 --- /dev/null +++ b/src/test/tpkg/060-symbols.tpkg/060-symbols.pre @@ -0,0 +1,14 @@ +# #-- 060-symbols.pre--# +# source the master var file when it's there +if [ -f ../.tpkg.var.master ] +then + source ../.tpkg.var.master +else + ( + cd .. + [ -f "${TPKG_SRCDIR}/setup-env.sh" ] \ + && sh "${TPKG_SRCDIR}/setup-env.sh" + ) && source ../.tpkg.var.master +fi +# use .tpkg.var.test for in test variable passing +[ -f .tpkg.var.test ] && source .tpkg.var.test diff --git a/src/test/tpkg/060-symbols.tpkg/060-symbols.test b/src/test/tpkg/060-symbols.tpkg/060-symbols.test new file mode 100644 index 00000000..00c86c22 --- /dev/null +++ b/src/test/tpkg/060-symbols.tpkg/060-symbols.test @@ -0,0 +1,14 @@ +# #-- 060-symbols.test --# +# 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 + +cp -p ${SRCROOT}/src/libgetdns.symbols libgetdns.symbols.orig +( + cd ${SRCROOT}/src + sh mk-symfiles.sh +) +cp -p ${SRCROOT}/src/libgetdns.symbols libgetdns.symbols.new +cp -p libgetdns.symbols.orig ${SRCROOT}/src/libgetdns.symbols +diff libgetdns.symbols.orig libgetdns.symbols.new