summaryrefslogtreecommitdiffstats
path: root/bin/tests/system/tools/tests.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/tests/system/tools/tests.sh118
1 files changed, 78 insertions, 40 deletions
diff --git a/bin/tests/system/tools/tests.sh b/bin/tests/system/tools/tests.sh
index a7113cb..835c325 100644
--- a/bin/tests/system/tools/tests.sh
+++ b/bin/tests/system/tools/tests.sh
@@ -16,33 +16,42 @@
status=0
checkout() {
- rc=$1
- case $rc in
- 0) : ok ;;
- *) echo_i "failed"
- status=$((status + 1))
- return 1 ;;
- esac
- case $out in
- *$hash*) : ok ;;
- *) echo_i "expect $hash"
- echo_i "output $out"
- echo_i "failed"
- status=$((status + 1)) ;;
- esac
+ rc=$1
+ case $rc in
+ 0) : ok ;;
+ *)
+ echo_i "failed"
+ status=$((status + 1))
+ return 1
+ ;;
+ esac
+ case $out in
+ *$hash*) : ok ;;
+ *)
+ echo_i "expect $hash"
+ echo_i "output $out"
+ echo_i "failed"
+ status=$((status + 1))
+ ;;
+ esac
}
# test cases taken from RFC 5155 appendix A
algo=1 flags=0 iters=12 salt="aabbccdd"
-while read name hash
-do
- echo_i "checking $NSEC3HASH $name"
- { out=$($NSEC3HASH $salt $algo $iters $name); rc=$?; } || true
- checkout $rc
+while read name hash; do
+ echo_i "checking $NSEC3HASH $name"
+ {
+ out=$($NSEC3HASH $salt $algo $iters $name)
+ rc=$?
+ } || true
+ checkout $rc
- echo_i "checking $NSEC3HASH -r $name"
- { out=$($NSEC3HASH -r $algo $flags $iters $salt $name); rc=$?; } || true
- checkout $rc
+ echo_i "checking $NSEC3HASH -r $name"
+ {
+ out=$($NSEC3HASH -r $algo $flags $iters $salt $name)
+ rc=$?
+ } || true
+ checkout $rc
done <<EOF
*.w.example R53BQ7CC2UVMUBFU5OCMM6PERS9TK9EN
@@ -61,46 +70,75 @@ EOF
# test empty salt
checkempty() {
- rc=$1
- hash=CK0POJMG874LJREF7EFN8430QVIT8BSM checkout $rc &&
- hash=- checkout $rc
+ rc=$1
+ hash=CK0POJMG874LJREF7EFN8430QVIT8BSM checkout $rc \
+ && hash=- checkout $rc
}
name=com algo=1 flags=1 iters=0
echo_i "checking $NSEC3HASH '' $name"
-{ out=$($NSEC3HASH '' $algo $iters $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH '' $algo $iters $name)
+ rc=$?
+} || true
checkempty $rc
echo_i "checking $NSEC3HASH - $name"
-{ out=$($NSEC3HASH - $algo $iters $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH - $algo $iters $name)
+ rc=$?
+} || true
checkempty $rc
echo_i "checking $NSEC3HASH -- '' $name"
-{ out=$($NSEC3HASH -- '' $algo $iters $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH -- '' $algo $iters $name)
+ rc=$?
+} || true
checkempty $rc
echo_i "checking $NSEC3HASH -- - $name"
-{ out=$($NSEC3HASH -- - $algo $iters $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH -- - $algo $iters $name)
+ rc=$?
+} || true
checkempty $rc
echo_i "checking $NSEC3HASH -r '' $name"
-{ out=$($NSEC3HASH -r $algo $flags $iters '' $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH -r $algo $flags $iters '' $name)
+ rc=$?
+} || true
checkempty $rc
echo_i "checking $NSEC3HASH -r - $name"
-{ out=$($NSEC3HASH -r $algo $flags $iters - $name); rc=$?; } || true
+{
+ out=$($NSEC3HASH -r $algo $flags $iters - $name)
+ rc=$?
+} || true
checkempty $rc
checkfail() {
- rc=$1
- case $rc in
- 0) echo_i "failed to fail"
- status=$((status + 1))
- return 1 ;;
- esac
+ rc=$1
+ case $rc in
+ 0)
+ echo_i "failed to fail"
+ status=$((status + 1))
+ return 1
+ ;;
+ esac
}
echo_i "checking $NSEC3HASH missing args"
-{ out=$($NSEC3HASH 00 1 0 2>&1); rc=$?; } || true
+{
+ out=$($NSEC3HASH 00 1 0 2>&1)
+ rc=$?
+} || true
checkfail $rc
echo_i "checking $NSEC3HASH extra args"
-{ out=$($NSEC3HASH 00 1 0 two names 2>&1); rc=$?; } || true
+{
+ out=$($NSEC3HASH 00 1 0 two names 2>&1)
+ rc=$?
+} || true
checkfail $rc
echo_i "checking $NSEC3HASH bad option"
-{ out=$($NSEC3HASH -? 2>&1); rc=$?; } || true
+{
+ out=$($NSEC3HASH -? 2>&1)
+ rc=$?
+} || true
checkfail $rc
echo_i "exit status: $status"