diff --git a/.gitignore b/.gitignore index 5c284c95..3fe390fc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ .DS_Store -build/ +build*/ +tests*/ getdns*.tar.gz *.o *.so diff --git a/CMakeLists.txt b/CMakeLists.txt index 22bd196d..b52a73bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,9 +116,9 @@ option(BUILD_GETDNS_QUERY "Compile and install the getdns_query tool." ON) option(BUILD_GETDNS_SERVER_MON "Compile and install the getdns_server_mon tool." ON) option(BUILD_STUBBY "Compile and install stubby, the (stub) resolver daemon." OFF) -option(USE_LIBEV "Use libev if available." ON) -option(USE_LIBEVENT2 "Use libevent2 if available." ON) -option(USE_LIBUV "Use libuv if available." ON) +option(USE_LIBEV "Use libev if available." OFF) +option(USE_LIBEVENT2 "Use libevent2 if available." OFF) +option(USE_LIBUV "Use libuv if available." OFF) option(USE_LIBIDN "Use libidn if available." ON) option(USE_LIBIDN2 "Use libidn2 if available." ON) option(USE_GNUTLS "Use GnuTLS for TLS connections." OFF) @@ -188,7 +188,7 @@ if (MSVC) # So full on warnings are not appropriate. add_compile_options(/W2) else () - add_compile_options(-Wall -Wextra) + add_compile_options(-Wall -Wextra -Wpedantic) endif () # Windows. Uh-oh. @@ -737,8 +737,7 @@ if (USE_LIBEV) endif () endif () else () - message(WARNING "Libev not found, libev extension not built.") - set(USE_LIBEV OFF) + message(FATAL_ERROR "Libev required but not found.") endif () endif () @@ -785,8 +784,7 @@ if (USE_LIBEVENT2) endif () endif () else () - message(WARNING "Libevent2 not found, libevent extension not built.") - set(USE_LIBEVENT2 OFF) + message(FATAL_ERROR "Libevent2 required but not found.") endif () endif () @@ -828,8 +826,7 @@ if (USE_LIBUV) endif () endif () else () - message(WARNING "Libuv not found, libuv extension not built.") - set(USE_LIBUV OFF) + message(FATAL_ERROR "Libuv required but not found.") endif () endif () diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.dsc b/src/test/tpkg/100-compile.tpkg/100-compile.dsc index 8f73a87f..7718b6d6 100644 --- a/src/test/tpkg/100-compile.tpkg/100-compile.dsc +++ b/src/test/tpkg/100-compile.tpkg/100-compile.dsc @@ -9,7 +9,6 @@ CmdDepends: Depends: Help: Pre: 100-compile.pre -Post: 100-compile.post Test: 100-compile.test AuxFiles: Passed: diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.post b/src/test/tpkg/100-compile.tpkg/100-compile.post deleted file mode 100644 index 7744f6e7..00000000 --- a/src/test/tpkg/100-compile.tpkg/100-compile.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 100-compile.post --# -# 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 - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.pre b/src/test/tpkg/100-compile.tpkg/100-compile.pre index 6b76edba..a0d2cfbd 100644 --- a/src/test/tpkg/100-compile.tpkg/100-compile.pre +++ b/src/test/tpkg/100-compile.tpkg/100-compile.pre @@ -13,16 +13,8 @@ fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done rm -fr "${BUILDDIR}/build" mkdir "${BUILDDIR}/build" cd "${BUILDDIR}/build" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" +rm -f CMakeCache.txt +cmake -DCMAKE_INSTALL_PREFIX=../install $* ${SRCROOT} diff --git a/src/test/tpkg/100-compile.tpkg/100-compile.test b/src/test/tpkg/100-compile.tpkg/100-compile.test index 7ce2f238..12a2c61e 100644 --- a/src/test/tpkg/100-compile.tpkg/100-compile.test +++ b/src/test/tpkg/100-compile.tpkg/100-compile.test @@ -5,4 +5,4 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build" -make XTRA_CFLAGS='-g -Werror' -j 4 +make XTRA_CFLAGS='-g -WError' -j 4 diff --git a/src/test/tpkg/105-install.tpkg/105-install.test b/src/test/tpkg/105-install.tpkg/105-install.test index bdf883af..ac24f46b 100644 --- a/src/test/tpkg/105-install.tpkg/105-install.test +++ b/src/test/tpkg/105-install.tpkg/105-install.test @@ -6,5 +6,5 @@ cd "${BUILDDIR}/build" make -j 4 install \ - && echo "export GETDNS_QUERY=\"${BUILDDIR}/build/src/tools/getdns_query\"" \ + && echo "export GETDNS_QUERY=\"${BUILDDIR}/build/getdns_query\"" \ >> ../.tpkg.var.master diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc index 0888f7ff..5c3177da 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.dsc @@ -9,7 +9,6 @@ CmdDepends: Depends: Help: Pre: 200-stub-only-compile-install.pre -Post: 200-stub-only-compile-install.post Test: 200-stub-only-compile-install.test AuxFiles: Passed: diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post deleted file mode 100644 index 0a681250..00000000 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 200-stub-only-compile.post --# -# 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 - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build-stub-only" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre index 587b4fed..5355292b 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.pre @@ -13,16 +13,8 @@ fi # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-stub-only" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done rm -fr "${BUILDDIR}/build-stub-only" mkdir "${BUILDDIR}/build-stub-only" cd "${BUILDDIR}/build-stub-only" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install-stub-only" --enable-stub-only --enable-debug-server --enable-debug-anchor +rm -f CMakeCache.txt +cmake -DENABLE_STUB_ONLY=ON -DENABLE_DEBUG_SERVER=ON -DENABLE_DEBUG_ANCHOR=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only $* ${SRCROOT} diff --git a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test index 53b8d656..0ad3bbaf 100644 --- a/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test +++ b/src/test/tpkg/200-stub-only-compile-install.tpkg/200-stub-only-compile-install.test @@ -5,6 +5,6 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test cd "${BUILDDIR}/build-stub-only" -make XTRA_CFLAGS='-g -Werror' -j 4 install \ - && echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/src/tools/getdns_query\"" \ +make XTRA_CFLAGS='-g -WError' -j 4 install \ + && echo "export GETDNS_STUB_QUERY=\"${BUILDDIR}/build-stub-only/getdns_query\"" \ >> ../.tpkg.var.master diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre index 55d1c0d0..b57b27cc 100644 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test index dca4965d..4e9eb615 100644 --- a/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test +++ b/src/test/tpkg/250-json-pointers.tpkg/250-json-pointers.test @@ -4,4 +4,4 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" +cmake . && make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.cmake b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre index 802443c2..5059d77c 100644 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre +++ b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` + BUILDDIR4SED=`echo "${BUILDDIR}/build-with-stubby" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test index b3735fb4..4c6ad58d 100644 --- a/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test +++ b/src/test/tpkg/255-yaml-config.tpkg/255-yaml-config.test @@ -4,4 +4,4 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" 255-yaml-config.input | tee out && diff out "${TPKG_NAME}.good" +cmake . && make && "./${TPKG_NAME}" 255-yaml-config.input | tee out && diff out "${TPKG_NAME}.good" diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre index e9880779..21243cb0 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test index 91f6787a..0f3e4ede 100644 --- a/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test +++ b/src/test/tpkg/260-conversion-functions.tpkg/260-conversion-functions.test @@ -4,7 +4,7 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -if ! make +if ! (cmake . && make) then exit 1 elif ! ( "./${TPKG_NAME}" "${TPKG_NAME}.net-dns.org" | tee out ) diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre index 98ee2c32..109c4cc2 100644 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test index 4be307ed..30636390 100644 --- a/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test +++ b/src/test/tpkg/265-supported-rrs.tpkg/265-supported-rrs.test @@ -4,7 +4,7 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -if ! make +if ! (cmake . && make) then exit 1 elif ! ( "./${TPKG_NAME}" "${TPKG_NAME}.net-dns.org" | tee out ) diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile deleted file mode 100644 index c297df6d..00000000 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.Makefile +++ /dev/null @@ -1,15 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-I$(builddir)/src -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre index f6db2030..37fcd455 100644 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test index b9f372ac..7f0dcc32 100644 --- a/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test +++ b/src/test/tpkg/270-header-extension.tpkg/270-header-extension.test @@ -4,4 +4,4 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test -make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" +cmake . && make && "./${TPKG_NAME}" | tee out && diff out "${TPKG_NAME}.good" diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile deleted file mode 100644 index 64f2f68d..00000000 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.Makefile +++ /dev/null @@ -1,17 +0,0 @@ -builddir = @BUILDDIR@ -testname = @TPKG_NAME@ -LIBTOOL = $(builddir)/libtool - -CFLAGS=-Wall -Wextra -I$(builddir)/src -g -LDLIBS=$(builddir)/src/libgetdns.la - -.SUFFIXES: .c .o .a .lo .h - -.c.lo: - $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ - -$(testname): $(testname).lo - $(LIBTOOL) --tag=CC --mode=link $(CC) $(LDLIBS) $(LDFLAGS) -o $(testname) $(testname).lo - -clean: - rm -f $(testname).lo $(testname).o $(testname) diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake new file mode 100644 index 00000000..a5efc78b --- /dev/null +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.cmake @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.5) +project (@TPKG_NAME@) +add_executable(@TPKG_NAME@ @TPKG_NAME@.c) + +target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@) + +add_library(libgetdns SHARED IMPORTED ) +set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib ) +target_link_libraries(@TPKG_NAME@ libgetdns) \ No newline at end of file diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre index 3339477b..3bd19fd1 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.pre @@ -5,10 +5,7 @@ [ -f .tpkg.var.test ] && source .tpkg.var.test ( - grep '^CC=' "${BUILDDIR}/build-stub-only/src/Makefile" - grep '^LDFLAGS=' "${BUILDDIR}/build-stub-only/src/Makefile" - BUILDDIR4SED=`echo "${BUILDDIR}/build-stub-only" | sed 's/\//\\\\\//g'` sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \ - -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.Makefile" -) > Makefile + -e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake" +) > CMakeLists.txt diff --git a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test index 3569346b..06476a1b 100644 --- a/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test +++ b/src/test/tpkg/275-server-capabilities.tpkg/275-server-capabilities.test @@ -9,7 +9,7 @@ LOCALHOST=`${GETDNS_STUB_QUERY} '{namespaces:[GETDNS_NAMESPACE_LOCALNAMES]}' -A | sed -e 's/^[^"]*"//g' -e 's/"[^"]*$//g'` echo "localhost: $LOCALHOST" -make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( +cmake . && make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgrind.log --leak-check=full --error-exitcode=1 --track-origins=yes "./${TPKG_NAME}" ${LOCALHOST} | ( read PORT read PORT2 diff --git a/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test b/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test index 90a6e580..d45009ea 100644 --- a/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test +++ b/src/test/tpkg/300-event-loops-configure.tpkg/300-event-loops-configure.test @@ -7,10 +7,10 @@ rm -fr "${BUILDDIR}/build-event-loops" mkdir "${BUILDDIR}/build-event-loops" cd "${BUILDDIR}/build-event-loops" -"${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev --with-libuv \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libevent \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libev \ - || "${SRCROOT}/configure" $* --prefix "${BUILDDIR}/install" --enable-all-drafts --with-stubby --with-libuv +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEV=ON -DUSE_LIBUV=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEVENT2=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBEV=ON $* ${SRCROOT}) || \ +(rm CMakeCache.txt & cmake -DENABLE_DRAFT_MDNS_SUPPORT=ON -DBUILD_STUBBY=ON -DCMAKE_INSTALL_PREFIX=../install-stub-only -DUSE_LIBUV=ON $* ${SRCROOT}) diff --git a/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test b/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test index ef88d699..dbc99d17 100644 --- a/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test +++ b/src/test/tpkg/310-dependencies.tpkg/310-dependencies.test @@ -4,6 +4,12 @@ # use .tpkg.var.test for in test variable passing [ -f .tpkg.var.test ] && source .tpkg.var.test +if test "`hostname`" != "bonobo" +then + echo Sorry, running dependency test on bonobo only + exit 0 +fi + export TPKG_HERE=`pwd` # Temporarily copy Makefile.in files find . -type f -name "Makefile.in" -print0 | xargs -0 rm -f && ( @@ -15,11 +21,6 @@ find . -type f -name "Makefile.in" -print0 | xargs -0 rm -f && ( ) ( cd "${BUILDDIR}/build-event-loops" - if test "`hostname`" != "bonobo" - then - echo Sorry, running dependency test on bonobo only - exit 0 - fi if ! ./config.status --config | grep -q 'enable-all-drafts.*--with-libevent.*--with-libev.*--with-libuv' then echo Skipping because not covering enough code diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc index c06a540e..0541569b 100644 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc +++ b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.dsc @@ -8,8 +8,8 @@ Component: CmdDepends: Depends: 310-dependencies.tpkg Help: -Pre: 320-event-loops-compile.pre -Post: 320-event-loops-compile.post +Pre: +Post: Test: 320-event-loops-compile.test AuxFiles: Passed: diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post deleted file mode 100644 index a3e29076..00000000 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.post +++ /dev/null @@ -1,20 +0,0 @@ -# #-- 320-event-loops-compile.post --# -# 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 - -for f in `cat restore-srcdir-configure-settings` -do - mv "${SRCROOT}/${f}.build-event-loops" "${SRCROOT}/${f}" -done - diff --git a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre b/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre deleted file mode 100644 index a48754d4..00000000 --- a/src/test/tpkg/320-event-loops-compile.tpkg/320-event-loops-compile.pre +++ /dev/null @@ -1,24 +0,0 @@ -# #-- 320-event-loops-compile.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 - -echo "" > restore-srcdir-configure-settings -for f in `grep 'CONFIG_[FH][IE][LA][ED][SE]' "${SRCROOT}/configure.ac" | sed -e 's/^.*(\[//g' -e 's/\])//g'` -do - if [ -f "${SRCROOT}/$f" ] - then - mv "${SRCROOT}/${f}" "${SRCROOT}/${f}.build-event-loops" && \ - echo "$f" >> restore-srcdir-configure-settings - fi -done diff --git a/src/test/tpkg/setup-env.sh b/src/test/tpkg/setup-env.sh index d3269d64..8029cb05 100755 --- a/src/test/tpkg/setup-env.sh +++ b/src/test/tpkg/setup-env.sh @@ -5,20 +5,12 @@ export SRCROOT=`(cd "${SRCDIR}/../../.."; pwd)` export TPKG="${SRCDIR}/tpkg" export BUILDDIR=`pwd` export BUILDROOT=`(cd "${BUILDDIR}/../../.."; pwd)` -export LIBTOOL="${BUILDROOT}/libtool" if [ ! -f "${SRCROOT}/src/test/jsmn/jsmn.c" ] then (cd "${SRCROOT}"; git submodule update --init) fi -if [ ! -f "${SRCROOT}/libtool" ] -then - (cd "${SRCROOT}"; (glibtoolize -fic || libtoolize -fic)) -fi -if [ ! -f "${SRCROOT}/configure" ] -then - (cd "${SRCROOT}"; autoreconf -fi) -fi + if [ -f .tpkg.var.master ] then cat .tpkg.var.master \ @@ -33,7 +25,8 @@ export SRCROOT="${SRCROOT}" export BUILDDIR="${BUILDDIR}" export BUILDROOT="${BUILDROOT}" export TPKG="${TPKG}" -export LIBTOOL="${LIBTOOL}" END_OF_TPKG_VAR_MASTER +# This line disables running of this test. Need to add a build-with-stubby test +# and then re-enable this. ${TPKG} f 255-yaml-config.tpkg diff --git a/src/util/lruhash.c b/src/util/lruhash.c index c6f17365..2c21ad2d 100644 --- a/src/util/lruhash.c +++ b/src/util/lruhash.c @@ -460,6 +460,7 @@ lruhash_clear(struct lruhash* table) void lruhash_status(struct lruhash* table, const char* id, int extended) { + (void)id; lock_quick_lock(&table->lock); log_info("%s: %u entries, memory %u / %u", id, (unsigned)table->num, (unsigned)table->space_used,