commit 99ccc1d89efe078731fd59175a9eded8df280ca4
parent d9b167f652fbe480a7d72d364c357e433772e5d8
Author: ng0 <ng0@n0.is>
Date: Thu, 7 Mar 2019 16:57:40 +0000
test/: change a couple of bashisms.
Diffstat:
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/ascension/test/test_ascension_simple.sh b/ascension/test/test_ascension_simple.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright (C) 2019 rexxnor
# License AGPLv3+: GNU AGPL version 3 or later <https://www.gnu.org/licenses/agpl.html>
# This is free software: you are free to change and redistribute it.
@@ -10,7 +10,7 @@
# Shutdown named
-function cleanup {
+cleanup() {
pkill named
gnunet-identity -D gnunet
gnunet-identity -D org
@@ -47,7 +47,7 @@ if [ "$?" -ne 0 ]; then
exit 1
fi
-function checkfailexp {
+checkfailexp() {
if [ "$?" -ne 0 ]; then
echo "required record not present"
cleanup
@@ -55,7 +55,7 @@ function checkfailexp {
fi
}
-function checkfailimp {
+checkfailimp() {
if [ "$?" -ne 0 ]; then
echo "implied record not present"
cleanup
diff --git a/ascension/test/test_namestore_multiple.sh b/ascension/test/test_namestore_multiple.sh
@@ -10,19 +10,19 @@ MYEGO=myego
gnunet-identity -C myego
# HELPERS
-function get_record_type {
+get_record_type() {
arr=$1
typ=$(echo -n "${arr[0]}" | cut -d' ' -f2)
echo "$typ"
}
-function get_value {
+get_value() {
arr=$1
val=$(echo -n "${arr[0]}" | cut -d' ' -f4-)
echo "$val"
}
-function testing {
+testing() {
label=$1
records=$2
recordstring=""
@@ -50,43 +50,43 @@ function testing {
# TEST CASES
# 1
echo "Testing adding of single A record with -R"
-declare -a arr=('1200 A n 127.0.0.1')
+local arr=('1200 A n 127.0.0.1')
testing test1 "${arr[@]}"
# 2
echo "Testing adding of multiple A records with -R"
-declare -a arr=('1200 A n 127.0.0.1' '2400 A n 127.0.0.2')
+local arr=('1200 A n 127.0.0.1' '2400 A n 127.0.0.2')
testing test2 "${arr[@]}"
# 3
echo "Testing adding of multiple different records with -R"
-declare -a arr=('1200 A n 127.0.0.1' '2400 AAAA n 2002::')
+local arr=('1200 A n 127.0.0.1' '2400 AAAA n 2002::')
testing test3 "${arr[@]}"
# 4
echo "Testing adding of single GNS2DNS record with -R"
-declare -a arr=('86400 GNS2DNS n gnu.org@127.0.0.1')
+local arr=('86400 GNS2DNS n gnu.org@127.0.0.1')
testing test4 "${arr[@]}"
# 5
echo "Testing adding of single GNS2DNS shadow record with -R"
-declare -a arr=('86409 GNS2DNS s gnu.org@127.0.0.250')
+local arr=('86409 GNS2DNS s gnu.org@127.0.0.250')
testing test5 "${arr[@]}"
# 6
echo "Testing adding of multiple GNS2DNS record with -R"
-declare -a arr=('1 GNS2DNS n gnunet.org@127.0.0.1' '3600 GNS2DNS s gnunet.org@127.0.0.2')
+local arr=('1 GNS2DNS n gnunet.org@127.0.0.1' '3600 GNS2DNS s gnunet.org@127.0.0.2')
testing test6 "${arr[@]}"
# 7
echo "Testing adding MX record with -R"
-declare -a arr=('3600 MX n 10,mail')
+local arr=('3600 MX n 10,mail')
testing test7 "${arr[@]}"
# 8
echo "Testing adding TXT record with -R"
-declare -a arr=('3600 TXT n Pretty_Unicorns')
+local arr=('3600 TXT n Pretty_Unicorns')
testing test8 "${arr[@]}"
# 8
echo "Testing adding SRV record with -R"
-declare -a arr=('3600 SRV n 0 0 443 testing')
+local arr=('3600 SRV n 0 0 443 testing')
testing _autodiscover_old._tcp "${arr[@]}"
# 9
echo "Testing adding many A records with -R"
-declare -a arr=('3600 A n 127.0.0.1' '3600 A n 127.0.0.2' '3600 A n 127.0.0.3' '3600 A n 127.0.0.4' '3600 A n 127.0.0.5')
+local arr=('3600 A n 127.0.0.1' '3600 A n 127.0.0.2' '3600 A n 127.0.0.3' '3600 A n 127.0.0.4' '3600 A n 127.0.0.5')
testing test9 "${arr[@]}"
# CLEANUP