tests: run tests for each arch
Since we can sign i386 PE/COFF images, run the tests on both x86-64 and i386 binaries. We do this by moving test.pecoff to test-<arch>.pecoff, and using automake's parallel-test option to add a wrapper to each test execution. This wrapper calls each test once per arch (as defined in TEST_ARCHES), and checks for failures in any invocation. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
parent
e1b58d6ccb
commit
1187df3459
18 changed files with 136 additions and 59 deletions
52
tests/test-wrapper.sh
Executable file
52
tests/test-wrapper.sh
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/bash
|
||||
|
||||
# set a few global variables that may be used by the test
|
||||
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"
|
||||
|
||||
export basedir datadir bindir sbsign sbverify sbattach key cert
|
||||
|
||||
# 'test' needs to be an absolute path, as we will cd to a temporary
|
||||
# directory before running the test
|
||||
test="$PWD/$1"
|
||||
rc=0
|
||||
|
||||
function run_test()
|
||||
{
|
||||
test="$1"
|
||||
|
||||
# image depends on the test arch
|
||||
image="$datadir/test-$arch.pecoff"
|
||||
export image
|
||||
|
||||
# create the temporary directory...
|
||||
tempdir=$(mktemp --directory)
|
||||
|
||||
# ... and run the test in it.
|
||||
( cd "$tempdir"; $test )
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "test $(basename $test) failed on arch $arch"
|
||||
echo
|
||||
rc=1
|
||||
fi
|
||||
|
||||
rm -rf "$tempdir"
|
||||
}
|
||||
|
||||
# run test on all available arches
|
||||
for arch in $TEST_ARCHES
|
||||
do
|
||||
run_test $test
|
||||
done
|
||||
|
||||
exit $rc
|
Loading…
Add table
Add a link
Reference in a new issue