Commit Graph

25 Commits

Author SHA1 Message Date
Stefan Berger
67152d3e18 tests: Fix spelling mistakes
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-07-17 20:46:43 -04:00
Stefan Berger
1fa820468f tests: Fix newly detected shellcheck issues SC2086 by quoting
Shellcheck v0.9 detected more SC2086 issues.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-06-26 20:50:01 -04:00
Stefan Berger
5704342aa8 tests: Fix shellcheck issue SC2181 by if cmd; ...
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-27 11:58:54 -05:00
Stefan Berger
4cad2bb32e tests: Fix shellcheck issue SC2143 by using grep -q
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-26 08:12:59 -05:00
Stefan Berger
20655646c6 tests: Fix shellcheck issue SC2126 by using 'grep -c'
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-14 13:31:53 -05:00
Stefan Berger
fd7a812b24 tests: Fix code to pass shellcheck with some errors disabled
Fix the test cases to pass shellcheck with some of the errors
disable.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2023-01-13 13:59:02 -05:00
Stefan Berger
cce7503cbf tests: exit with error code if mktemp fails
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-11-02 08:35:49 -04:00
Marc-André Lureau
c48dd1e279 tests: test for availability of TPM 2.0 support in swtpm
Skip test cases for TPM 2.0 if TPM 2.0 support is not provided by swtpm.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-08-10 07:13:24 -04:00
Stefan Berger
e5bb6f4ec5 tests: Move setting CERRTOOL variable to tests-common
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-03-01 07:54:27 -05:00
Stefan Berger
12c35fd016 tests: Add test for libtpms issue number 195 (needs latest libtpms now)
This patch adds a test case for testing the fix for libtpms
issue 195: https://github.com/stefanberger/libtpms/issues/195

This patch now requires that the latest TPM version from master or the
branches is installed.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2021-02-26 16:22:02 -05:00
Stefan Berger
e5155b4fc5 tests: Revert accidental port change from commit 0194fb22a
Revert the accidental port change from commit 0194fb22a.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-22 16:54:19 -04:00
Stefan Berger
ecdee41147 tests: Create orderly NVRAM indices and then clear TPM 2 (for coverage)
Create orderly NVRAM indices and then clear the TPM 2 so that NvDeleteRam()
gets executed and we get better code coverage.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-09 20:43:43 -04:00
Stefan Berger
39b49a4e71 tests: Modify test to create 2 orderly indices
Modify the test_tpm2_save_load_state_3 to create 2 orderly NVRAM indices
in the first two locations. Those indices will be cleared by a reset
of the TPM and therefore cannot be read once the TPM 2 restarts after
the reset. This also provides better test coverage.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-09 19:39:38 -04:00
Stefan Berger
0194fb22a5 Travis: Run IBM TSS2 for coverage; use Bionic
The IBM TSS2 is available starting with Bionic. Use it there
to extend the test coverage of the code.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-09 19:39:38 -04:00
Stefan Berger
3e7555c469 tests: Change localhost to 127.0.0.1 or explicityly set 127.0.0.1
To make the test cases work on Travis on Bionic replace all occurrences of
localhost with 127.0.0.1. The only affected client tools seem to be those
related to the TPM 1.2 and the IBM TSS2. For some reason the API used
there cannot resolve localhost to 127.0.0.1.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-04-09 19:39:38 -04:00
Stefan Berger
930c7ba16e tests: Allow seccomp override w/ SWTPM_TEST_SECCOMP_OPT env var
The Ubuntu (PPA) build system executes the build on an environment that
has problems with seccomp profiles. It does not allow us to run the test
suite with swtpm applying its seccomp profile since it fails with a
'bad system call' error. To work around this we introduce the env. variable
SWTPM_TEST_SECCOMP_OPT that we can set to "--seccomp action=none" to avoid
having swtpm apply it seccomp profile.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2020-01-15 15:49:51 -05:00
Stefan Berger
2b0f421224 tests: Gate the IBM TSS 2 related test with SWTPM_TEST_IBMTSS2
Older versions of the IBM TSS2, such as in FC26 for example, behave
slightly different than the code in the test case expects (certain
files are not generated or may have a different name). So gate this
test case with SWTPM_TEST_IBMTSS2 environment variable so we don't run
it by default if the TSS tools are found and so we do not run into
possible errors due to an older version of the stack installed on the
system.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-17 18:57:53 -05:00
Stefan Berger
a1c9aedd77 tests: Set TPM_INTERFACE_TYPE=socsim
Set the TPM_INTERFACE_TYPE to socsim to override a potential
compile-time default.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-01-17 18:57:53 -05:00
Stefan Berger
8f0f381f95 scripting: Use #!/usr/bin/env bash rather than /bin/bash
On some systems /bin/bash does not exists but the bash is somewhere
else and can be invoked with /usr/bin/env bash.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-09-10 16:49:12 +00:00
Stefan Berger
26320a82b2 tests: skip sha512 related test if pcrallocate does not support it
Older versions of pcrallocate do not support sha512. Skip the test
that needs it.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
47c7ea7783 tests: Make the killing of processes less noisy
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
313cf75c42 tests: Enable running tests in out-of-source builds
Pass the top_builddir and top_srcdir via TESTS_ENVIRONMENT
variable in Makefile.am.

Use TESTDIR for the path to the test directory and replace
previously used DIR in all occurences.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
9e3fab9817 tests: Update test case due to SHA512 support in libtpms
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
9a08b03c57 tests: Test key written to and loaded from volatile state
Test that a key written to volatile state is properly loaded again
and produces the same signature as before.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:47 -04:00
Stefan Berger
6a110a5a7e tests: Check TPM2 state using TPM2 utilities
Check the TPM2 state using the TPM2 utilities, if available.

Create persistent state and check it, then shut down the TPM 2 and
restart it, and check the persistent state again.

Use previously created state and have the TPM 2 start with it
and check the persistent state. The persistent state must be
readable on little and big endian machines.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
2018-08-07 12:19:46 -04:00