From 926275e123f72db3edd09922182be545a00ef993 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 16 May 2019 12:03:38 +0200 Subject: [PATCH] Add support for aarch64 in CI --- .gitlab-ci.yml | 13 ++++++++++--- tests/Makefile | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 891112e87..f3600ae8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,9 +4,11 @@ image: debian before_script: - - dpkg --add-architecture i386 + - dpkg --add-architecture i386 --add-architecture arm64 - apt-get update -qq - - apt-get install -y libc6-dev:amd64 libc6-dev:i386 gcc gcc-multilib make + - apt-get install -y \ + libc6-dev:amd64 libc6-dev:i386 libc6-dev:arm64 \ + gcc gcc-multilib gcc-aarch64-linux-gnu make x86-64: stage: test @@ -16,4 +18,9 @@ x86-64: i686: stage: test script: - - make -C tests test-ia32 + - make -C tests test-ia32 CC_IA32='gcc -m32' + +aarch64: + stage: test + script: + - make -C tests test-aarch64 CC_AARCH64=gcc-aarch64-linux-gnu diff --git a/tests/Makefile b/tests/Makefile index 7b6bbd49d..a3b988c52 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -1,8 +1,22 @@ TESTS=$(sort $(basename $(wildcard *.c))) -TARGETS=native +TARGETS=native ia32 aarch64 +# Suitable values of cross-compiler variables for Debian, having previously done: +# +# CC_IA32 = gcc -m32 +# CC_AARCH64 = gcc-aarch64-linux-gnu +# +# The relevant packages that you need to run this: +# +# dpkg --add-architecture i386 --add-architecture arm64 +# apt-get update -qq +# apt-get install -y \ +# libc6-dev:amd64 libc6-dev:i386 libc6-dev:arm64 \ +# gcc gcc-multilib gcc-aarch64-linux-gnu make +# CC = gcc -CC_IA32 = gcc -m32 +CC_IA32='guix environment --pure -s i686-linux --ad-hoc gcc-toolchain glibc -- gcc' +CC_AARCH64='guix environment --pure -s aarch64-linux --ad-hoc gcc-toolchain glibc -- gcc' CFLAGS = -Wall -O0 -g all: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS))) @@ -29,6 +43,10 @@ test-ia32-%: CC = $(CC_IA32) test-ia32-%: %.c lightening-ia32.o test.h $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-ia32.o $< +test-aarch64-%: CC = $(CC_AARCH64) +test-aarch64-%: %.c lightening-aarch64.o test.h + $(CC) $(CFLAGS) $(CPPFLAGS) -I.. -o $@ lightening-aarch64.o $< + .PRECIOUS: $(foreach TARGET,$(TARGETS),$(addprefix test-$(TARGET)-,$(TESTS))) .PRECIOUS: $(foreach TARGET,$(TARGETS),lightening-$(TARGET).o)