sbsigntools/tests/common.sh
Jeremy Kerr b3edb1fb72 tests: Execute tests in a clean (temporary) directory
Instead of executing in the current (build) directory, create a
temporary directory and change into it before running any tests. This
ensures that tests aren't relying on left-overs from previous test runs.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
2012-06-13 16:56:28 +08:00

18 lines
331 B
Bash

basedir=$(cd $srcdir && pwd)
datadir=$(pwd)
bindir="$datadir/.."
sbsign=$bindir/sbsign
sbverify=$bindir/sbverify
sbattach=$bindir/sbattach
key="$datadir/private-key.rsa"
cert="$datadir/public-cert.pem"
image="$datadir/test.pecoff"
tempdir=$(mktemp --directory)
exit_trap='rm -rf $tempdir'
trap "$exit_trap" EXIT
cd "$tempdir"