tests: Fix newly detected shellcheck issues SC2086 by quoting

Shellcheck v0.9 detected more SC2086 issues.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
diff --git a/tests/_test_getcap b/tests/_test_getcap
index 84249ad..6b76a5b 100755
--- a/tests/_test_getcap
+++ b/tests/_test_getcap
@@ -72,7 +72,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_hashing b/tests/_test_hashing
index 7977cb8..f68a6dd 100755
--- a/tests/_test_hashing
+++ b/tests/_test_hashing
@@ -156,7 +156,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_hashing2 b/tests/_test_hashing2
index bb1cb59..1858b4c 100755
--- a/tests/_test_hashing2
+++ b/tests/_test_hashing2
@@ -187,7 +187,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_init b/tests/_test_init
index e841f4c..b88fef1 100755
--- a/tests/_test_init
+++ b/tests/_test_init
@@ -102,7 +102,7 @@
 	fi
 fi
 
-if ! check_seccomp_profile "${SWTPM_EXE}" ${SWTPM_PID} 0; then
+if ! check_seccomp_profile "${SWTPM_EXE}" "${SWTPM_PID}" 0; then
 	exit 1
 fi
 
@@ -112,7 +112,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_locality b/tests/_test_locality
index 6b38f1d..d27af07 100755
--- a/tests/_test_locality
+++ b/tests/_test_locality
@@ -102,7 +102,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_save_load_encrypted_state b/tests/_test_save_load_encrypted_state
index df92f91..dd2d4b3 100755
--- a/tests/_test_save_load_encrypted_state
+++ b/tests/_test_save_load_encrypted_state
@@ -265,7 +265,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
@@ -339,7 +339,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
@@ -415,7 +415,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_save_load_state b/tests/_test_save_load_state
index 2693c27..af89ee2 100755
--- a/tests/_test_save_load_state
+++ b/tests/_test_save_load_state
@@ -303,7 +303,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_setbuffersize b/tests/_test_setbuffersize
index bd5e688..9815305 100755
--- a/tests/_test_setbuffersize
+++ b/tests/_test_setbuffersize
@@ -92,7 +92,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_swtpm_bios b/tests/_test_swtpm_bios
index 908db58..b56ceba 100755
--- a/tests/_test_swtpm_bios
+++ b/tests/_test_swtpm_bios
@@ -142,7 +142,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_avoid_da_lockout b/tests/_test_tpm2_avoid_da_lockout
index 74ee551..6ee4c64 100755
--- a/tests/_test_tpm2_avoid_da_lockout
+++ b/tests/_test_tpm2_avoid_da_lockout
@@ -117,7 +117,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
@@ -149,7 +149,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_encrypted_state b/tests/_test_tpm2_encrypted_state
index cc3c772..b913e29 100755
--- a/tests/_test_tpm2_encrypted_state
+++ b/tests/_test_tpm2_encrypted_state
@@ -237,7 +237,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_tpm2_getcap b/tests/_test_tpm2_getcap
index 67f4d65..c24b5cf 100755
--- a/tests/_test_tpm2_getcap
+++ b/tests/_test_tpm2_getcap
@@ -72,7 +72,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_hashing3 b/tests/_test_tpm2_hashing3
index 6ff4c43..7c2ed84 100755
--- a/tests/_test_tpm2_hashing3
+++ b/tests/_test_tpm2_hashing3
@@ -113,7 +113,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_init b/tests/_test_tpm2_init
index 8948382..007a65b 100755
--- a/tests/_test_tpm2_init
+++ b/tests/_test_tpm2_init
@@ -86,7 +86,7 @@
 	fi
 fi
 
-if ! check_seccomp_profile "${SWTPM_EXE}" ${SWTPM_PID} 0; then
+if ! check_seccomp_profile "${SWTPM_EXE}" "${SWTPM_PID}" 0; then
 	exit 1
 fi
 
@@ -96,7 +96,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_locality b/tests/_test_tpm2_locality
index 48e6b97..326f450 100755
--- a/tests/_test_tpm2_locality
+++ b/tests/_test_tpm2_locality
@@ -130,7 +130,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_migration_key b/tests/_test_tpm2_migration_key
index 7491880..30be3ae 100755
--- a/tests/_test_tpm2_migration_key
+++ b/tests/_test_tpm2_migration_key
@@ -59,7 +59,7 @@
 	--tpm2 \
 	--migration-key "pwdfile=$migpwdfile,remove=false,kdf=sha512"
 
-if ! kill_quiet -0 $SWTPM_PID; then
+if ! kill_quiet -0 "${SWTPM_PID}"; then
 	echo "Error: ${SWTPM_INTERFACE} TPM did not start."
 	exit 1
 fi
@@ -70,7 +70,7 @@
 	exit 1
 fi
 
-if ! kill_quiet -0 $SWTPM_PID 2>/dev/null; then
+if ! kill_quiet -0 "${SWTPM_PID}" 2>/dev/null; then
 	echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after INIT."
 	exit 1
 fi
@@ -128,7 +128,7 @@
 
 display_processes_by_name "$SWTPM"
 
-if ! kill_quiet -0 $SWTPM_PID; then
+if ! kill_quiet -0 "${SWTPM_PID}"; then
 	echo "Error: ${SWTPM_INTERFACE} TPM did not start."
 	exit 1
 fi
@@ -179,7 +179,7 @@
 
 display_processes_by_name "$SWTPM"
 
-if ! kill_quiet -0 $SWTPM_PID; then
+if ! kill_quiet -0 "${SWTPM_PID}"; then
 	echo "Error: ${SWTPM_INTERFACE} TPM did not start."
 	exit 1
 fi
@@ -224,7 +224,7 @@
 
 display_processes_by_name "$SWTPM"
 
-if ! kill_quiet -0 $SWTPM_PID; then
+if ! kill_quiet -0 "${SWTPM_PID}"; then
 	echo "Error: TPM did not start."
 	cat "$logfile"
 	exit 1
diff --git a/tests/_test_tpm2_probe b/tests/_test_tpm2_probe
index 3947def..cc83cce 100755
--- a/tests/_test_tpm2_probe
+++ b/tests/_test_tpm2_probe
@@ -83,7 +83,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_save_load_encrypted_state b/tests/_test_tpm2_save_load_encrypted_state
index af678c1..580cf00 100755
--- a/tests/_test_tpm2_save_load_encrypted_state
+++ b/tests/_test_tpm2_save_load_encrypted_state
@@ -232,7 +232,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
@@ -304,7 +304,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
@@ -350,7 +350,7 @@
 	exit 1
 fi
 
-if ! wait_process_gone ${SWTPM_PID} 4; then
+if ! wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM not running anymore after failed INIT."
 	echo "TPM Logfile:"
 	cat "$logfile"
@@ -377,7 +377,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_tpm2_save_load_state b/tests/_test_tpm2_save_load_state
index 549d5d7..43c6cdc 100755
--- a/tests/_test_tpm2_save_load_state
+++ b/tests/_test_tpm2_save_load_state
@@ -236,7 +236,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_tpm2_save_load_state_da_timeout b/tests/_test_tpm2_save_load_state_da_timeout
index a74c19a..a07d47e 100755
--- a/tests/_test_tpm2_save_load_state_da_timeout
+++ b/tests/_test_tpm2_save_load_state_da_timeout
@@ -314,7 +314,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	echo "TPM Logfile:"
 	cat "$logfile"
diff --git a/tests/_test_tpm2_savestate b/tests/_test_tpm2_savestate
index 565bdba..12a5af5 100755
--- a/tests/_test_tpm2_savestate
+++ b/tests/_test_tpm2_savestate
@@ -129,7 +129,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_volatilestate b/tests/_test_tpm2_volatilestate
index bbcfa0f..7a85158 100755
--- a/tests/_test_tpm2_volatilestate
+++ b/tests/_test_tpm2_volatilestate
@@ -198,7 +198,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm2_wrongorder b/tests/_test_tpm2_wrongorder
index c41f478..ab241b8 100755
--- a/tests/_test_tpm2_wrongorder
+++ b/tests/_test_tpm2_wrongorder
@@ -99,7 +99,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_tpm_probe b/tests/_test_tpm_probe
index 7de5ac5..f8af209 100755
--- a/tests/_test_tpm_probe
+++ b/tests/_test_tpm_probe
@@ -35,7 +35,7 @@
 
 display_processes_by_name "$SWTPM"
 
-if ! kill -0 ${SWTPM_PID}; then
+if ! kill -0 "${SWTPM_PID}"; then
 	echo "Error: ${SWTPM_INTERFACE} TPM did not start."
 	exit 1
 fi
@@ -72,7 +72,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_volatilestate b/tests/_test_volatilestate
index fa892d0..55f5eac 100755
--- a/tests/_test_volatilestate
+++ b/tests/_test_volatilestate
@@ -197,7 +197,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/_test_wrongorder b/tests/_test_wrongorder
index 569d142..6d77cd2 100755
--- a/tests/_test_wrongorder
+++ b/tests/_test_wrongorder
@@ -93,7 +93,7 @@
 	exit 1
 fi
 
-if wait_process_gone ${SWTPM_PID} 4; then
+if wait_process_gone "${SWTPM_PID}" 4; then
 	echo "Error: ${SWTPM_INTERFACE} TPM should not be running anymore."
 	exit 1
 fi
diff --git a/tests/test_tpm2_save_load_state_3 b/tests/test_tpm2_save_load_state_3
index d7b91f5..1824a51 100755
--- a/tests/test_tpm2_save_load_state_3
+++ b/tests/test_tpm2_save_load_state_3
@@ -15,7 +15,7 @@
 		exit 77
 	fi
 fi
-TOOLSPATH=$(dirname "$(type -P ${PREFIX}startup)")
+TOOLSPATH=$(dirname "$(type -P "${PREFIX}startup")")
 
 ROOT=${abs_top_builddir:-$(dirname "$0")/..}
 TESTDIR=${abs_top_testdir:-$(dirname "$0")}
diff --git a/tests/test_tpm2_swtpm_localca b/tests/test_tpm2_swtpm_localca
index c71dd3b..2fc89c0 100755
--- a/tests/test_tpm2_swtpm_localca
+++ b/tests/test_tpm2_swtpm_localca
@@ -127,7 +127,7 @@
 
   if ! ${CERTTOOL} \
     --verify \
-    ${verify_profile} \
+    ${verify_profile:+${verify_profile}} \
     --load-ca-certificate "${ISSUERCERT}" \
     --infile "${workdir}/ek.pem"; then
     echo "Error: Could not verify certificate chain."
diff --git a/tests/test_tpm2_swtpm_localca_pkcs11.test b/tests/test_tpm2_swtpm_localca_pkcs11.test
index 87016ed..71c6a58 100755
--- a/tests/test_tpm2_swtpm_localca_pkcs11.test
+++ b/tests/test_tpm2_swtpm_localca_pkcs11.test
@@ -206,7 +206,7 @@
 
   if ! GNUTLS_PIN=${PIN} ${CERTTOOL} \
     --verify \
-    ${verify_profile} \
+    ${verify_profile:+${verify_profile}} \
     --load-ca-certificate "${ISSUERCERT}" \
     --infile "${workdir}/ek.pem"; then
     echo "Error: Could not verify certificate chain."
diff --git a/tests/test_tpm2_vtpm_proxy b/tests/test_tpm2_vtpm_proxy
index 87539ce..33b93b4 100755
--- a/tests/test_tpm2_vtpm_proxy
+++ b/tests/test_tpm2_vtpm_proxy
@@ -24,7 +24,7 @@
 
 function cleanup()
 {
-	pid=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
+	pid=$(ps aux | grep "$SWTPM" | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
 	if [ -n "$pid" ]; then
 		kill_quiet -9 "$pid"
 	fi
diff --git a/tests/test_vtpm_proxy b/tests/test_vtpm_proxy
index 734ed5f..d98d539 100755
--- a/tests/test_vtpm_proxy
+++ b/tests/test_vtpm_proxy
@@ -24,7 +24,7 @@
 
 function cleanup()
 {
-	pid=$(ps aux | grep $SWTPM | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
+	pid=$(ps aux | grep "$SWTPM" | grep -E " file=${PID_FILE}\$" | gawk '{print $2}')
 	if [ -n "$pid" ]; then
 		kill_quiet -9 "$pid"
 	fi