aboutsummaryrefslogtreecommitdiff
path: root/src/test-resolv.sh
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-07-19 12:30:35 +1000
committerDavid Timber <mieabby@gmail.com>2021-07-19 12:30:35 +1000
commita9dfe7f6055de66742f389d13adbb71101f9c8c0 (patch)
tree159e14cb760382e1904572ea6d88088e7bcd7b79 /src/test-resolv.sh
parent5c70a63e02ae26bdfae14444d91f5f96bf74f505 (diff)
Fix resolv ...
* Fix mbedtls_ssl_read() is not called repeatedly until no data is returned * Impl exit code of proone-resolv * Add test for resolv
Diffstat (limited to 'src/test-resolv.sh')
-rwxr-xr-xsrc/test-resolv.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test-resolv.sh b/src/test-resolv.sh
new file mode 100755
index 0000000..c10d305
--- /dev/null
+++ b/src/test-resolv.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+assert_ec () {
+ echo -n "$3: " >&2
+ if [ $1 -ne $2 ]; then
+ echo "FAIL (expected=$2, returned=$1)" >&2
+ exit 1
+ else
+ echo "OK" >&2
+ fi
+}
+SUBJECT_EXEC="./proone-resolv"
+
+echo "a example.com" | "$SUBJECT_EXEC"
+assert_ec $? 0 "Single NOERROR execution"
+
+echo "a example.test" | "$SUBJECT_EXEC"
+assert_ec $? 0 "Single NXDOMAIN execution"
+
+cat << EOF | "$SUBJECT_EXEC"
+; Queue more than RESOLV_PIPELINE_SIZE(4)
+a example.com
+aaaa example.com
+a www.example.com
+aaaa www.example.com
+txt kernel.org
+a www.google.com
+aaaa www.google.com
+txt example.com
+a www.kernel.org
+aaaa www.kernel.org
+EOF
+assert_ec $? 0 "Queue congestion"
+
+cat << EOF | "$SUBJECT_EXEC"
+aaaa example.com
+txt example.test
+EOF
+assert_ec $? 0 "Mixed result"