public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH v4] selftests: tpm2: test_smoke: use POSIX-conformant expression operator
@ 2025-02-11 23:16 Ahmed Salem
  2025-02-11 23:26 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmed Salem @ 2025-02-11 23:16 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg, shuah, skhan
  Cc: linux-integrity, linux-kselftest, linux-kernel,
	linux-kernel-mentees

Use POSIX-conformant expression operator symbol '='.

The use of the non POSIX-conformant symbol '==' would work 
in bash, but not in sh where the unexpected operator error 
would result in test_smoke.sh being skipped.

Instead of changing the shebang to use bash, which may not be 
available on all systems, use the POSIX-conformant expression 
symbol '=' to test for equality.

Without this patch:
===================
 # make -j8 TARGETS=tpm2 kselftest
 # selftests: tpm2: test_smoke.sh
 # ./test_smoke.sh: 9: [: 2: unexpected operator
 ok 1 selftests: tpm2: test_smoke.sh # SKIP

With this patch:
================
 # make -j8 TARGETS=tpm2 kselftest
 # selftests: tpm2: test_smoke.sh
 # Ran 9 tests in 9.236s
 ok 1 selftests: tpm2: test_smoke.sh

Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
---

Changes in v4:
 - Include relevant parts of the script showing 
   the issue before and after the patch

Changes in v3:
 - Reword mistaken commit message

Changes in v2:
 - Remove snippets pinpointing the issue
   from commit message

 tools/testing/selftests/tpm2/test_smoke.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/tpm2/test_smoke.sh b/tools/testing/selftests/tpm2/test_smoke.sh
index 168f4b166234..3a60e6c6f5c9 100755
--- a/tools/testing/selftests/tpm2/test_smoke.sh
+++ b/tools/testing/selftests/tpm2/test_smoke.sh
@@ -6,6 +6,6 @@ ksft_skip=4
 
 [ -e /dev/tpm0 ] || exit $ksft_skip
 read tpm_version < /sys/class/tpm/tpm0/tpm_version_major
-[ "$tpm_version" == 2 ] || exit $ksft_skip
+[ "$tpm_version" = 2 ] || exit $ksft_skip
 
 python3 -m unittest -v tpm2_tests.SmokeTest 2>&1

base-commit: 34c26c5e1cb0cc7f54c1b89c6e9168cad8ffb580
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-11 23:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 23:16 [PATCH v4] selftests: tpm2: test_smoke: use POSIX-conformant expression operator Ahmed Salem
2025-02-11 23:26 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox