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>
This commit is contained in:
James Bottomley 2017-10-19 09:20:42 -07:00
parent cbbafe244b
commit f065bb5705
5 changed files with 56 additions and 38 deletions

View file

@ -65,6 +65,20 @@ PKG_CHECK_MODULES(uuid, uuid,
dnl gnu-efi headers require extra include dirs
EFI_ARCH=$(uname -m | sed 's/i.86/ia32/;s/arm.*/arm/')
AM_CONDITIONAL(TEST_BINARY_FORMAT, [ test "$EFI_ARCH" = "arm" -o "$EFI_ARCH" = "aarch64" ])
##
# no consistent view of where gnu-efi should dump the efi stuff, so find it
##
for path in /lib /lib64 /usr/lib /usr/lib64 /usr/lib32 /lib/efi /lib64/efi /usr/lib/efi /usr/lib64/efi; do
if test -e $path/crt0-efi-$EFI_ARCH.o; then
CRTPATH=$path
fi
done
if test -z "$CRTPATH"; then
AC_MSG_ERROR([cannot find the gnu-efi crt path])
fi
EFI_CPPFLAGS="-I/usr/include/efi -I/usr/include/efi/$EFI_ARCH \
-DEFI_FUNCTION_WRAPPER"
CPPFLAGS_save="$CPPFLAGS"
@ -72,6 +86,8 @@ CPPFLAGS="$CPPFLAGS $EFI_CPPFLAGS"
AC_CHECK_HEADERS([efi.h], [], [], $EFI_INCLUDES)
CPPFLAGS="$CPPFLAGS_save"
AC_SUBST(EFI_CPPFLAGS, $EFI_CPPFLAGS)
AC_SUBST(EFI_ARCH, $EFI_ARCH)
AC_SUBST(CRTPATH, $CRTPATH)
AC_CONFIG_FILES([Makefile src/Makefile lib/ccan/Makefile]
[docs/Makefile tests/Makefile])