]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: Remove dependency on `which' command.
authorMaxim Cournoyer <maxim@guixotic.coop>
Fri, 18 Jul 2025 03:05:31 +0000 (12:05 +0900)
committerDaiki Ueno <ueno@gnu.org>
Mon, 28 Jul 2025 04:28:42 +0000 (13:28 +0900)
A POSIX equivalent (command) works just as well.

* tests/pkcs11-tool.sh: Replace 'which' invocations with 'command'.
* tests/tpm2.sh: Likewise.
* tests/tpmtool_test.sh: Likewise.

Signed-off-by: Maxim Cournoyer <maxim@guixotic.coop>
tests/pkcs11-tool.sh
tests/tpm2.sh
tests/tpmtool_test.sh

index 2d650b52f5bed3866c012762a7edaf7d942c4083..e64803fc34ab7316c880972ef1a2cf5efea74959 100755 (executable)
@@ -64,7 +64,7 @@ if ! test -f "${SOFTHSM_MODULE}"; then
        exit 77
 fi
 
-if [ -z "$(which pkcs11-tool 2>/dev/null)" ]; then
+if ! command -v pkcs11-tool >/dev/null; then
        echo "Need pkcs11-tool from opensc package to run this test."
        exit 77
 fi
index de804dbc18380f04212055a0ecda7c84e10e2509..8e147c9d960e086851830224d0ac51b7b11aca86 100755 (executable)
@@ -29,27 +29,27 @@ if ! test -x "${CERTTOOL}"; then
        exit 77
 fi
 
-if [ -z "$(which swtpm 2>/dev/null)" ]; then
+if ! command -v swtpm >/dev/null; then
        echo "Need swtpm package to run this test."
        exit 77
 fi
 
-if [ -z "$(which ncat 2>/dev/null)" ]; then
+if ! command -v ncat >/dev/null; then
        echo "Need ncat from nmap-ncat package to run this test."
        exit 77
 fi
 
-if [ -z "$(which tpm2_startup 2>/dev/null)" ]; then
+if ! command -v tpm2_startup >/dev/null; then
        echo "Need tpm2_startup from tpm2-tools package to run this test."
        exit 77
 fi
 
-if [ -z "$(which base64 2>/dev/null)" ]; then
+if ! command -v base64 >/dev/null; then
        echo "Need the base64 tool to run this test."
        exit 77
 fi
 
-if [ -z "$(which tpm2tss-genkey 2>/dev/null)" ]; then
+if ! command -v tpm2tss-genkey >/dev/null; then
        echo "Need tpm2tss-genkey from tpm2-tss-engine package to run this test."
        exit 77
 fi
index a14242808c06576ea448f45b4e871d79a9b9b6d5..962d571f664d8c250d9a371c07e266b7b80789b4 100755 (executable)
@@ -28,27 +28,27 @@ if [ "$(id -u)" -ne 0 ]; then
        exit 77
 fi
 
-if [ -z "$(which swtpm 2>/dev/null)" ]; then
+if ! command -v swtpm >/dev/null; then
        echo "Need swtpm package to run this test."
        exit 77
 fi
 
-if [ -z "$(which tcsd 2>/dev/null)" ]; then
+if ! command -v tcsd >/dev/null; then
        echo "Need tcsd (TrouSerS) package to run this test."
        exit 77
 fi
 
-if [ -z "$(which tpm_createek 2>/dev/null)" ]; then
+if ! command -v tpm_createek >/dev/null; then
        echo "Need tpm_createek from tpm-tools package to run this test."
        exit 77
 fi
 
-if [ -z "$(which ncat 2>/dev/null)" ]; then
+if ! command -v ncat >/dev/null; then
        echo "Need ncat from nmap-ncat package to run this test."
        exit 77
 fi
 
-if [ -z "$(which expect 2>/dev/null)" ]; then
+if ! command -v expect >/dev/null; then
        echo "Need expect from expect package to run this test."
        exit 77
 fi