<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/tpm2, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-12-03T20:55:27+00:00</updated>
<entry>
<title>selftests: tpm2: Fix ill defined assertions</title>
<updated>2025-12-03T20:55:27+00:00</updated>
<author>
<name>Maurice Hieronymus</name>
<email>mhi@mailbox.org</email>
</author>
<published>2025-11-23T11:18:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cffc934c0d81c9dea3d63cc108e6f925a4bac18e'/>
<id>urn:sha1:cffc934c0d81c9dea3d63cc108e6f925a4bac18e</id>
<content type='text'>
Remove parentheses around assert statements in Python. With parentheses,
assert always evaluates to True, making the checks ineffective.

Signed-off-by: Maurice Hieronymus &lt;mhi@mailbox.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: test_smoke: use POSIX-conformant expression operator</title>
<updated>2025-04-08T20:56:13+00:00</updated>
<author>
<name>Ahmed Salem</name>
<email>x0rw3ll@gmail.com</email>
</author>
<published>2025-02-11T23:16:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=170ec11935de4acced0ae001562cca3a144acd67'/>
<id>urn:sha1:170ec11935de4acced0ae001562cca3a144acd67</id>
<content type='text'>
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 &lt;x0rw3ll@gmail.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: create a dedicated .gitignore</title>
<updated>2025-04-08T20:56:13+00:00</updated>
<author>
<name>Khaled Elnaggar</name>
<email>khaledelnaggarlinux@gmail.com</email>
</author>
<published>2025-01-26T19:51:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5cd2950359ef31c9e273588c33f372ff8e546e2e'/>
<id>urn:sha1:5cd2950359ef31c9e273588c33f372ff8e546e2e</id>
<content type='text'>
The tpm2 selftests produce two logs: SpaceTest.log and
AsyncTest.log. Only SpaceTest.log was listed in selftests/.gitignore,
while AsyncTest.log remained untracked.

This change creates a dedicated .gitignore in the tpm2/ directory to
manage these entries, keeping tpm2-specific patterns isolated from
parent .gitignore.

Fixed white-space errors during commit
Shuah Khan &lt;skhan@linuxfoundation.org&gt;

Link: https://lore.kernel.org/r/20250126195147.902608-1-khaledelnaggarlinux@gmail.com
Signed-off-by: Khaled Elnaggar &lt;khaledelnaggarlinux@gmail.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: test_smoke: Run only when TPM2 is avaialable.</title>
<updated>2024-09-17T15:56:37+00:00</updated>
<author>
<name>Michal Suchanek</name>
<email>msuchanek@suse.de</email>
</author>
<published>2024-08-28T11:23:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=27141f1950b8e40499a7aa95341cd5a37029a097'/>
<id>urn:sha1:27141f1950b8e40499a7aa95341cd5a37029a097</id>
<content type='text'>
Since Linux 5.6 tpm_version_major sysfs file is avaialble which gives
the TPM version.

Using this file the test can be skipped on systems with TPM 1.2.

Signed-off-by: Michal Suchanek &lt;msuchanek@suse.de&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: redirect python unittest logs to stdout</title>
<updated>2024-07-31T17:42:22+00:00</updated>
<author>
<name>Muhammad Usama Anjum</name>
<email>usama.anjum@collabora.com</email>
</author>
<published>2024-07-10T08:15:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=45eb1bf4d726caff8f1dce7ac8f950012d5f64b1'/>
<id>urn:sha1:45eb1bf4d726caff8f1dce7ac8f950012d5f64b1</id>
<content type='text'>
The python unittest module writes all its output to stderr, even when
the run is clean. Redirect its output logs to stdout.

Cc: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Muhammad Usama Anjum &lt;usama.anjum@collabora.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm2: remove redundant ord()</title>
<updated>2023-02-13T16:09:46+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2023-02-03T10:14:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=787fccb321dd6c1c464bb11d952074edbde5de36'/>
<id>urn:sha1:787fccb321dd6c1c464bb11d952074edbde5de36</id>
<content type='text'>
When testing with FLAG_DEBUG enabled client, it emits the following
error messages:

File "/root/tpm2/tpm2.py", line 347, in hex_dump
    d = [format(ord(x), '02x') for x in d]
File "/root/tpm2/tpm2.py", line 347, in &lt;listcomp&gt;
    d = [format(ord(x), '02x') for x in d]
TypeError: ord() expected string of length 1, but int found

The input of hex_dump() should be packed binary data.  Remove the
ord().

Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/tpm2: Split async tests call to separate shell script runner</title>
<updated>2022-11-30T00:28:31+00:00</updated>
<author>
<name>Nícolas F. R. A. Prado</name>
<email>nfraprado@collabora.com</email>
</author>
<published>2022-11-28T22:03:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8008d88e6d160c4e73de5be7c3dcc54e3ccccf49'/>
<id>urn:sha1:8008d88e6d160c4e73de5be7c3dcc54e3ccccf49</id>
<content type='text'>
When the async test case was introduced, despite being a completely
independent test case, the command to run it was added to the same shell
script as the smoke test case. Since a shell script implicitly returns
the error code from the last run command, this effectively caused the
script to only return as error code the result from the async test case,
hiding the smoke test result (which could then only be seen from the
python unittest logs).

Move the async test case call to its own shell script runner to avoid
the aforementioned issue. This also makes the output clearer to read,
since each kselftest KTAP result now matches with one python unittest
report.

While at it, also make it so the async test case is skipped if
/dev/tpmrm0 doesn't exist, since commit 8335adb8f9d3 ("selftests: tpm:
add async space test with noneexisting handle") added a test that relies
on it.

Signed-off-by: Nícolas F. R. A. Prado &lt;nfraprado@collabora.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftest: tpm2: Add Client.__del__() to close /dev/tpm* handle</title>
<updated>2022-10-04T21:25:56+00:00</updated>
<author>
<name>Stefan Berger</name>
<email>stefanb@linux.ibm.com</email>
</author>
<published>2022-09-20T13:15:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2d869f0b458547386fbcd8cf3004b271b7347b7f'/>
<id>urn:sha1:2d869f0b458547386fbcd8cf3004b271b7347b7f</id>
<content type='text'>
The following output can bee seen when the test is executed:

  test_flush_context (tpm2_tests.SpaceTest) ... \
    /usr/lib64/python3.6/unittest/case.py:605: ResourceWarning: \
    unclosed file &lt;_io.FileIO name='/dev/tpmrm0' mode='rb+' closefd=True&gt;

An instance of Client does not implicitly close /dev/tpm* handle, once it
gets destroyed. Close the file handle in the class destructor
Client.__del__().

Fixes: 6ea3dfe1e0732 ("selftests: add TPM 2.0 tests")
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: linux-kselftest@vger.kernel.org
Cc: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/tpm2: increase timeout for kselftests</title>
<updated>2022-06-28T19:31:10+00:00</updated>
<author>
<name>Johannes Holland</name>
<email>johannes.holland@infineon.com</email>
</author>
<published>2022-06-28T14:39:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6b56f5f1ef93ec1b34dee1ef72da33ec046f82be'/>
<id>urn:sha1:6b56f5f1ef93ec1b34dee1ef72da33ec046f82be</id>
<content type='text'>
Due to CreatePrimary commands which need to create RSA keys of
increasing size, the timeout value need to be raised, as well.
Default is 45s.

Fixed git am white space warns:
Shuah Khan &lt;skhan@linuxfoundation.org&gt;

Signed-off-by: Johannes Holland &lt;johannes.holland@infineon.com&gt;
Signed-off-by: Stefan Mahnke-Hartmann &lt;stefan.mahnke-hartmann@infineon.com&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests: tpm: add async space test with noneexisting handle</title>
<updated>2022-03-08T08:33:17+00:00</updated>
<author>
<name>Tadeusz Struk</name>
<email>tstruk@gmail.com</email>
</author>
<published>2022-01-16T01:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8335adb8f9d3ea783422d22883a327427c1dbee8'/>
<id>urn:sha1:8335adb8f9d3ea783422d22883a327427c1dbee8</id>
<content type='text'>
Add a test for /dev/tpmrm0 in async mode that checks if
the code handles invalid handles correctly.

Cc: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: &lt;linux-integrity@vger.kernel.org&gt;
Cc: &lt;linux-kselftest@vger.kernel.org&gt;
Cc: &lt;linux-kernel@vger.kernel.org&gt;
Tested-by: Jarkko Sakkinen&lt;jarkko@kernel.org&gt;
Signed-off-by: Tadeusz Struk &lt;tstruk@gmail.com&gt;
Reviewed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
</content>
</entry>
</feed>
