swtpm/tests
Stefan Berger f42746acb3
Some checks failed
Coverity Scan / coverity (push) Has been cancelled
tests: Extend test case to test for concurrent access to locked storage
Extend an existing test case to ensure that a 2nd swtpm process terminates
with an error related to not being able to get a lock on the storage's
lockfile.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2025-08-18 14:27:57 -04:00
..
data tests: Add test case for testing profiles across libtpms versions 2024-07-22 09:46:58 -04:00
patches tests: Update IBMTSS2 test suite to v2.4.0 2024-10-24 18:20:01 -04:00
_test_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_getcap tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_hashing tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_hashing2 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_init tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_locality tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_migration_key tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_migration_key_2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
_test_print_capabilities swtpm: Add option for storage backend to use fsync 2025-05-27 16:28:39 -04:00
_test_print_states tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_resume_volatile tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_save_load_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_save_load_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_setbuffersize tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_swtpm_bios tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_avoid_da_lockout tests: Retry NVWrite command after 0x922 return code and inc lockout counter 2025-05-12 18:46:28 -04:00
_test_tpm2_derived_keys tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_encrypted_state tests: Extend existing test case to use the new fsync option 2025-05-27 16:28:39 -04:00
_test_tpm2_file_permissions tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_getcap tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing2 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_hashing3 tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_init tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_locality tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_migration_key tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_print_capabilities swtpm: Add option for storage backend to use fsync 2025-05-27 16:28:39 -04:00
_test_tpm2_print_states tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_probe tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_resume_volatile tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_encrypted_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state_da_timeout tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_save_load_state_locking tests: Extend test case to test for concurrent access to locked storage 2025-08-18 14:27:57 -04:00
_test_tpm2_savestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_setbuffersize tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_swtpm_bios tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_volatilestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm2_wrongorder tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_tpm_probe tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_volatilestate tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
_test_wrongorder tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
common tests: Extend test case to test for concurrent access to locked storage 2025-08-18 14:27:57 -04:00
create_certs.sh scripting: Use #!/usr/bin/env bash rather than /bin/bash 2018-09-10 16:49:12 +00:00
fileinstall test: Wrap install -D in fileinstall 2024-09-13 16:02:58 -04:00
installed-runner.sh tests: drop the need to set INSTALLED=1 when running tests 2024-07-15 10:38:38 -04:00
load_vtpm_proxy tests: Fix shellcheck issue SC2148 by adding a shell directive 2023-01-30 18:25:45 -05:00
Makefile.am swtpm_setup: Add support for --profile-name option 2024-10-02 09:35:17 -04:00
Readme.md tests: Enable SWTPM_TEST_PROFILE for running test_tpm2_ibmtss2 with profile 2024-10-02 18:20:18 -04:00
sed-inplace tests: Use proper command line options on GNU/Hurd systems 2025-04-28 20:38:14 -04:00
softhsm_setup tests: Add softhsm_setup to shellcheck'ed files and fix issues 2023-11-22 07:16:44 -05:00
swtpm_setup.conf treewide: remove executable bit from config files and c-code 2018-01-17 10:45:25 -05:00
test_clientfds.py swtpm: Implement CMD_LOCK_STORAGE to lock storage 2022-09-06 14:08:45 -04:00
test_commandline tests: Remove SWTPM variable and usage 2024-08-26 20:00:14 -04:00
test_common tests: Fix shellcheck issue SC2148 by adding a shell directive 2023-01-30 18:25:45 -05:00
test_config.in build: remove hardcoded tss user and group 2015-11-02 20:47:37 -05:00
test_ctrlchannel tests: Fix 2 cases of shellcheck SC2001 using bash search-replace 2023-01-30 18:25:45 -05:00
test_ctrlchannel2 tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_ctrlchannel3 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_ctrlchannel4 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_cuse tests: Derive support for CUSE from SWTPM_EXE help screen 2024-08-26 20:00:14 -04:00
test_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_getcap tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_hashing tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_hashing2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_init tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_locality tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_migration_key tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_parameters tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_print_capabilities tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_print_states tests: Add test cases for using swtpm --print-states while swtpm is running 2024-06-11 08:43:01 -04:00
test_resume_volatile tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_samples_create_tpmca tests: Convert test_samples_create_tpmca to run installed 2024-09-13 16:02:58 -04:00
test_save_load_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_save_load_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_setbuffersize tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_setdatafd.py tests: Replicate test_ctrlchannel3 for TPM 2 to test_tpm2_ctrlchannel3 2022-09-22 13:27:38 -04:00
test_swtpm_bios tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_swtpm_cert tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_swtpm_setup_create_cert tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_swtpm_setup_file_backend tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_swtpm_setup_misc tests: Rearrange order of test cases to run some also as 'root' 2024-03-19 14:28:01 -04:00
test_swtpm_setup_overwrite tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_tpm2_avoid_da_lockout tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_chroot_chardev tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_chroot_cuse tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_chroot_socket swtpm: Check for good entropy source in chroot environment 2024-09-19 16:54:28 -04:00
test_tpm2_ctrlchannel2 tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_ctrlchannel3 tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_tpm2_derived_keys tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_file_permissions tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_getcap tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing2 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_hashing3 tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_ibmtss2 tests: Do not patch for OpenSSL 3.x anymore since bug seems fixed 2025-05-09 13:17:39 -04:00
test_tpm2_init tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_libtpms_versions_profiles tests: Skip test_tpm2_libtpms_versions_profiles if not run from git checkout 2024-08-26 20:00:14 -04:00
test_tpm2_locality tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_migration_key tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_parameters tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_partial_reads tests: source common under ${TESTDIR} 2024-08-27 07:49:10 -04:00
test_tpm2_print_capabilities tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_print_states tests: Add test cases for using swtpm --print-states while swtpm is running 2024-06-11 08:43:01 -04:00
test_tpm2_probe tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_resume_volatile tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_samples_create_tpmca.test sample: Enable passing usual curve names secp256r1 or secp384r1 2025-04-01 12:50:34 -04:00
test_tpm2_save_load_encrypted_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state_2 swtpm: nvstore_linear: Add support for file-backend locking 2024-10-15 10:49:01 -04:00
test_tpm2_save_load_state_2_block tests: Fix 3 occurrences of stray '\' before '-' 2024-06-10 19:40:31 -04:00
test_tpm2_save_load_state_2_linear tests: Fix code to pass shellcheck with some errors disabled 2023-01-13 13:59:02 -05:00
test_tpm2_save_load_state_3 tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_save_load_state_da_timeout tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_save_load_state_locking tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_savestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_setbuffersize tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_swtpm_bios tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_swtpm_cert tests: Use ${CERTTOOL} rather than certtool (OS X) 2024-10-13 19:46:15 -04:00
test_tpm2_swtpm_cert_ecc tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_tpm2_swtpm_localca tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_tpm2_swtpm_localca_pkcs11.test tests: teach them to run installed 2024-07-15 10:38:38 -04:00
test_tpm2_swtpm_setup_create_cert tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_swtpm_setup_overwrite tests: use swtpm_setup.conf from tests 2024-07-15 10:38:38 -04:00
test_tpm2_swtpm_setup_profile tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_swtpm_setup_profile_name tests: Extend test cases with RSA-4096 and default-v2 testing 2025-08-05 18:05:08 -04:00
test_tpm2_volatilestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm2_vtpm_proxy tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_tpm2_wrongorder tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_tpm12 tests: fix installed test-tpm12 2024-08-27 07:49:10 -04:00
test_tpm_probe tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_volatilestate tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00
test_vtpm_proxy tests: Convert more test cases to rely on variables from common 2024-08-26 20:00:14 -04:00
test_wrongorder tests: Fix issues related to SC2164 2023-01-13 21:02:51 -05:00

This directory contains the swtpm tests.

To run the tests you need to build swtpm first and then you can run the tests using the following command line:

SWTPM_TEST_PROFILE='{"Name":"default-v1"}' \
SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_STORE_VOLATILE=1 SWTPM_TEST_IBMTSS2=1 make check

You may omit the environment variables if you don't want to run the more time-consuming tests.

SWTPM_TEST_EXPENSIVE=1 enables the following tests:

  • test_tpm12
  • test_tpm2_ibmtss2
  • test_tpm2_libtpms_versions_profiles

SWTPM_TEST_STORE_VOLATILE=1 enables storing and restoring of the volatile state at every step of the test_tpm2_ibmtss2 test. This environment variable only has an effect if SWTPM_TEST_EXPENSIVE=1 is set.

SWTPM_TEST_IBMTSS2=1 enables the following tests

  • test_tpm2_save_load_state_2
  • test_tpm2_save_load_state_3
  • test_tpm2_libtpms_versions_profiles

SWTPM_TEST_PROFILE allows to set a profile for the following tests:

  • test_tpm2_ibmtss2

Note: The test suite will terminate with an error if the profile disables an algorithm that it requires.

To run against an installed IBM TSS test suite, you may set the SWTPM_TEST_IBMTSS to the location of the test suite, such as /usr/libexec/installed-tests/ibmtss.

Some tests require root rights, especially those involving the CUSE TPM and the vTPM proxy device. To run these and all the other ones you can use the following command line:

sudo bash -c "SWTPM_TEST_EXPENSIVE=1 SWTPM_TEST_STORE_VOLATILE=1 SWTPM_TEST_IBMTSS2=1 make check"