Commit 5480a74b authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] simplify prereq checks by using feature-test.c

4498.	[test]		Simplify prerequisite checks in system tests.
			[RT #43516]
parent ace79092
4498. [test] Simplify prerequisite checks in system tests.
[RT #43516]
4497. [port] Add support for OpenSSL 1.1.0. [RT #41284] 4497. [port] Add support for OpenSSL 1.1.0. [RT #41284]
4496. [func] dig: add +idnout to control whether labels are 4496. [func] dig: add +idnout to control whether labels are
......
feature-test
systests.output systests.output
random.data random.data
...@@ -12,17 +12,15 @@ VERSION=@BIND9_VERSION@ ...@@ -12,17 +12,15 @@ VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@ @BIND9_MAKE_INCLUDES@
SUBDIRS = builtin dlzexternal dyndb filter-aaaa geoip lwresd \ SUBDIRS = dlzexternal dyndb lwresd pipelined rndc rsabigexponent tkey
pipelined resolver rndc rpz rsabigexponent statistics tkey \
tsiggss
CINCLUDES = ${ISC_INCLUDES} CINCLUDES = ${ISC_INCLUDES} ${DNS_INCLUDES}
CDEFINES = @USE_GSSAPI@ CDEFINES = @USE_GSSAPI@
CWARNINGS = CWARNINGS =
DNSLIBS = DNSLIBS =
ISCLIBS = . ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
DNSDEPLIBS = DNSDEPLIBS =
ISCDEPLIBS = ISCDEPLIBS =
...@@ -39,7 +37,7 @@ TARGETS = feature-test@EXEEXT@ ...@@ -39,7 +37,7 @@ TARGETS = feature-test@EXEEXT@
@BIND9_MAKE_RULES@ @BIND9_MAKE_RULES@
feature-test@EXEEXT@: feature-test.@O@ feature-test@EXEEXT@: feature-test.@O@
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ feature-test.@O@ ${LIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ feature-test.@O@ ${ISCLIBS} ${LIBS}
# Running the scripts below is bypassed when a separate # Running the scripts below is bypassed when a separate
......
# Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id$
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
CINCLUDES = ${ISC_INCLUDES}
CDEFINES =
CWARNINGS =
DNSLIBS =
ISCLIBS = ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
DNSDEPLIBS =
ISCDEPLIBS =
DEPLIBS =
LIBS = @LIBS@
TARGETS = gethostname@EXEEXT@
SRCS = gethostname.c
OBJS = gethostname.@O@
@BIND9_MAKE_RULES@
all: gethostname@EXEEXT@
gethostname@EXEEXT@: ${OBJS} ${ISCDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LIBS} ${ISCLIBS}
clean distclean::
rm -f ${TARGETS}
/*
* Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <config.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <isc/print.h>
#include <isc/util.h>
#ifdef WIN32
#include <Winsock2.h>
#endif
#ifndef MAXHOSTNAMELEN
#ifdef HOST_NAME_MAX
#define MAXHOSTNAMELEN HOST_NAME_MAX
#else
#define MAXHOSTNAMELEN 256
#endif
#endif
int
main(void) {
char hostname[MAXHOSTNAMELEN];
int n;
#ifdef WIN32
/* From lwres InitSocket() */
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD(2, 0);
err = WSAStartup( wVersionRequested, &wsaData );
if (err != 0) {
fprintf(stderr, "WSAStartup() failed: %d\n", err);
exit(1);
}
#endif
n = gethostname(hostname, sizeof(hostname));
if (n == -1) {
perror("gethostname");
exit(1);
}
fprintf(stdout, "%s\n", hostname);
#ifdef WIN32
WSACleanup();
#endif
return (0);
}
...@@ -35,7 +35,7 @@ grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1 ...@@ -35,7 +35,7 @@ grep "zone serial (0) unchanged." ns1/named.run > /dev/null && ret=1
if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi
VERSION=`../../../../isc-config.sh --version | cut -d = -f 2` VERSION=`../../../../isc-config.sh --version | cut -d = -f 2`
HOSTNAME=`$GETHOSTNAME` HOSTNAME=`$FEATURETEST --gethostname`
n=`expr $n + 1` n=`expr $n + 1`
ret=0 ret=0
......
...@@ -59,18 +59,12 @@ FEATURETEST=$TOP/bin/tests/system/feature-test ...@@ -59,18 +59,12 @@ FEATURETEST=$TOP/bin/tests/system/feature-test
RANDFILE=$TOP/bin/tests/system/random.data RANDFILE=$TOP/bin/tests/system/random.data
BIGKEY=$TOP/bin/tests/system/rsabigexponent/bigkey BIGKEY=$TOP/bin/tests/system/rsabigexponent/bigkey
DLOPEN=$TOP/bin/tests/system/dlzexternal/dlopen
EDNSVERSION=$TOP/bin/tests/system/resolver/edns-version
FILTERAAAA=$TOP/bin/tests/system/filter-aaaa/filter-aaaa
GENCHECK=$TOP/bin/tests/system/rndc/gencheck GENCHECK=$TOP/bin/tests/system/rndc/gencheck
GETHOSTNAME=$TOP/bin/tests/system/builtin/gethostname
KEYCREATE=$TOP/bin/tests/system/tkey/keycreate KEYCREATE=$TOP/bin/tests/system/tkey/keycreate
KEYDELETE=$TOP/bin/tests/system/tkey/keydelete KEYDELETE=$TOP/bin/tests/system/tkey/keydelete
LWTEST=$TOP/bin/tests/system/lwresd/lwtest LWTEST=$TOP/bin/tests/system/lwresd/lwtest
MAKEJOURNAL=$TOP/bin/tests/makejournal MAKEJOURNAL=$TOP/bin/tests/makejournal
PIPEQUERIES=$TOP/bin/tests/system/pipelined/pipequeries PIPEQUERIES=$TOP/bin/tests/system/pipelined/pipequeries
RPZ=$TOP/bin/tests/system/rpz/rpz
XMLSTATS=$TOP/bin/tests/system/statistics/xmlstats
# The "stress" test is not run by default since it creates enough # The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users. # load on the machine to make it unusable to other users.
...@@ -144,13 +138,9 @@ export BIGKEY ...@@ -144,13 +138,9 @@ export BIGKEY
export CHECKZONE export CHECKZONE
export DESCRIPTION export DESCRIPTION
export DIG export DIG
export DLOPEN
export EDNSVERSION
export FEATURETEST export FEATURETEST
export FILTERAAAA
export FSTRM_CAPTURE export FSTRM_CAPTURE
export GENCHECK export GENCHECK
export GETHOSTNAME
export JOURNALPRINT export JOURNALPRINT
export KEYCREATE export KEYCREATE
export KEYDELETE export KEYDELETE
...@@ -175,9 +165,7 @@ export PYTHON ...@@ -175,9 +165,7 @@ export PYTHON
export RANDFILE export RANDFILE
export RESOLVE export RESOLVE
export RNDC export RNDC
export RPZ
export RRCHECKER export RRCHECKER
export SIGNER export SIGNER
export SUBDIRS export SUBDIRS
export TESTSOCK6 export TESTSOCK6
export XMLSTATS
...@@ -60,23 +60,18 @@ DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@ ...@@ -60,23 +60,18 @@ DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@
MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@ MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@
NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@ NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@
FSTRM_CAPTURE=@FSTRM_CAPTURE@ FSTRM_CAPTURE=@FSTRM_CAPTURE@
FEATURETEST=$TOP/Build/$VSCONF/feature-test@EXEEXT@
# this is given as argument to native WIN32 executables # this is given as argument to native WIN32 executables
RANDFILE=`cygpath -w $TOP/bin/tests/system/random.data` RANDFILE=`cygpath -w $TOP/bin/tests/system/random.data`
BIGKEY=$TOP/Build/$VSCONF/bigkey@EXEEXT@ BIGKEY=$TOP/Build/$VSCONF/bigkey@EXEEXT@
DLOPEN=$TOP/Build/$VSCONF/dlopen@EXEEXT@
EDNSVERSION=$TOP/Build/$VSCONF/edns-version@EXEEXT@
FILTERAAAA=$TOP/Build/$VSCONF/filter-aaaa@EXEEXT@
GENCHECK=$TOP/Build/$VSCONF/gencheck@EXEEXT@ GENCHECK=$TOP/Build/$VSCONF/gencheck@EXEEXT@
GETHOSTNAME=$TOP/Build/$VSCONF/gethostname@EXEEXT@
KEYCREATE=$TOP/Build/$VSCONF/keycreate@EXEEXT@ KEYCREATE=$TOP/Build/$VSCONF/keycreate@EXEEXT@
KEYDELETE=$TOP/Build/$VSCONF/keydelete@EXEEXT@ KEYDELETE=$TOP/Build/$VSCONF/keydelete@EXEEXT@
LWTEST=$TOP/Build/$VSCONF/lwtest@EXEEXT@ LWTEST=$TOP/Build/$VSCONF/lwtest@EXEEXT@
MAKEJOURNAL=$TOP/Build/$VSCONF/makejournal@EXEEXT@ MAKEJOURNAL=$TOP/Build/$VSCONF/makejournal@EXEEXT@
PIPEQUERIES=$TOP/Build/$VSCONF/pipequeries@EXEEXT@ PIPEQUERIES=$TOP/Build/$VSCONF/pipequeries@EXEEXT@
RPZ=$TOP/Build/$VSCONF/rpz@EXEEXT@
XMLSTATS=$TOP/Build/$VSCONF/xmlstats@EXEEXT@
# The "stress" test is not run by default since it creates enough # The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users. # load on the machine to make it unusable to other users.
...@@ -140,9 +135,39 @@ NZD=@NZD_TOOLS@ ...@@ -140,9 +135,39 @@ NZD=@NZD_TOOLS@
. ${TOP}/version . ${TOP}/version
export NAMED LWRESD DIG NSUPDATE KEYGEN KEYFRLAB SIGNER KEYSIGNER KEYSETTOOL \ export ARPANAME
PERL SUBDIRS RNDC CHECKZONE PK11GEN PK11LIST PK11DEL TESTSOCK6 \ export BIGKEY
JOURNALPRINT ARPANAME RESOLVE RRCHECKER NSLOOKUP DESCRIPTION PYTHON \ export CHECKZONE
MDIG FSTRM_CAPTURE NZD2NZF \ export DESCRIPTION
RANDFILE BIGKEY DLOPEN EDNSVERSION FILTERAAAA GENCHECK GETHOSTNAME \ export DIG
KEYCREATE KEYDELETE LWTEST MAKEJOURNAL PIPEQUERIES RPZ XMLSTATS export FEATURETEST
export FSTRM_CAPTURE
export GENCHECK
export JOURNALPRINT
export KEYCREATE
export KEYDELETE
export KEYFRLAB
export KEYGEN
export KEYSETTOOL
export KEYSIGNER
export LWRESD
export LWTEST
export MAKEJOURNAL
export MDIG
export NAMED
export NSLOOKUP
export NSUPDATE
export NZD2NZF
export PERL
export PIPEQUERIES
export PK11DEL
export PK11GEN
export PK11LIST
export PYTHON
export RANDFILE
export RESOLVE
export RNDC
export RRCHECKER
export SIGNER
export SUBDIRS
export TESTSOCK6
...@@ -28,9 +28,8 @@ $rcode2 = "none"; ...@@ -28,9 +28,8 @@ $rcode2 = "none";
open(FILE1, $file1) || die("open: $file1: $!\n"); open(FILE1, $file1) || die("open: $file1: $!\n");
while (<FILE1>) { while (<FILE1>) {
chomp;
~ s/\n//g;
~ s/\r\n//g; ~ s/\r\n//g;
~ s/\n//g;
if (/^;.+status:\s+(\S+).+$/) { if (/^;.+status:\s+(\S+).+$/) {
$rcode1 = $1; $rcode1 = $1;
} }
...@@ -65,9 +64,8 @@ $printed = 0; ...@@ -65,9 +64,8 @@ $printed = 0;
open(FILE2, $file2) || die("open: $file2: $!\n"); open(FILE2, $file2) || die("open: $file2: $!\n");
while (<FILE2>) { while (<FILE2>) {
chomp;
~ s/\n//g;
~ s/\r\n//g; ~ s/\r\n//g;
~ s/\n//g;
if (/^;.+status:\s+(\S+).+$/) { if (/^;.+status:\s+(\S+).+$/) {
$rcode2 = $1; $rcode2 = $1;
} }
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: Makefile.in,v 1.4 2011/11/16 00:42:07 each Exp $
srcdir = @srcdir@ srcdir = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
top_srcdir = @top_srcdir@ top_srcdir = @top_srcdir@
...@@ -21,26 +19,20 @@ CWARNINGS = ...@@ -21,26 +19,20 @@ CWARNINGS =
LIBS = @LIBS@ LIBS = @LIBS@
SO_TARGETS = driver.@SO@ SO_TARGETS = driver.@SO@
TARGETS = dlopen@EXEEXT@ @SO_TARGETS@ TARGETS = @SO_TARGETS@
SRCS = dlopen.c driver.c
DLOPENOBJS = dlopen.@O@ SRCS = driver.c
SO_OBJS = driver.@O@ SO_OBJS = driver.@O@
SO_SRCS = driver.c SO_SRCS = driver.c
OBJS = ${DLOPENOBJS} OBJS =
@BIND9_MAKE_RULES@ @BIND9_MAKE_RULES@
CFLAGS = @CFLAGS@ @SO_CFLAGS@ CFLAGS = @CFLAGS@ @SO_CFLAGS@
SO_LDFLAGS = @LDFLAGS@ @SO_LDFLAGS@ SO_LDFLAGS = @LDFLAGS@ @SO_LDFLAGS@
dlopen@EXEEXT@: ${DLOPENOBJS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
-o $@ ${DLOPENOBJS} ${LIBS}
driver.@SO@: ${SO_OBJS} driver.@SO@: ${SO_OBJS}
${LIBTOOL_MODE_LINK} @SO_LD@ ${SO_LDFLAGS} -o $@ driver.@O@ ${LIBTOOL_MODE_LINK} @SO_LD@ ${SO_LDFLAGS} -o $@ driver.@O@
......
/*
* Copyright (C) 2011, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: dlopen.c,v 1.2 2011/03/10 04:36:15 each Exp $ */
#include <config.h>
int
main() {
#if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN)
return (0);
#else
return (1);
#endif
}
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
SYSTEMTESTTOP=.. SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh . $SYSTEMTESTTOP/conf.sh
$DLOPEN || { $FEATURETEST --have-dlopen || {
echo "I:dlopen() not supported - skipping dlzexternal test" echo "I:dlopen() not supported - skipping dlzexternal test"
exit 255 exit 255
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
SYSTEMTESTTOP=.. SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh . $SYSTEMTESTTOP/conf.sh
$DLOPEN || { $FEATURETEST --have-dlopen || {
echo "I:dlopen() not supported - skipping dyndb test" echo "I:dlopen() not supported - skipping dyndb test"
exit 255 exit 255
} }
......
...@@ -15,6 +15,11 @@ ...@@ -15,6 +15,11 @@
#include <isc/print.h> #include <isc/print.h>
#include <isc/util.h> #include <isc/util.h>
#include <dns/edns.h>
#ifdef WIN32
#include <Winsock2.h>
#endif
#ifndef MAXHOSTNAMELEN #ifndef MAXHOSTNAMELEN
#ifdef HOST_NAME_MAX #ifdef HOST_NAME_MAX
...@@ -28,7 +33,7 @@ static void ...@@ -28,7 +33,7 @@ static void
usage() { usage() {
fprintf(stderr, "usage: feature-test <arg>\n"); fprintf(stderr, "usage: feature-test <arg>\n");
fprintf(stderr, "args:\n"); fprintf(stderr, "args:\n");
fprintf(stderr, " --allow-filter-aaaa\n"); fprintf(stderr, " --enable-filter-aaaa\n");
fprintf(stderr, " --edns-version\n"); fprintf(stderr, " --edns-version\n");
fprintf(stderr, " --gethostname\n"); fprintf(stderr, " --gethostname\n");
fprintf(stderr, " --gssapi\n"); fprintf(stderr, " --gssapi\n");
...@@ -42,13 +47,12 @@ usage() { ...@@ -42,13 +47,12 @@ usage() {
int int
main(int argc, char **argv) { main(int argc, char **argv) {
if (argc != 2) { if (argc != 2) {
usage(); usage();
return (1); return (1);
} }
if (strcmp(argv[1], "--allow-filter-aaaa") == 0) { if (strcmp(argv[1], "--enable-filter-aaaa") == 0) {
#ifdef ALLOW_FILTER_AAAA #ifdef ALLOW_FILTER_AAAA
return (0); return (0);
#else #else
...@@ -68,12 +72,29 @@ main(int argc, char **argv) { ...@@ -68,12 +72,29 @@ main(int argc, char **argv) {
if (strcmp(argv[1], "--gethostname") == 0) { if (strcmp(argv[1], "--gethostname") == 0) {
char hostname[MAXHOSTNAMELEN]; char hostname[MAXHOSTNAMELEN];
int n; int n;
#ifdef WIN32
/* From lwres InitSocket() */
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD(2, 0);
err = WSAStartup( wVersionRequested, &wsaData );
if (err != 0) {
fprintf(stderr, "WSAStartup() failed: %d\n", err);
exit(1);
}
#endif
n = gethostname(hostname, sizeof(hostname)); n = gethostname(hostname, sizeof(hostname));
if (n == -1) { if (n == -1) {
perror("gethostname"); perror("gethostname");
return(1); return(1);
} }
fprintf(stdout, "%s\n", hostname); fprintf(stdout, "%s\n", hostname);
#ifdef WIN32
WSACleanup();
#endif
return (0); return (0);
} }
......
filter-aaaa
named.conf named.conf
named.memstats named.memstats
named.run named.run
# Copyright (C) 2010-2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# $Id: Makefile.in,v 1.4 2011/07/28 23:47:58 tbox Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
CINCLUDES = ${ISC_INCLUDES}
CDEFINES =
CWARNINGS =
DNSLIBS =