#!/bin/sh
#
# Copyright (C) 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/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.

#
# Common configuration data for system tests, to be sourced into
# other shell scripts.
#

# Find the top of the BIND9 tree.
TOP=${SYSTEMTESTTOP:=.}/../../..

# Make it absolute so that it continues to work after we cd.
TOP=`cd $TOP && pwd`

# This is the windows build. This disables certain tests cases
# and changes some specific behaviors where necessary.
CYGWIN=1

# Load common values shared between windows and unix/linux.
. $TOP/bin/tests/system/conf.sh.common

# Visual Studio build configurations are Release and Debug
VSCONF=${VSCONF:-Debug}

ARPANAME=$TOP/Build/$VSCONF/arpaname@EXEEXT@
CDS=$TOP/Build/$VSCONF/dnssec-cds@EXEEXT@
CHECKCONF=$TOP/Build/$VSCONF/named-checkconf@EXEEXT@
CHECKDS="$PYTHON `cygpath -w $TOP/bin/python/dnssec-checkds.py`"
CHECKZONE=$TOP/Build/$VSCONF/named-checkzone@EXEEXT@
COVERAGE="$PYTHON `cygpath -w $TOP/bin/python/dnssec-coverage.py`"
DDNSCONFGEN=$TOP/Build/$VSCONF/ddns-confgen@EXEEXT@
DELV=$TOP/Build/$VSCONF/delv@EXEEXT@
DIG=$TOP/Build/$VSCONF/dig@EXEEXT@
DNSTAPREAD=$TOP/Build/$VSCONF/dnstap-read@EXEEXT@
DSFROMKEY=$TOP/Build/$VSCONF/dnssec-dsfromkey@EXEEXT@
FEATURETEST=$TOP/Build/$VSCONF/feature-test@EXEEXT@
FSTRM_CAPTURE=@FSTRM_CAPTURE@
IMPORTKEY=$TOP/Build/$VSCONF/dnssec-importkey@EXEEXT@
JOURNALPRINT=$TOP/Build/$VSCONF/named-journalprint@EXEEXT@
KEYFRLAB=$TOP/Build/$VSCONF/dnssec-keyfromlabel@EXEEXT@
KEYGEN=$TOP/Build/$VSCONF/dnssec-keygen@EXEEXT@
KEYMGR="$PYTHON `cygpath -w $TOP/bin/python/dnssec-keymgr.py`"
MDIG=$TOP/Build/$VSCONF/mdig@EXEEXT@
NAMED=$TOP/Build/$VSCONF/named@EXEEXT@
NSEC3HASH=$TOP/Build/$VSCONF/nsec3hash@EXEEXT@
NSLOOKUP=$TOP/Build/$VSCONF/nslookup@EXEEXT@
NSUPDATE=$TOP/Build/$VSCONF/nsupdate@EXEEXT@
NZD2NZF=$TOP/Build/$VSCONF/named-nzd2nzf@EXEEXT@
PK11DEL="$TOP/Build/$VSCONF/pkcs11-destroy@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0"
PK11GEN="$TOP/Build/$VSCONF/pkcs11-keygen@EXEEXT@ -q -s ${SLOT:-0} -p ${HSMPIN:-1234}"
PK11LIST="$TOP/Build/$VSCONF/pkcs11-list@EXEEXT@ -s ${SLOT:-0} -p ${HSMPIN:-1234}"
RESOLVE=$TOP/lib/samples/resolve
REVOKE=$TOP/Build/$VSCONF/dnssec-revoke@EXEEXT@
RNDC=$TOP/Build/$VSCONF/rndc@EXEEXT@
RNDCCONFGEN=$TOP/Build/$VSCONF/rndc-confgen@EXEEXT@
RRCHECKER=$TOP/Build/$VSCONF/named-rrchecker@EXEEXT@
SAMPLEUPDATE=$TOP/Build/$VSCONF/update@EXEEXT@
SETTIME=$TOP/Build/$VSCONF/dnssec-settime@EXEEXT@
SIGNER=$TOP/Build/$VSCONF/dnssec-signzone@EXEEXT@
TSIGKEYGEN=$TOP/Build/$VSCONF/tsig-keygen@EXEEXT@
VERIFY=$TOP/Build/$VSCONF/dnssec-verify@EXEEXT@

# to port WIRETEST=$TOP/Build/$VSCONF/wire_test@EXEEXT@
WIRETEST=

BIGKEY=$TOP/Build/$VSCONF/bigkey@EXEEXT@
GENCHECK=$TOP/Build/$VSCONF/gencheck@EXEEXT@
KEYCREATE=$TOP/Build/$VSCONF/keycreate@EXEEXT@
KEYDELETE=$TOP/Build/$VSCONF/keydelete@EXEEXT@
MAKEJOURNAL=$TOP/Build/$VSCONF/makejournal@EXEEXT@
PIPEQUERIES=$TOP/Build/$VSCONF/pipequeries@EXEEXT@
# to port SAMPLEUPDATE=$TOP/lib/samples/sample-update

# we don't want a KRB5_CONFIG setting breaking the tests
KRB5_CONFIG=NUL

#
# Construct the lists of tests to run
#
SEQUENTIAL_WINDOWS=""
SEQUENTIALDIRS="$SEQUENTIAL_COMMON $SEQUENTIAL_WINDOWS"

PARALLEL_WINDOWS="@CHECKDS@ @COVERAGE@ @DNSTAP@ @KEYMGR@"
PARALLELDIRS="$PARALLEL_COMMON $PARALLEL_WINDOWS"

SUBDIRS="$SEQUENTIALDIRS $PARALLELDIRS"

# Things that are different on Windows
KILL="/bin/kill -f"
DIFF="diff --strip-trailing-cr"
DOS2UNIX=dos2unix
# No trailing period
TP=

# Configure is launched from native environment, but tests are run in Cygwin -
# so any detection is unreliable.
SHELL="/bin/bash -o igncr"
CURL=/usr/bin/curl
XMLLINT=/usr/bin/xmllint
PERL=/usr/bin/perl

#
# PsSuspend is part of PSTools and can be downloaded from
# https://download.sysinternals.com/files/PSTools.zip
#
PSSUSPEND=@PSSUSPEND@

PYTHON=@PYTHON@

#
# Determine if we support various optional features.
#
HAVEXMLSTATS=@XMLSTATS@
HAVEJSONSTATS=@JSONSTATS@
HAVEZLIB=@ZLIB@
NZD=@NZD_TOOLS@

# The rest is shared between Windows and Unices
. $TOP/bin/tests/system/conf.sh.common
