git » dnss » commit 5a08a71

tests: Fix shell quoting in the test scripts

author Alberto Bertogli
2024-11-17 10:52:25 UTC
committer Alberto Bertogli
2024-11-17 10:58:17 UTC
parent 4460481795c22d72ee08e73e150e19cfb5d31dbb

tests: Fix shell quoting in the test scripts

This patch fixes some shell quoting issues in the test scripts, found by
shellcheck.

tests/all.sh +1 -1
tests/coverage.sh +2 -2
tests/external.sh +4 -4

diff --git a/tests/all.sh b/tests/all.sh
index fcde331..0e3cd3c 100755
--- a/tests/all.sh
+++ b/tests/all.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 # The tests are run from the repository root.
-cd "$(realpath `dirname ${0}`)/../"
+cd "$(realpath "$(dirname "$0")/../" )"
 
 set -ev
 
diff --git a/tests/coverage.sh b/tests/coverage.sh
index 645b96c..af78223 100755
--- a/tests/coverage.sh
+++ b/tests/coverage.sh
@@ -6,7 +6,7 @@
 set -e
 
 # The tests are run from the repository root.
-cd "$(realpath `dirname ${0}`)/../"
+cd "$(realpath "$(dirname "$0")/../" )"
 
 # Recreate the coverage output directory, to avoid including stale results
 # from previous runs.
@@ -19,7 +19,7 @@ go test \
 	-covermode=count \
 	-coverpkg=./... \
 	./... \
-	-args -test.gocoverdir=${COVER_DIR}/go/
+	-args -test.gocoverdir="${COVER_DIR}/go/"
 
 # Run external tests in coverage mode. They will run in coverage mode due to
 # $GOCOVERDIR being set.
diff --git a/tests/external.sh b/tests/external.sh
index ae23969..1e87c59 100755
--- a/tests/external.sh
+++ b/tests/external.sh
@@ -18,7 +18,7 @@ trap "exit 2" INT  # Ctrl-C, make sure we fail in that case.
 trap "kill 0" EXIT # Kill children on exit.
 
 # The tests are run from the repository root.
-cd "$(realpath `dirname ${0}`)/../"
+cd "$(realpath "$(dirname "$0")/../" )"
 
 # Build the dnss binary.
 if [ "${GOCOVERDIR}" != "" ]; then
@@ -118,11 +118,11 @@ function get() {
 }
 
 function generate_certs() {
-	mkdir -p .certs/$1
+	mkdir -p ".certs/$1"
 	(
-		cd .certs/$1
+		cd ".certs/$1"
 		go run ../../tests/generate_cert.go \
-			-ca -duration=1h --host=$1
+			-ca -duration=1h --host="$1"
 	)
 }