sbsigntools/tests/test-wrapper.sh
James Bottomley f065bb5705 tests: Fix up to work on arbitrary architectures
The current test infrastructure is tied to x86/amd64.  This means the
tests always fail on a non-x86 architecture (like aarch64).  Fix this
by generating the efi binary directly from C code and removing the
architectural restrictions in the Makefile.am.  One of the
consequences of this is that we no longer test ia32 on x86_64, but the
difficulty of detecting which architectures can support 32 bit
variants and generating them correctly from EFI c code is too great.

We also need to exclude tests involving objdump from aarch64 since its
bfd still doesn't have an efi_app_aarch64 target.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2017-10-19 10:45:58 -07:00

52 lines
922 B
Bash
Executable file

#!/bin/bash
# set a few global variables that may be used by the test
basedir=$(cd $srcdir && pwd)
datadir=$(pwd)
bindir="$datadir/../src"
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.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