summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/Makefile.am9
-rw-r--r--src/test/datafile2
-rw-r--r--src/test/datafile2560
-rw-r--r--src/test/datafile32
-rwxr-xr-xsrc/test/test1.sh4
-rwxr-xr-xsrc/test/test2.sh108
-rwxr-xr-xsrc/test/test3.sh46
-rw-r--r--src/test/updatefile11
8 files changed, 742 insertions, 0 deletions
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
new file mode 100644
index 0000000..9b3e7c2
--- /dev/null
+++ b/src/test/Makefile.am
@@ -0,0 +1,9 @@
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+
+CLEANFILES = test*.log test*.trs \
+ test2.out
+
+TESTS = test1.sh test2.sh test3.sh
+
+EXTRA_DIST = $(TESTS) \
+ datafile datafile2 updatefile
diff --git a/src/test/datafile b/src/test/datafile
new file mode 100644
index 0000000..883156e
--- /dev/null
+++ b/src/test/datafile
@@ -0,0 +1,2 @@
+google.com A
+google.com AAAA
diff --git a/src/test/datafile2 b/src/test/datafile2
new file mode 100644
index 0000000..96acd2d
--- /dev/null
+++ b/src/test/datafile2
@@ -0,0 +1,560 @@
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
+google.com A
+google.com AAAA
diff --git a/src/test/datafile3 b/src/test/datafile3
new file mode 100644
index 0000000..ce49d49
--- /dev/null
+++ b/src/test/datafile3
@@ -0,0 +1,2 @@
+. A
+google.com. A
diff --git a/src/test/test1.sh b/src/test/test1.sh
new file mode 100755
index 0000000..945aab3
--- /dev/null
+++ b/src/test/test1.sh
@@ -0,0 +1,4 @@
+#!/bin/sh -xe
+
+../dnsperf -h
+../resperf -h
diff --git a/src/test/test2.sh b/src/test/test2.sh
new file mode 100755
index 0000000..a4cfce0
--- /dev/null
+++ b/src/test/test2.sh
@@ -0,0 +1,108 @@
+#!/bin/sh -xe
+
+test "$TEST_DNSPERF_WITH_NETWORK" = "1" || exit 0
+
+for ip in 1.1.1.1 2606:4700:4700::1111; do
+
+echo "google.com A" | ../dnsperf -vvv -s $ip -m udp >test2.out
+cat test2.out
+grep -q "Queries sent: *1" test2.out
+echo "google.com A" | ../dnsperf -vvv -s $ip -e -E 12345:0a0a0a0a -m udp >test2.out
+cat test2.out
+grep -q "Queries sent: *1" test2.out
+../dnsperf -vvv -s $ip -d "$srcdir/datafile" -n 2 -m udp >test2.out
+cat test2.out
+grep -q "Queries sent: *4" test2.out
+../dnsperf -s $ip -d "$srcdir/datafile" -n 1 -m tcp >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+../dnsperf -s $ip -d "$srcdir/datafile" -n 1 -m tls >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+../dnsperf -s $ip -d "$srcdir/datafile" -n 1 -m dot >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+
+../dnsperf -s $ip -d "$srcdir/datafile3" -n 1 -m dot >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+
+../dnsperf -s $ip -d "$srcdir/datafile" -n 1 -e >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+../dnsperf -s $ip -d "$srcdir/datafile" -n 1 -e -D >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-md5:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-sha1:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-sha224:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-sha256:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-sha384:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+../dnsperf -d "$srcdir/updatefile" -u -s $ip -y hmac-sha512:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Updates sent: *1" test2.out
+
+../resperf -s $ip -m 1 -d "$srcdir/datafile2" -r 2 -c 2 -M udp >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+../resperf -s $ip -m 1 -d "$srcdir/datafile2" -r 2 -c 2 -M tcp >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+
+../resperf -s $ip -m 1 -d "$srcdir/datafile2" -r 2 -c 2 -M udp -D >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+# Disabled until https://github.com/DNS-OARC/dnsperf/issues/92 is fixed
+../resperf -s $ip -m 1 -d "$srcdir/datafile2" -r 2 -c 2 -M udp -y hmac-sha256:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= >test2.out
+cat test2.out
+grep -q "Queries sent: *2" test2.out
+
+# Ignore failure until https://github.com/DNS-OARC/dnsperf/issues/88 is fixed
+# May work on slower systems
+../resperf -s $ip -m 1 -d "$srcdir/datafile2" -r 2 -c 2 -M tls || true
+
+done # for ip
+
+../dnsperf -s 127.66.66.66 -d "$srcdir/datafile" -vvvv -m tcp -n 1 &
+sleep 2
+pkill -KILL -u `id -u` dnsperf || true
+
+../dnsperf -s 127.66.66.66 -d "$srcdir/datafile" -vvvv -m tls -n 1 &
+sleep 2
+pkill -KILL -u `id -u` dnsperf || true
+
+! echo "invalid" | ../dnsperf -s 127.66.66.66 -m tcp
+! echo "invalid invalid" | ../dnsperf -s 127.66.66.66 -m tcp
+echo "invalid" | ../dnsperf -u -s 127.66.66.66 -m tcp &
+sleep 2
+pkill -KILL -u `id -u` dnsperf || true
+echo "invalid\ninvalid" | ../dnsperf -u -s 127.66.66.66 -m tcp &
+sleep 2
+pkill -KILL -u `id -u` dnsperf || true
+
+! echo "google.com A" \
+ | ../dnsperf -W -s 1.1.1.1 -y tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= \
+ | grep "adding TSIG: invalid owner name"
+echo ".google.com A" | ../dnsperf -W -s 1.1.1.1 \
+ | grep "invalid domain name"
+echo "google.com.. A" | ../dnsperf -W -s 1.1.1.1 \
+ | grep "invalid domain name"
+echo " A" | ../dnsperf -W -s 1.1.1.1 \
+ | grep "invalid query input format"
+echo "toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooolongname" \
+ | ../dnsperf -W -s 1.1.1.1 -u \
+ | grep "Unable to parse domain name"
+echo -e "test\ndelete toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooolongname" \
+ | ../dnsperf -W -s 1.1.1.1 -u \
+ | grep "invalid update command, domain name too large"
diff --git a/src/test/test3.sh b/src/test/test3.sh
new file mode 100755
index 0000000..3c0e44f
--- /dev/null
+++ b/src/test/test3.sh
@@ -0,0 +1,46 @@
+#!/bin/sh -xe
+
+! ../dnsperf -d does_not_exist
+! ../resperf -d does_not_exist
+! ../dnsperf -f invalid
+! ../dnsperf -f any -s 256.256.256.256
+! ../dnsperf -f inet -s 256.256.256.256
+! ../dnsperf -f inet6 -s 256.256.256.256
+! ../dnsperf -a 127.0.0.1 -d does_not_exist
+! ../dnsperf -a ::1 -d does_not_exist
+! ../dnsperf -a 256.256.256.256
+! ../dnsperf -m invalid
+! ../dnsperf -n 43f8huishfs
+! ../dnsperf -p 12345 unexpected argument
+! ../dnsperf -p 65536
+
+! echo "" | ../dnsperf -y test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-md5:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-sha1:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-sha224:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-sha256:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-sha384:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y hmac-sha512:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y invalid:test:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8=
+! echo "" | ../dnsperf -y test:invalid
+! echo "" | ../dnsperf -y test
+echo "" | ../dnsperf -W -y toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooolongname:Ax42vsuHBjQOKlVHO8yU1zGuQ5hjeSz01LXiNze8pb8= \
+ | grep "unable to setup TSIG, name too long"
+echo "" | ../dnsperf -W -y test: | grep "unable to setup TSIG, secret empty"
+
+! ../dnsperf -e -E invalid
+! ../dnsperf -e -E 9999999:invalid
+! ../dnsperf -e -E 123:invalid
+! ../dnsperf -e -E 123:fa0
+../dnsperf -W -E a: | grep "invalid EDNS Option, value is empty"
+../dnsperf -W -E a:a | grep "invalid EDNS Option, value must hex string (even number of characters)"
+../dnsperf -W -E a:aa | grep "invalid EDNS Option code 'a'"
+../dnsperf -W -E 1:xx | grep "invalid EDNS Option hex value 'xx'"
+
+! ../resperf -d does_not_exist
+! ../resperf -r 0 -c 0
+! ../resperf -f invalid
+! ../resperf -q 256000
+! ../resperf -m 123.45 unexpected argument
+! ../resperf -m 123..
+! ../resperf -m 123a
diff --git a/src/test/updatefile b/src/test/updatefile
new file mode 100644
index 0000000..1a61edf
--- /dev/null
+++ b/src/test/updatefile
@@ -0,0 +1,11 @@
+example.com
+require a
+require a A
+require a A 1.2.3.4
+prohibit x
+prohibit x A
+add x 3600 A 10.1.2.3
+delete y A 10.1.2.3
+delete z A
+delete w
+send