44 lines
1.1 KiB
Bash
Executable File
44 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Runs OEMCrypto CAS demo test
|
|
#
|
|
# Race conditions sometimes occur, causing the executables to hang at the
|
|
# beginning of each test suite, so don't rely on these for CI/CD or production.
|
|
|
|
if [ -z "$CDM_DIR" ]; then
|
|
echo "CDM_DIR must be set to the top of the repo"
|
|
exit
|
|
fi
|
|
|
|
kill_ta_simulators() {
|
|
tee_simulator_cas_pid=$(ps aux | grep '[t]ee_simulator_cas' | awk '{print $2}')
|
|
|
|
if [ -n "$tee_simulator_cas_pid" ]; then
|
|
echo "Terminating CAS TEE simulator (PID $tee_simulator_cas_pid)"
|
|
kill $tee_simulator_cas_pid
|
|
fi
|
|
}
|
|
|
|
run_tests() {
|
|
builddir=$CDM_DIR/out/linux/cas
|
|
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$builddir/liboemcrypto:$builddir/libtuner
|
|
|
|
$builddir/tee_simulator_cas/tee_simulator_cas &
|
|
|
|
trap kill_ta_simulators EXIT
|
|
|
|
sleep 1
|
|
tee_simulator_cas_pid=$(ps aux | grep '[t]ee_simulator_cas' | awk '{print $2}')
|
|
if [[ -f "/proc/$tee_simulator_cas_pid/stat" ]]; then
|
|
$builddir/cas_unittests/cas_unittests --gtest_filter="*OEMCryptoCasDemoTest*"
|
|
# $builddir/hello_world/hello_world
|
|
else
|
|
echo "CAS TEE simulator did not start."
|
|
FINAL_RESULT=43
|
|
fi
|
|
}
|
|
|
|
run_tests
|
|
|
|
exit $FINAL_RESULT
|