#!/bin/bash
TITLE=$1
EECERT=$2
RESULT=$3
./build-chain certs $EECERT > chain.pem
certtool -e < chain.pem > output.txt
rm -f chain.pem
if grep 'Verification output:' output.txt > /dev/null; then
if grep 'Verification output' output.txt | grep -v 'Verification output: Verified.' > /dev/null; then
if test "$RESULT" = "0"; then
echo "Unexpected reject"
else
echo "Reject"
fi
else
if test "$RESULT" = "1"; then
echo "Unexpected success"
else
echo "Success"
fi
fi
fi
rm -f output.txt