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:
Jeremy Kerr 2012-08-13 13:01:20 +08:00
parent e1b58d6ccb
commit 1187df3459
18 changed files with 136 additions and 59 deletions

View file

@ -1,32 +1,39 @@
AUTOMAKE_OPTIONS = parallel-tests
test_key = private-key.rsa
test_cert = public-cert.pem
test_image = test.pecoff
test_arches = x86_64 i386
test_images = test-x86_64.pecoff test-i386.pecoff
check_PROGRAMS = test.pecoff
check_PROGRAMS = test-x86_64.pecoff test-i386.pecoff
check_DATA = $(test_key) $(test_cert)
check_SCRIPTS = common.sh
check_SCRIPTS = test-wrapper.sh
test_image_arch = x86-64
test_lds = $(srcdir)/test.lds
test_i386_pecoff_SOURCES = test.S test-i386.lds
test_x86_64_pecoff_SOURCES = test.S test-x86_64.lds
test_pecoff_SOURCES =
test.pecoff: test.elf
test-%.pecoff: test-%.elf
$(OBJCOPY) -j .text -j .sdata -j .data \
-j .dynamic -j .dynsym -j .rel \
-j .rela -j .reloc \
--target=efi-app-$(test_image_arch) $^ $@
$(STRIP) $@
test.elf: LDFLAGS = -nostdlib -T $(test_lds) -m64
test.elf: test.$(OBJEXT) $(test_lds)
test-x86_64.pecoff: test_image_arch = x86-64
test-x86_64.pecoff: test_lds = $(srcdir)/test-x86_64.lds
test-x86_64.pecoff: ASFLAGS += -m64
test-x86_64.pecoff: LDFLAGS += -m64
test-i386.pecoff: test_image_arch = i386
test-i386.pecoff: test_lds = $(srcdir)/test-i386.lds
test-i386.pecoff: ASFLAGS += -m32
test-i386.pecoff: LDFLAGS += -m32
test-%.elf: LDFLAGS = -nostdlib -T $(test_lds)
test-%.elf: test-%.$(OBJEXT) $(test_lds)
$(LINK) $<
.INTERMEDIATE: test.elf
test.$(OBJEXT): ASFLAGS = -m64
test.$(OBJEXT): $(srcdir)/test.S
test-%.$(OBJEXT): $(srcdir)/test.S
$(COMPILE.S) -o $@ $^
$(test_key): Makefile
@ -49,5 +56,8 @@ TESTS = sign-verify.sh \
resign-warning.sh \
reattach-warning.sh
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = TEST_ARCHES="$(test_arches)" $(srcdir)/test-wrapper.sh
EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS)
CLEANFILES = $(test_key) $(test_cert) $(test_image)
CLEANFILES = $(test_key) $(test_cert) $(test_images)