Skip to content

Commit

Permalink
tests: Remove SWTPM variable and usage
Browse files Browse the repository at this point in the history
SWTPM was set to 'swtpm' and only for uninstalled tests. Remove it and
replace its usage with 'swtpm' everywhere.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger committed Aug 27, 2024
1 parent ec792ce commit 4ef45bc
Show file tree
Hide file tree
Showing 33 changed files with 52 additions and 55 deletions.
4 changes: 2 additions & 2 deletions tests/_test_encrypted_state
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--key "file=$keyfile,mode=aes-cbc,format=hex,remove" \
--log "file=$logfile"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -143,7 +143,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--key "file=$binkeyfile,mode=aes-cbc,format=binary,remove" \
--log "file=$logfile"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error (2): ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_hashing
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_hashing2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_init
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ run_swtpm "${SWTPM_INTERFACE}" \
--tpmstate "dir=$TPM_PATH" \
--pid "file=$PID_FILE"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_locality
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
8 changes: 4 additions & 4 deletions tests/_test_migration_key
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cp "${TESTDIR}"/data/tpmstate1/* "$TPM_PATH"
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--migration-key "pwdfile=$migpwdfile,remove=false,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -149,7 +149,7 @@ echo "Test 1: Ok"
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--migration-key "pwdfile=$migpwdfile,remove=false,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -194,7 +194,7 @@ echo "Test 2: Ok"
# This time we make this fail since we don't provide the migration key
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -231,7 +231,7 @@ echo "Test 3: Ok"
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--migration-key "pwdfile=$migpwdfile,remove=true,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
6 changes: 3 additions & 3 deletions tests/_test_resume_volatile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cp "${TESTDIR}"/data/tpmstate1/* "${TPM_PATH}"

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -92,7 +92,7 @@ cp "${TESTDIR}"/data/tpmstate2/* "${TPM_PATH}"
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--key "pwdfile=${TESTDIR}/data/tpmstate2/pwdfile.txt,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -145,7 +145,7 @@ cp "${TESTDIR}"/data/tpmstate2b/* "${TPM_PATH}"
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--key "pwdfile=${TESTDIR}/data/tpmstate2b/pwdfile.txt,mode=aes-256-cbc"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
6 changes: 3 additions & 3 deletions tests/_test_save_load_encrypted_state
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile"
exec 101>&-

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -290,7 +290,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile"
exec 101>&-

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -364,7 +364,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--key "pwdfile=$keyfile,mode=aes-256-cbc" \
--log "file=$logfile"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_save_load_state
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
${BACKEND_PARAM:+${BACKEND_PARAM}} \
--log "file=$logfile"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_swtpm_bios
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

run_swtpm "${SWTPM_INTERFACE}" --tpmstate "dir=$TPM_PATH" --pid "file=$PID_FILE"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
4 changes: 2 additions & 2 deletions tests/_test_tpm2_encrypted_state
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -145,7 +145,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error (2): ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_getcap
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_hashing
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_hashing2
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_hashing3
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_init
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fi

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_locality
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
6 changes: 3 additions & 3 deletions tests/_test_tpm2_migration_key
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--tpm2 \
--migration-key "pwdfile=$migpwdfile,remove=false,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -177,7 +177,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=${logfile}" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -222,7 +222,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--tpm2 \
--migration-key "pwdfile=$migpwdfile,remove=true,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_probe
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
6 changes: 3 additions & 3 deletions tests/_test_tpm2_resume_volatile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ cp "${TESTDIR}"/data/tpm2state1/* "${TPM_PATH}"

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: CUSE TPM did not start."
Expand Down Expand Up @@ -92,7 +92,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--tpm2 \
--key "pwdfile=${TESTDIR}/data/tpm2state2/pwdfile.txt,kdf=sha512"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: CUSE TPM did not start."
Expand Down Expand Up @@ -146,7 +146,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--tpm2 \
--key "pwdfile=${TESTDIR}/data/tpm2state2b/pwdfile.txt,mode=aes-256-cbc"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: CUSE TPM did not start."
Expand Down
6 changes: 3 additions & 3 deletions tests/_test_tpm2_save_load_encrypted_state
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -256,7 +256,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -333,7 +333,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_save_load_state
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile,level=20" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_save_load_state_da_timeout
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" \
--log "file=$logfile,level=20" \
--tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_savestate
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
4 changes: 2 additions & 2 deletions tests/_test_tpm2_swtpm_bios
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SWTPM_DEV_NAME="/dev/${VTPM_NAME}"
TPM_PATH="$(mktemp -d)" || exit 1
STATE_FILE=$TPM_PATH/tpm2-00.permall
VOLATILE_STATE_FILE=$TPM_PATH/tpm-00.volatilestate
PID_FILE=$TPM_PATH/SWTPM.pid
PID_FILE=$TPM_PATH/swtpm.pid
SWTPM_INTERFACE=${SWTPM_INTERFACE:-cuse}
SWTPM_CMD_UNIX_PATH=${TPM_PATH}/unix-cmd.sock
SWTPM_CTRL_UNIX_PATH=${TPM_PATH}/unix-ctrl.sock
Expand All @@ -34,7 +34,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

run_swtpm "${SWTPM_INTERFACE}" --tpm2 --tpmstate "dir=$TPM_PATH" --pid "file=$PID_FILE"

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
4 changes: 2 additions & 2 deletions tests/_test_tpm2_volatilestate
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down Expand Up @@ -107,7 +107,7 @@ fi
# Start the TPM again
TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_tpm2_wrongorder
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rm -f "$STATE_FILE" "$VOLATILE_STATE_FILE" 2>/dev/null

TPM_PATH=$TPM_PATH run_swtpm "${SWTPM_INTERFACE}" --tpm2

display_processes_by_name "$SWTPM"
display_processes_by_name "swtpm"

if ! kill_quiet -0 "${SWTPM_PID}"; then
echo "Error: ${SWTPM_INTERFACE} TPM did not start."
Expand Down
Loading

0 comments on commit 4ef45bc

Please sign in to comment.