Skip to content

Commit

Permalink
selftests: tpm2: test_smoke: use POSIX-conformant expression operator
Browse files Browse the repository at this point in the history
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

Link: https://lore.kernel.org/r/37ztyakgrrtgvec344mg7mspchwjpxxtsprtjidso3pwkmm4f4@awsa5mzgqmtb
Signed-off-by: Ahmed Salem <x0rw3ll@gmail.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Ahmed Salem authored and Shuah Khan committed Apr 8, 2025
1 parent 5cd2950 commit 170ec11
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/tpm2/test_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 170ec11

Please sign in to comment.