2019-07-19 09:50:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2019-08-02 16:39:56 +00:00
|
|
|
# Script to run the System Tests Base/Delta for HIRS TPM 2.0 Provisioner
|
2019-07-19 09:50:26 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
echo ""
|
2019-08-02 16:39:56 +00:00
|
|
|
echo "System Tests Base/Delta TPM 2.0 Starting..."
|
2019-07-19 09:50:26 +00:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
# Start System Testing Docker Environment
|
|
|
|
cd .ci/docker
|
|
|
|
|
2019-08-02 16:39:56 +00:00
|
|
|
docker-compose -f docker-compose-tpm2-base-delta-bad.yml up -d
|
2019-07-19 09:50:26 +00:00
|
|
|
|
|
|
|
tpm2_container_id="$(docker ps -aqf "name=hirs-aca-provisioner-tpm2")"
|
|
|
|
echo "TPM2 Container ID: $tpm2_container_id"
|
|
|
|
|
|
|
|
tpm2_container_status="$(docker inspect $tpm2_container_id --format='{{.State.Status}}')"
|
|
|
|
echo "TPM2 Container Status: $tpm2_container_status"
|
|
|
|
|
|
|
|
while [[ $tpm2_container_status == "running" ]]
|
|
|
|
do
|
|
|
|
sleep 20
|
|
|
|
|
|
|
|
# Add status message, so Travis will not time out.
|
|
|
|
# It may timeout if it hasn't received output for more than 10 minutes.
|
|
|
|
echo "Still running tests, please wait..."
|
|
|
|
|
|
|
|
tpm2_container_status="$(docker inspect $tpm2_container_id --format='{{.State.Status}}')"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Store container exit code
|
|
|
|
tpm2_container_exit_code="$(docker inspect $tpm2_container_id --format='{{.State.ExitCode}}')"
|
|
|
|
echo "TPM2 Container Exit Code: $tpm2_container_exit_code"
|
|
|
|
|
|
|
|
# Display container log
|
|
|
|
echo ""
|
|
|
|
echo "===========hirs-aca-provisioner-tpm2 System Tests Log:==========="
|
|
|
|
docker logs $tpm2_container_id
|
|
|
|
|
|
|
|
echo ""
|
2019-08-02 16:39:56 +00:00
|
|
|
echo "End of Base/Delta TPM 2.0 System Tests, cleaning up..."
|
2019-07-19 09:50:26 +00:00
|
|
|
echo ""
|
|
|
|
# Clean up services and network
|
|
|
|
docker-compose down
|
|
|
|
|
|
|
|
# Clean up dangling containers
|
|
|
|
echo "Cleaning up dangling containers..."
|
|
|
|
echo ""
|
|
|
|
docker ps -a
|
|
|
|
echo ""
|
|
|
|
docker container prune --force
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
# Return container exit code
|
|
|
|
if [[ $tpm2_container_exit_code == 0 ]]
|
|
|
|
then
|
2019-08-02 16:39:56 +00:00
|
|
|
echo "SUCCESS: Base/Delta TPM 2.0 System Tests passed"
|
2019-07-19 09:50:26 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-08-02 16:39:56 +00:00
|
|
|
echo "ERROR: Base/Delta TPM 2.0 System Tests failed"
|
2019-07-19 09:50:26 +00:00
|
|
|
exit 1
|