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

[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]
4496. [func] dig: add +idnout to control whether labels are
......
feature-test
systests.output
random.data
......@@ -12,17 +12,15 @@ VERSION=@BIND9_VERSION@
@BIND9_MAKE_INCLUDES@
SUBDIRS = builtin dlzexternal dyndb filter-aaaa geoip lwresd \
pipelined resolver rndc rpz rsabigexponent statistics tkey \
tsiggss
SUBDIRS = dlzexternal dyndb lwresd pipelined rndc rsabigexponent tkey
CINCLUDES = ${ISC_INCLUDES}
CINCLUDES = ${ISC_INCLUDES} ${DNS_INCLUDES}
CDEFINES = @USE_GSSAPI@
CWARNINGS =
DNSLIBS =
ISCLIBS = .
ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
DNSDEPLIBS =
ISCDEPLIBS =
......@@ -39,7 +37,7 @@ TARGETS = feature-test@EXEEXT@
@BIND9_MAKE_RULES@
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
......
# 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
if [ $ret != 0 ] ; then echo I:failed; status=`expr $status + $ret`; fi
VERSION=`../../../../isc-config.sh --version | cut -d = -f 2`
HOSTNAME=`$GETHOSTNAME`
HOSTNAME=`$FEATURETEST --gethostname`
n=`expr $n + 1`
ret=0
......
......@@ -59,18 +59,12 @@ FEATURETEST=$TOP/bin/tests/system/feature-test
RANDFILE=$TOP/bin/tests/system/random.data
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
GETHOSTNAME=$TOP/bin/tests/system/builtin/gethostname
KEYCREATE=$TOP/bin/tests/system/tkey/keycreate
KEYDELETE=$TOP/bin/tests/system/tkey/keydelete
LWTEST=$TOP/bin/tests/system/lwresd/lwtest
MAKEJOURNAL=$TOP/bin/tests/makejournal
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
# load on the machine to make it unusable to other users.
......@@ -144,13 +138,9 @@ export BIGKEY
export CHECKZONE
export DESCRIPTION
export DIG
export DLOPEN
export EDNSVERSION
export FEATURETEST
export FILTERAAAA
export FSTRM_CAPTURE
export GENCHECK
export GETHOSTNAME
export JOURNALPRINT
export KEYCREATE
export KEYDELETE
......@@ -175,9 +165,7 @@ export PYTHON
export RANDFILE
export RESOLVE
export RNDC
export RPZ
export RRCHECKER
export SIGNER
export SUBDIRS
export TESTSOCK6
export XMLSTATS
......@@ -60,23 +60,18 @@ DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@
MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@
NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@
FSTRM_CAPTURE=@FSTRM_CAPTURE@
FEATURETEST=$TOP/Build/$VSCONF/feature-test@EXEEXT@
# this is given as argument to native WIN32 executables
RANDFILE=`cygpath -w $TOP/bin/tests/system/random.data`
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@
GETHOSTNAME=$TOP/Build/$VSCONF/gethostname@EXEEXT@
KEYCREATE=$TOP/Build/$VSCONF/keycreate@EXEEXT@
KEYDELETE=$TOP/Build/$VSCONF/keydelete@EXEEXT@
LWTEST=$TOP/Build/$VSCONF/lwtest@EXEEXT@
MAKEJOURNAL=$TOP/Build/$VSCONF/makejournal@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
# load on the machine to make it unusable to other users.
......@@ -140,9 +135,39 @@ NZD=@NZD_TOOLS@
. ${TOP}/version
export NAMED LWRESD DIG NSUPDATE KEYGEN KEYFRLAB SIGNER KEYSIGNER KEYSETTOOL \
PERL SUBDIRS RNDC CHECKZONE PK11GEN PK11LIST PK11DEL TESTSOCK6 \
JOURNALPRINT ARPANAME RESOLVE RRCHECKER NSLOOKUP DESCRIPTION PYTHON \
MDIG FSTRM_CAPTURE NZD2NZF \
RANDFILE BIGKEY DLOPEN EDNSVERSION FILTERAAAA GENCHECK GETHOSTNAME \
KEYCREATE KEYDELETE LWTEST MAKEJOURNAL PIPEQUERIES RPZ XMLSTATS
export ARPANAME
export BIGKEY
export CHECKZONE
export DESCRIPTION
export DIG
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";
open(FILE1, $file1) || die("open: $file1: $!\n");
while (<FILE1>) {
chomp;
~ s/\n//g;
~ s/\r\n//g;
~ s/\n//g;
if (/^;.+status:\s+(\S+).+$/) {
$rcode1 = $1;
}
......@@ -65,9 +64,8 @@ $printed = 0;
open(FILE2, $file2) || die("open: $file2: $!\n");
while (<FILE2>) {
chomp;
~ s/\n//g;
~ s/\r\n//g;
~ s/\n//g;
if (/^;.+status:\s+(\S+).+$/) {
$rcode2 = $1;
}
......
......@@ -4,8 +4,6 @@
# 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/11/16 00:42:07 each Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
......@@ -21,26 +19,20 @@ CWARNINGS =
LIBS = @LIBS@
SO_TARGETS = driver.@SO@
TARGETS = dlopen@EXEEXT@ @SO_TARGETS@
SRCS = dlopen.c driver.c
TARGETS = @SO_TARGETS@
DLOPENOBJS = dlopen.@O@
SRCS = driver.c
SO_OBJS = driver.@O@
SO_SRCS = driver.c
OBJS = ${DLOPENOBJS}
OBJS =
@BIND9_MAKE_RULES@
CFLAGS = @CFLAGS@ @SO_CFLAGS@
SO_LDFLAGS = @LDFLAGS@ @SO_LDFLAGS@
dlopen@EXEEXT@: ${DLOPENOBJS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \
-o $@ ${DLOPENOBJS} ${LIBS}
driver.@SO@: ${SO_OBJS}
${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 @@
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
$DLOPEN || {
$FEATURETEST --have-dlopen || {
echo "I:dlopen() not supported - skipping dlzexternal test"
exit 255
}
......
......@@ -9,7 +9,7 @@
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
$DLOPEN || {
$FEATURETEST --have-dlopen || {
echo "I:dlopen() not supported - skipping dyndb test"
exit 255
}
......
......@@ -15,6 +15,11 @@
#include <isc/print.h>
#include <isc/util.h>
#include <dns/edns.h>
#ifdef WIN32
#include <Winsock2.h>
#endif
#ifndef MAXHOSTNAMELEN
#ifdef HOST_NAME_MAX
......@@ -28,7 +33,7 @@ static void
usage() {
fprintf(stderr, "usage: feature-test <arg>\n");
fprintf(stderr, "args:\n");
fprintf(stderr, " --allow-filter-aaaa\n");
fprintf(stderr, " --enable-filter-aaaa\n");
fprintf(stderr, " --edns-version\n");
fprintf(stderr, " --gethostname\n");
fprintf(stderr, " --gssapi\n");
......@@ -42,13 +47,12 @@ usage() {
int
main(int argc, char **argv) {
if (argc != 2) {
usage();
return (1);
}
if (strcmp(argv[1], "--allow-filter-aaaa") == 0) {
if (strcmp(argv[1], "--enable-filter-aaaa") == 0) {
#ifdef ALLOW_FILTER_AAAA
return (0);
#else
......@@ -68,12 +72,29 @@ main(int argc, char **argv) {
if (strcmp(argv[1], "--gethostname") == 0) {
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");
return(1);
}
fprintf(stdout, "%s\n", hostname);
#ifdef WIN32
WSACleanup();
#endif
return (0);
}
......
filter-aaaa
named.conf
named.memstats
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 =
ISCLIBS = .
DNSDEPLIBS =
ISCDEPLIBS =
DEPLIBS =
LIBS = @LIBS@
TARGETS = filter-aaaa@EXEEXT@
FILTEROBJS = filter-aaaa.@O@
SRCS = filter-aaaa.c
@BIND9_MAKE_RULES@
all: filter-aaaa@EXEEXT@
filter-aaaa@EXEEXT@: ${FILTEROBJS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${FILTEROBJS} ${LIBS}
clean distclean::
rm -f ${TARGETS}
/*
* Copyright (C) 2010-2012, 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: filter-aaaa.c,v 1.4 2011/07/28 23:47:58 tbox Exp $ */
#include <config.h>
#include <isc/util.h>
int
main(int argc, char **argv) {
UNUSED(argc);
UNUSED(argv);
#ifdef ALLOW_FILTER_AAAA
return (0);
#else
return (1);
#endif
}
......@@ -6,7 +6,7 @@
# 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/.
if $FILTERAAAA
if $FEATURETEST --enable-filter-aaaa
then
:
else
......
# Copyright (C) 2013, 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 =
ISCLIBS = .
DNSDEPLIBS =
ISCDEPLIBS =
DEPLIBS =
LIBS = @LIBS@
TARGETS = geoip@EXEEXT@
FILTEROBJS = geoip.@O@
SRCS = geoip.c
@BIND9_MAKE_RULES@
all: geoip@EXEEXT@
geoip@EXEEXT@: ${FILTEROBJS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ${FILTEROBJS} ${LIBS}
clean distclean::
rm -f ${TARGETS}
/*
* Copyright (C) 2013, 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 <isc/util.h>
int
main(int argc, char **argv) {
UNUSED(argc);
UNUSED(argv);
#ifdef HAVE_GEOIP
return (0);
#else
return (1);
#endif
}
......@@ -6,10 +6,11 @@
# 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/.
if ./geoip
then
:
else
echo "I:This test requires GeoIP support." >&2
exit 255
fi
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
$FEATURETEST --have-geoip || {
echo "I:This test requires GeoIP support." >&2
exit 255
}
exit 0
# Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")