mirror of
				https://git.code.sf.net/p/linux-ima/ima-evm-utils
				synced 2025-10-31 21:20:46 +01:00 
			
		
		
		
	travis: properly kill the software TPM
Send "tsstpmcmd -stop" to properly stop the tpm_server. Send SIGTERM to stop the swtpm process. Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
		| @@ -41,14 +41,12 @@ else | |||||||
|  |  | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # Only stop this test's software TPM.  Preferred method: "tsstpmcmd -stop" | # Only stop this test's software TPM | ||||||
| cleanup() { | cleanup() { | ||||||
| 	if [ -n "${SWTPM_PPID}" ]; then | 	if [ -n "${SWTPM_PID}" ]; then | ||||||
| 		if [ -f "${TSSDIR}/tsstpmcmd" ]; then | 		kill -SIGTERM "${SWTPM_PID}" | ||||||
|  | 	elif [ -n "${TPMSERVER_PID}" ]; then | ||||||
| 		"${TSSDIR}/tsstpmcmd" -stop | 		"${TSSDIR}/tsstpmcmd" -stop | ||||||
| 		else |  | ||||||
| 			pkill -P "${SWTPM_PPID}" |  | ||||||
| 		fi |  | ||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -72,7 +70,7 @@ swtpm_start() { | |||||||
| 			echo "INFO: Starting software TPM: ${swtpm}" | 			echo "INFO: Starting software TPM: ${swtpm}" | ||||||
| 			mkdir -p ./myvtpm | 			mkdir -p ./myvtpm | ||||||
| 			${swtpm} socket --tpmstate dir=./myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init > /dev/null 2>&1 & | 			${swtpm} socket --tpmstate dir=./myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init > /dev/null 2>&1 & | ||||||
| 			SWTPM_PPID=$! | 			SWTPM_PID=$! | ||||||
| 		fi | 		fi | ||||||
| 	elif [ -n "${tpm_server}" ]; then | 	elif [ -n "${tpm_server}" ]; then | ||||||
| 		# tpm_server uses the Microsoft simulator encapsulated packet format | 		# tpm_server uses the Microsoft simulator encapsulated packet format | ||||||
| @@ -84,7 +82,7 @@ swtpm_start() { | |||||||
| 		else | 		else | ||||||
| 			echo "INFO: Starting software TPM: ${tpm_server}" | 			echo "INFO: Starting software TPM: ${tpm_server}" | ||||||
| 			${tpm_server} > /dev/null 2>&1 & | 			${tpm_server} > /dev/null 2>&1 & | ||||||
| 			SWTPM_PPID=$! | 			TPMSERVER_PID=$! | ||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
| 	return 0 | 	return 0 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mimi Zohar
					Mimi Zohar