stefanberger / swtpm

Libtpms-based TPM emulator with socket, character device, and Linux CUSE interface.
Other
564 stars 136 forks source link

Install tests #870

Closed elmarco closed 2 months ago

elmarco commented 2 months ago

Allow tests/ to be installed and run from the system.

The installation path is loosely based on https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests guidelines. We don't provide the .test files though, at this point. Instead, I wrote a simply installed-runner.sh script which mimics autotools basic runner. (ideally, the tests could use TAP instead etc)

Missing:

I think the current patch set should be ok for review/merge though.

stefanberger commented 2 months ago

The problem with the pkcs11 test failing seems to be due to the PATH being set in the test case not pointing to the correct directory anymore. It looks like this:

stefanberger commented 2 months ago

If you remove SWTPM_EXE from being set in test_tpm2_vtpm_proxy, test_vtpm_proxy, test_tpm2_save_load_state_2, test_tpm2_save_load_state_3 (and SWTPM_IOCTL from latter two) as well as a few others, then these work in the installed case with sudo. SWTPM_TEST_EXPENSIVE=1 ./installed-runner.sh seems to already do what it is supposed to.

stefanberger commented 2 months ago

Can you squash all the 'teach' patches?

stefanberger commented 2 months ago

2nd PR for these here?

SKIP: test_vtpm_proxy
SKIP: test_tpm2_vtpm_proxy
SKIP: test_ctrlchannel2
SKIP: test_tpm2_chroot_socket
SKIP: test_tpm2_chroot_chardev
SKIP: test_tpm2_chroot_cuse
SKIP: test_tpm2_ctrlchannel2
SKIP: test_tpm2_partial_reads
SKIP: test_tpm2_save_load_state_2
SKIP: test_tpm2_save_load_state_2_linear
SKIP: test_tpm2_save_load_state_2_block
SKIP: test_tpm2_save_load_state_3
elmarco commented 2 months ago

Yes I plan to do the rest as follow-ups