linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: tpm2: test_smoke: use POSIX-conformant expression operator
@ 2025-02-10 17:03 Ahmed Salem
  2025-02-10 17:35 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmed Salem @ 2025-02-10 17:03 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg, shuah, skhan
  Cc: linux-integrity, linux-kselftest, linux-kernel

test_smoke.sh:9: expression uses non POSIX-conformant operator
symbol '==', resulting in skipping the remaining tests.

This patch ensures the use of POSIX-conformant operator symbol '='.

w/o this patch for test_smoke.sh
================================
$ sudo make -j8 TARGETS=tpm2 kselftest
make[3]: Nothing to be done for 'all'.
TAP version 13
1..3
 # timeout set to 600
 # selftests: tpm2: test_smoke.sh
 # ./test_smoke.sh: 9: [: 2: unexpected operator
ok 1 selftests: tpm2: test_smoke.sh # SKIP
 # timeout set to 600
 # selftests: tpm2: test_space.sh
 # test_flush_context (tpm2_tests.SpaceTest.test_flush_context) ... ok
 # test_get_handles (tpm2_tests.SpaceTest.test_get_handles) ... ok
 # test_invalid_cc (tpm2_tests.SpaceTest.test_invalid_cc) ... ok
 # test_make_two_spaces (tpm2_tests.SpaceTest.test_make_two_spaces) ... ok
 #
 # ----------------------------------------------------------------------
 # Ran 4 tests in 8.647s
 #
 # OK
ok 2 selftests: tpm2: test_space.sh
 # timeout set to 600
 # selftests: tpm2: test_async.sh
 # test_async (tpm2_tests.AsyncTest.test_async) ... ok
 # test_flush_invalid_context (tpm2_tests.AsyncTest.test_flush_invalid_context) ... ok
 #
 # ----------------------------------------------------------------------
 # Ran 2 tests in 0.005s
 #
 # OK
ok 3 selftests: tpm2: test_async.sh

with this patch for test_smoke.sh
=================================
$ sudo make -j8 TARGETS=tpm2 kselftest
make[3]: Nothing to be done for 'all'.
TAP version 13
1..3
 # timeout set to 600
 # selftests: tpm2: test_smoke.sh
 # test_read_partial_overwrite (tpm2_tests.SmokeTest.test_read_partial_overwrite) ... ok
 # test_read_partial_resp (tpm2_tests.SmokeTest.test_read_partial_resp) ... ok
 # test_seal_with_auth (tpm2_tests.SmokeTest.test_seal_with_auth) ... ok
 # test_seal_with_policy (tpm2_tests.SmokeTest.test_seal_with_policy) ... ok
 # test_seal_with_too_long_auth (tpm2_tests.SmokeTest.test_seal_with_too_long_auth) ... ok
 # test_send_two_cmds (tpm2_tests.SmokeTest.test_send_two_cmds) ... ok
 # test_too_short_cmd (tpm2_tests.SmokeTest.test_too_short_cmd) ... ok
 # test_unseal_with_wrong_auth (tpm2_tests.SmokeTest.test_unseal_with_wrong_auth) ... ok
 # test_unseal_with_wrong_policy (tpm2_tests.SmokeTest.test_unseal_with_wrong_policy) ... ok
 #
 # ----------------------------------------------------------------------
 # Ran 9 tests in 9.278s
 #
 # OK
ok 1 selftests: tpm2: test_smoke.sh
 # timeout set to 600
 # selftests: tpm2: test_space.sh
 # test_flush_context (tpm2_tests.SpaceTest.test_flush_context) ... ok
 # test_get_handles (tpm2_tests.SpaceTest.test_get_handles) ... ok
 # test_invalid_cc (tpm2_tests.SpaceTest.test_invalid_cc) ... ok
 # test_make_two_spaces (tpm2_tests.SpaceTest.test_make_two_spaces) ... ok
 #
 # ----------------------------------------------------------------------
 # Ran 4 tests in 8.701s
 #
 # OK
ok 2 selftests: tpm2: test_space.sh
 # timeout set to 600
 # selftests: tpm2: test_async.sh
 # test_async (tpm2_tests.AsyncTest.test_async) ... ok
 # test_flush_invalid_context (tpm2_tests.AsyncTest.test_flush_invalid_context) ... ok
 #
 # ----------------------------------------------------------------------
 # Ran 2 tests in 0.004s
 #
 # OK
ok 3 selftests: tpm2: test_async.sh

Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
---
 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
-- 
2.47.2


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

* Re: [PATCH] selftests: tpm2: test_smoke: use POSIX-conformant expression operator
  2025-02-10 17:03 [PATCH] selftests: tpm2: test_smoke: use POSIX-conformant expression operator Ahmed Salem
@ 2025-02-10 17:35 ` Jarkko Sakkinen
  2025-02-11  0:56   ` [PATCH v2] " Ahmed Salem
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2025-02-10 17:35 UTC (permalink / raw)
  To: Ahmed Salem, peterhuewe, jgg, shuah, skhan
  Cc: linux-integrity, linux-kselftest, linux-kernel

On Mon Feb 10, 2025 at 7:03 PM EET, Ahmed Salem wrote:
> test_smoke.sh:9: expression uses non POSIX-conformant operator
> symbol '==', resulting in skipping the remaining tests.
>
> This patch ensures the use of POSIX-conformant operator symbol '='.
>
> w/o this patch for test_smoke.sh
> ================================
> $ sudo make -j8 TARGETS=tpm2 kselftest
> make[3]: Nothing to be done for 'all'.
> TAP version 13
> 1..3
>  # timeout set to 600
>  # selftests: tpm2: test_smoke.sh
>  # ./test_smoke.sh: 9: [: 2: unexpected operator
> ok 1 selftests: tpm2: test_smoke.sh # SKIP

The fix is fine but cut out snippets of transcripts pinpointing
the issue.

BR, Jarkko

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

* [PATCH v2] selftests: tpm2: test_smoke: use POSIX-conformant expression operator
  2025-02-10 17:35 ` Jarkko Sakkinen
@ 2025-02-11  0:56   ` Ahmed Salem
  0 siblings, 0 replies; 3+ messages in thread
From: Ahmed Salem @ 2025-02-11  0:56 UTC (permalink / raw)
  To: peterhuewe, jarkko, jgg, shuah, skhan
  Cc: linux-integrity, linux-kselftest, linux-kernel,
	linux-kernel-mentees

Use POSIX-conformant operator symbol '=='.

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

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
-- 
2.47.2


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 17:03 [PATCH] selftests: tpm2: test_smoke: use POSIX-conformant expression operator Ahmed Salem
2025-02-10 17:35 ` Jarkko Sakkinen
2025-02-11  0:56   ` [PATCH v2] " Ahmed Salem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).