summaryrefslogtreecommitdiffstats
path: root/bin/tests/system/cds
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tests/system/cds')
-rw-r--r--bin/tests/system/cds/setup.sh44
-rw-r--r--bin/tests/system/cds/tests.sh65
2 files changed, 55 insertions, 54 deletions
diff --git a/bin/tests/system/cds/setup.sh b/bin/tests/system/cds/setup.sh
index 6e3197d..f0f382d 100644
--- a/bin/tests/system/cds/setup.sh
+++ b/bin/tests/system/cds/setup.sh
@@ -40,20 +40,20 @@ id2=$id2
EOF
tac() {
- $PERL -e 'print reverse <>'
+ $PERL -e 'print reverse <>'
}
convert() {
- key=$1
- n=$2
- $DSFROMKEY -12 $key >DS.$n
- grep " ${DEFAULT_ALGORITHM_NUMBER} 1 " DS.$n >DS.$n-1
- grep " ${DEFAULT_ALGORITHM_NUMBER} 2 " DS.$n >DS.$n-2
- sed 's/ IN DS / IN CDS /' <DS.$n >>CDS.$n
- sed 's/ IN DNSKEY / IN CDNSKEY /' <$key.key >CDNSKEY.$n
- sed 's/ IN DS / 3600 IN DS /' <DS.$n >DS.ttl$n
- sed 's/ IN DS / 7200 IN DS /' <DS.$n >DS.ttlong$n
- tac <DS.$n >DS.rev$n
+ key=$1
+ n=$2
+ $DSFROMKEY -12 $key >DS.$n
+ grep " ${DEFAULT_ALGORITHM_NUMBER} 1 " DS.$n >DS.$n-1
+ grep " ${DEFAULT_ALGORITHM_NUMBER} 2 " DS.$n >DS.$n-2
+ sed 's/ IN DS / IN CDS /' <DS.$n >>CDS.$n
+ sed 's/ IN DNSKEY / IN CDNSKEY /' <$key.key >CDNSKEY.$n
+ sed 's/ IN DS / 3600 IN DS /' <DS.$n >DS.ttl$n
+ sed 's/ IN DS / 7200 IN DS /' <DS.$n >DS.ttlong$n
+ tac <DS.$n >DS.rev$n
}
convert $key1 1
convert $key2 2
@@ -85,9 +85,9 @@ cat UP.add2 UP.del1 | sed 3d >UP.swap
sed 's/ add \(.*\) IN DS / add \1 3600 IN DS /' <UP.swap >UP.swapttl
sign() {
- cat >db.$1
- $SIGNER >/dev/null \
- -S -O full -o $Z -f sig.$1 db.$1
+ cat >db.$1
+ $SIGNER >/dev/null \
+ -S -O full -o $Z -f sig.$1 db.$1
}
sign null <<EOF
@@ -116,18 +116,18 @@ cat db.null CDNSKEY.2 | sign cdnskey.2
cat db.null CDS.2 CDNSKEY.2 | sign cds.cdnskey.2
$mangle '\s+IN\s+RRSIG\s+CDS .* '$idz' '$Z'\. ' \
- <sig.cds.1 >brk.rrsig.cds.zsk
+ <sig.cds.1 >brk.rrsig.cds.zsk
$mangle '\s+IN\s+RRSIG\s+CDS .* '$id1' '$Z'\. ' \
- <sig.cds.1 >brk.rrsig.cds.ksk
+ <sig.cds.1 >brk.rrsig.cds.ksk
-$mangle " IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} 1 " <db.cds.1 |
-sign cds-mangled
+$mangle " IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} 1 " <db.cds.1 \
+ | sign cds-mangled
bad=$($PERL -le "print ($id1 ^ 255);")
-sed "s/IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} 1 /IN CDS $bad ${DEFAULT_ALGORITHM_NUMBER} 1 /" <db.cds.1 |
-sign bad-digests
+sed "s/IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} 1 /IN CDS $bad ${DEFAULT_ALGORITHM_NUMBER} 1 /" <db.cds.1 \
+ | sign bad-digests
-sed "/IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} /p;s//IN CDS $bad $ALTERNATIVE_ALGORITHM_NUMBER /" <db.cds.1 |
-sign bad-algos
+sed "/IN CDS $id1 ${DEFAULT_ALGORITHM_NUMBER} /p;s//IN CDS $bad $ALTERNATIVE_ALGORITHM_NUMBER /" <db.cds.1 \
+ | sign bad-algos
rm -f dsset-*
diff --git a/bin/tests/system/cds/tests.sh b/bin/tests/system/cds/tests.sh
index 700ae63..05f1d5a 100644
--- a/bin/tests/system/cds/tests.sh
+++ b/bin/tests/system/cds/tests.sh
@@ -17,50 +17,51 @@ SYSTEMTESTTOP=..
status=0
n=0
fail() {
- echo_i "failed"
- status=$((status + 1))
+ echo_i "failed"
+ status=$((status + 1))
}
runcmd() {
- "$@" 1> out.$n 2> err.$n
- echo $?
+ "$@" 1>out.$n 2>err.$n
+ echo $?
}
testcase() {
- n=$((n + 1))
- echo_i "$name ($n)"
- expect=$1
- shift
- result=$(runcmd "$@")
- check_stdout
- check_stderr
- if [ "$expect" -ne "$result" ]; then
- echo_d "exit status does not match $expect"
- fail
- fi
- unset name err out
+ n=$((n + 1))
+ echo_i "$name ($n)"
+ expect=$1
+ shift
+ result=$(runcmd "$@")
+ check_stdout
+ check_stderr
+ if [ "$expect" -ne "$result" ]; then
+ echo_d "exit status does not match $expect"
+ fail
+ fi
+ unset name err out
}
check_stderr() {
- if [ -n "${err:=}" ]; then
- grep -E "$err" err.$n >/dev/null && return 0
- echo_d "stderr did not match '$err'"
- else
- [ -s err.$n ] || return 0
- fi
- cat err.$n | cat_d
- fail
+ if [ -n "${err:=}" ]; then
+ grep -E "$err" err.$n >/dev/null && return 0
+ echo_d "stderr did not match '$err'"
+ else
+ [ -s err.$n ] || return 0
+ fi
+ cat err.$n | cat_d
+ fail
}
check_stdout() {
- $DIFF out.$n "${out:-empty}" >/dev/null && return
- echo_d "stdout did not match '$out'"
- ( echo "wanted"
- cat "$out"
- echo "got"
- cat out.$n
- ) | cat_d
- fail
+ $DIFF out.$n "${out:-empty}" >/dev/null && return
+ echo_d "stdout did not match '$out'"
+ (
+ echo "wanted"
+ cat "$out"
+ echo "got"
+ cat out.$n
+ ) | cat_d
+ fail
}
Z=cds.test