lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <zdfnlpdb24tk6aikzucyomylf4lqdyhdvlingwyku46fy75eyg@giq5dqojdxj5>
Date: Mon, 10 Feb 2025 19:03:43 +0200
From: Ahmed Salem <x0rw3ll@...il.com>
To: peterhuewe@....de, jarkko@...nel.org, jgg@...pe.ca, shuah@...nel.org, 
	skhan@...uxfoundation.org
Cc: linux-integrity@...r.kernel.org, linux-kselftest@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: [PATCH] selftests: tpm2: test_smoke: use POSIX-conformant expression
 operator

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@...il.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ