swtpm/tests
Stefan Berger 9d8e6e36f6 tests: Check for permanent state file change due to TPM2_PCR_Read
Extend a test case to check whether the permanent state files changes
when a TPM2_PCR_Read() is executed. The state file change would cause
timeouts inside VMs when an fsync() is used that fully synchronzies the
state of the TPM 2 with the data on disk. The issue has been resolved in
more recent versions of libtpms (master and branches). The updated
libtpms is required if fsync() for files and directories is to be enabled.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-10-17 18:25:11 -04:00
..
data tests: Add test for libtpms issue number 195 (needs latest libtpms now) 2021-02-26 16:22:02 -05:00
patches tests: Store and also restore the volatile state at every step 2021-03-17 19:19:10 -04:00
_test_encrypted_state tests: Use bash's built-in echo rather than /bin/echo 2018-11-19 18:50:42 -05:00
_test_getcap tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_hashing tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_hashing2 tests: Check expected error output against expected error message 2018-10-08 06:43:30 -04:00
_test_init tests: Allow seccomp override w/ SWTPM_TEST_SECCOMP_OPT env var 2020-01-15 15:49:51 -05:00
_test_locality tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_migration_key tests: Check expected error output against expected error message 2018-10-08 06:43:30 -04:00
_test_migration_key_2 tests: Run tests also on socket interfaces 2017-07-11 14:04:40 -04:00
_test_print_capabilities swtpm_setup: Implement option --create-config-files to create config files 2021-10-07 14:27:10 -04:00
_test_print_states swtpm: Add size to each type of state and use JSON object 2021-09-28 07:46:38 -04:00
_test_resume_volatile tests: Call function rather than running 'ps aux' to display proceses 2018-09-27 10:19:09 -04:00
_test_save_load_encrypted_state tests: Convert existing test case to use file descriptor for reading password 2019-06-24 07:27:39 -04:00
_test_save_load_state swtpm: Add tests for "linear file" backend 2021-10-05 09:01:30 -04:00
_test_setbuffersize tests: Fix spelling error swptm->swtpm 2021-02-05 16:48:55 -05:00
_test_swtpm_bios tests: Replace ${SWTPM}.pid with swtpm.pid in PID filename in 2 test cases 2021-07-28 13:39:56 -04:00
_test_tpm2_derived_keys tests: Skip derived key test 1st part on big endian machines 2020-05-27 13:18:54 -04:00
_test_tpm2_encrypted_state tests: Fix spelling error swptm->swtpm 2021-02-05 16:48:55 -05:00
_test_tpm2_file_permissions test: Fix test_tpm2_file_permissions for BSD 2021-09-28 12:31:09 -04:00
_test_tpm2_getcap tests: Check expected error output against expected error message 2018-10-08 06:43:30 -04:00
_test_tpm2_hashing tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_tpm2_hashing2 tests: Check expected error output against expected error message 2018-10-08 06:43:30 -04:00
_test_tpm2_hashing3 tests: Adapt test cases' expected PCR result due to libtpms TPM 2 fix 2020-06-29 08:18:23 -04:00
_test_tpm2_init tests: Allow seccomp override w/ SWTPM_TEST_SECCOMP_OPT env var 2020-01-15 15:49:51 -05:00
_test_tpm2_locality tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_tpm2_migration_key tests: Allow volatile state file >= 9000 bytes in test_tpm2_migration_key 2021-05-12 16:03:19 -04:00
_test_tpm2_print_capabilities swtpm_setup: Implement option --create-config-files to create config files 2021-10-07 14:27:10 -04:00
_test_tpm2_print_states swtpm: Add size to each type of state and use JSON object 2021-09-28 07:46:38 -04:00
_test_tpm2_probe tests: Extend tests cases with test for active seccomp profiles 2019-03-18 15:43:44 -04:00
_test_tpm2_resume_volatile tests: Call function rather than running 'ps aux' to display proceses 2018-09-27 10:19:09 -04:00
_test_tpm2_save_load_encrypted_state tests: Adapt test cases' expected PCR result due to libtpms TPM 2 fix 2020-06-29 08:18:23 -04:00
_test_tpm2_save_load_state tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_tpm2_save_load_state_da_timeout tests: Fix test_tpm2_save_load_state_da_timeout rare timer race 2021-09-16 07:57:33 -04:00
_test_tpm2_savestate tests: Check for permanent state file change due to TPM2_PCR_Read 2021-10-17 18:25:11 -04:00
_test_tpm2_setbuffersize tests: Fix spelling error swptm->swtpm 2021-02-05 16:48:55 -05:00
_test_tpm2_swtpm_bios tests: Replace ${SWTPM}.pid with swtpm.pid in PID filename in 2 test cases 2021-07-28 13:39:56 -04:00
_test_tpm2_volatilestate tests: Adapt test cases' expected PCR result due to libtpms TPM 2 fix 2020-06-29 08:18:23 -04:00
_test_tpm2_wrongorder tests: Check expected error output against expected error message 2018-10-08 06:43:30 -04:00
_test_tpm_probe tests: Extend tests cases with test for active seccomp profiles 2019-03-18 15:43:44 -04:00
_test_volatilestate tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
_test_wrongorder tests: Increase timeout for shutdown for running with valgrind 2018-10-01 12:52:20 -04:00
common tests: Use nm and grep to check for ASAN 2021-09-29 14:57:38 -04:00
create_certs.sh scripting: Use #!/usr/bin/env bash rather than /bin/bash 2018-09-10 16:49:12 +00:00
load_vtpm_proxy tests: Skip CUSE TPM related tests if cuse module is not available 2017-02-02 09:01:55 -05:00
Makefile.am tests: Add a test case for the new swtpm_setup option 2021-10-07 14:27:10 -04:00
Readme.md tests: Add a Readme describing how to run the swtpm tests 2021-03-17 19:19:10 -04:00
softhsm_setup tests: Enable softhsm_setup to work with a temporary directory 2020-08-27 20:26:27 -04: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 tests: Allow seccomp override w/ SWTPM_TEST_SECCOMP_OPT env var 2020-01-15 15:49:51 -05:00
test_commandline swtpm: Add options for pluggable backend (--tpmstate backend-uri) 2021-08-13 06:35:18 -04:00
test_common test: Add --log parameter to test logging 2017-02-03 15:15:31 -05:00
test_config.in build: remove hardcoded tss user and group 2015-11-02 20:47:37 -05:00
test_ctrlchannel tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_ctrlchannel2 tests: Skip chardev related tests after checking for chardev support 2021-08-14 16:01:37 -04:00
test_ctrlchannel3 tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_ctrlchannel4 tests: Skip chardev related tests after checking for chardev support 2021-08-14 16:01:37 -04:00
test_cuse tests: Skip CUSE tests if not compiled with CUSE interface 2018-06-11 10:35:14 -04:00
test_encrypted_state tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_getcap tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_hashing tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_hashing2 tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_init tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_locality tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_migration_key tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_parameters tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_print_capabilities tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_print_states swtpm: Add --print-states for reporting TPM states status 2021-09-07 09:22:51 -04:00
test_resume_volatile tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_samples_create_tpmca tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_save_load_encrypted_state tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_save_load_state swtpm: Add tests for "linear file" backend 2021-10-05 09:01:30 -04:00
test_setbuffersize tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_setdatafd.py test: Remove import of twisted package function for python2 2021-09-20 07:25:53 -04:00
test_swtpm_bios tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_swtpm_cert swtpm_cert: Allow passing signing key and parent key via new option 2020-01-30 08:52:58 -05:00
test_swtpm_setup_create_cert swtpm_localca: Created certificates for CAs and TPM that do not expire 2021-10-08 14:07:02 -04:00
test_swtpm_setup_file_backend swtpm_setup: add test case to exercise file backend 2021-10-05 11:54:42 -04:00
test_swtpm_setup_misc tests: Add a test case for the new swtpm_setup option 2021-10-07 14:27:10 -04:00
test_swtpm_setup_overwrite swtpm_setup: Add tests for --overwrite options 2021-09-07 09:22:51 -04:00
test_tpm2_ctrlchannel2 tests: Skip chardev related tests after checking for chardev support 2021-08-14 16:01:37 -04:00
test_tpm2_derived_keys tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_encrypted_state tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_file_permissions tests: Add a test case for testing --runas and ability to access files 2021-09-28 09:23:28 -04:00
test_tpm2_getcap tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_hashing tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_hashing2 tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_hashing3 tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_ibmtss2 tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_init tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_locality tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_migration_key tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_parameters tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_partial_reads tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_print_capabilities tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_print_states tests: Fix test_tpm2_print_states 2021-09-09 21:47:21 -04:00
test_tpm2_probe tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_resume_volatile tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_samples_create_tpmca.test tests: Fix tests using tpm2-abrmd by preventing concurrency 2021-09-27 09:17:54 -04:00
test_tpm2_save_load_encrypted_state tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_save_load_state tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_save_load_state_2 swtpm: Add tests for "linear file" backend 2021-10-05 09:01:30 -04:00
test_tpm2_save_load_state_2_block tests: Use /usr/bin/env bash rather than /bin/bash (BSDs) 2021-10-05 13:50:45 -04:00
test_tpm2_save_load_state_2_linear tests: Use /usr/bin/env bash rather than /bin/bash (BSDs) 2021-10-05 13:50:45 -04:00
test_tpm2_save_load_state_3 tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_save_load_state_da_timeout tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_savestate tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_setbuffersize tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_swtpm_bios tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_swtpm_cert tests: Allow passing SWTPM_CERT from command line 2018-11-17 16:37:03 -05:00
test_tpm2_swtpm_cert_ecc tests: Allow passing SWTPM_CERT from command line 2018-11-17 16:37:03 -05:00
test_tpm2_swtpm_localca Move swtpm_localca sources from samples/ to src/ 2021-07-25 08:52:13 -04:00
test_tpm2_swtpm_localca_pkcs11.test tests: Skip TPM 2 pkcs11-related test when ASAN is used 2021-10-04 20:35:25 -04:00
test_tpm2_swtpm_setup_create_cert tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_swtpm_setup_overwrite swtpm_setup: Add tests for --overwrite options 2021-09-07 09:22:51 -04:00
test_tpm2_volatilestate tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_vtpm_proxy tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm2_wrongorder tests: test for availability of TPM 2.0 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm12 tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_tpm_probe tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_volatilestate tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_vtpm_proxy tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04:00
test_wrongorder tests: test for availability of TPM 1.2 support in swtpm 2021-08-10 07:13:24 -04: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_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

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

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"