Skip to content

Commit b970573

Browse files
authored
Merge pull request #409 from k-okada/add_multiarch_test
add multi-arch test for .travis.yml
2 parents dbf79e6 + bd01530 commit b970573

26 files changed

+233
-113
lines changed

.travis.sh

+58
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,64 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then
5757

5858
fi
5959

60+
### for multiarch compile test
61+
if [ "$QEMU" != "" ]; then
62+
travis_time_start install.dpkg-dev
63+
apt-get install -qq -y dpkg-dev
64+
travis_time_end
65+
66+
echo "uname -a : $(uname -a)"
67+
echo "uname -m : $(uname -m)"
68+
echo "gcc -dumpmachine : $(gcc -dumpmachine)"
69+
echo "gcc -dumpversion : $(gcc -dumpversion)"
70+
echo "getconf LONG_BIT : $(getconf LONG_BIT)"
71+
72+
travis_time_start compile.euslisp
73+
export EUSDIR=`pwd`
74+
eval "$(dpkg-buildflags --export=sh)"
75+
make -C lisp -f Makefile.Linux eus0 eus1 eus2 eusg eusx eusgl eus eusjpeg
76+
travis_time_end
77+
78+
if [[ `gcc -dumpmachine | egrep "^(arm|aarch)"` != "" ]]; then
79+
export ARCHDIR=LinuxARM
80+
elif [[ `gcc -dumpmachine | egrep "^x86_64"` != "" ]]; then
81+
export ARCHDIR=Linux64
82+
else
83+
export ARCHDIR=Linux
84+
fi
85+
export PATH=`pwd`/$ARCHDIR/bin:$PATH
86+
87+
export EXIT_STATUS=0;
88+
set +e
89+
# run test in EusLisp/test
90+
for test_l in test/*.l; do
91+
92+
travis_time_start euslisp.${test_l##*/}.test
93+
94+
sed -i 's/\(i-max\ [0-9]000\)0*/\1/' $test_l
95+
96+
eusgl $test_l;
97+
export TMP_EXIT_STATUS=$?
98+
99+
travis_time_end `expr 32 - $TMP_EXIT_STATUS`
100+
101+
export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;
102+
done;
103+
echo "Exit status : $EXIT_STATUS";
104+
105+
travis_time_start euslisp.eusjpeg.test
106+
107+
eusgl '(progn (load (format nil "~A/lisp/image/jpeg/eusjpeg.l" *eusdir*))(image::write-jpeg-file "test.jpg" (instance color-image24 :init 100 100)) (print *user*) (unix::exit))'
108+
109+
export TMP_EXIT_STATUS=$?
110+
111+
travis_time_end `expr 32 - $TMP_EXIT_STATUS`
112+
export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;
113+
echo "Exit status : $EXIT_STATUS";
114+
[ $EXIT_STATUS == 0 ] || exit 1
115+
exit 0
116+
fi
117+
60118
travis_time_start install # Use this to install any prerequisites or dependencies necessary to run your build
61119
cd ${HOME}
62120
[ -e jskeus ] || git clone --depth 1 http://github.com/euslisp/jskeus jskeus

.travis.yml

+20-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,22 @@ matrix:
1818
- env: DOCKER_IMAGE=osrf/ubuntu_arm64:xenial
1919
- env: DOCKER_IMAGE=debian:stretch
2020
- env: DOCKER_IMAGE=osrf/debian_arm64:stretch
21+
- env: QEMU=amd64 DOCKER_IMAGE=amd64/debian:unstable # amd64
22+
- env: QEMU=aarch64 DOCKER_IMAGE=arm64v8/debian:buster # arm64
23+
- env: QEMU=arm DOCKER_IMAGE=arm32v5/debian:jessie # armel
24+
- env: QEMU=arm DOCKER_IMAGE=arm32v7/debian:jessie # armhf
25+
# hppa
26+
# hurd-i386
27+
- env: QEMU=i386 DOCKER_IMAGE=i386/debian:unstable # i386
28+
# ia64
29+
# m68k
30+
- env: QEMU=mips64el DOCKER_IMAGE=loongnix/debian:buster # mips64el
31+
# mipsel
32+
# - env: QEMU=ppc DOCKER_IMAGE=vicamo/debian:unstable-powerpc # powerpc / somehow failing loading eusgl
33+
- env: QEMU=ppc64le DOCKER_IMAGE=ppc64le/debian:buster # ppc64
34+
# riscv64
35+
# sh4
36+
# sparc64
2137
- os: osx
2238
env:
2339
global:
@@ -38,11 +54,13 @@ before_install: # Use this to prepare the system to install prerequisites or dep
3854
install:
3955
- export CI_SOURCE_PATH=$(pwd)
4056
- export REPOSITORY_NAME=${PWD##*/}
57+
- if [[ "$QEMU" != "" ]]; then sudo apt-get install -y -qq qemu-user-static; ls /usr/bin/qemu-*-static; export QEMU_VOLUME="-v /usr/bin/qemu-$QEMU-static:/usr/bin/qemu-$QEMU-static" ; fi
58+
- if [[ "$QEMU" != "" ]]; then docker run --rm --privileged multiarch/qemu-user-static:register; fi
4159
- if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static; fi
4260
- if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then git clone http://github.com/euslisp/jskeus ${HOME}/jskeus; fi
4361
script:
44-
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
45-
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run --rm -i -v $HOME:$HOME -e "TRAVIS_OS_NAME=$TRAVIS_OS_NAME" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -e "MAKEFLAGS=$MAKEFLAGS" -e "DOCKER_IMAGE=$DOCKER_IMAGE" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh"; fi
62+
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME on $QEMU_VOLUME"
63+
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run --rm -i $QEMU_VOLUME -v $HOME:$HOME -e "QEMU=$QEMU" -e "TRAVIS_OS_NAME=$TRAVIS_OS_NAME" -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -e "MAKEFLAGS=$MAKEFLAGS" -e "DOCKER_IMAGE=$DOCKER_IMAGE" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh"; fi
4664
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./.travis.sh; fi
4765
after_failure:
4866
- echo "failure"

lisp/Makefile.Linux

+65-29
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
ARCH=Linux
2121
include Makefile.generic1
2222

23+
THREAD= -DTHREADED -DPTHREAD
24+
MFLAGS=
25+
XVERSION=X_V11R6_1
26+
2327
#
2428
# Select CFLAGS and XVERSION according to the version of SunOS and Xlib.
2529
#
@@ -28,42 +32,62 @@ include Makefile.generic1
2832
GCC_MAJOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\1/')
2933
GCC_MINOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\2/')
3034
# GCC_PATCH_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\3/')
35+
ifneq (,$(findstring 64,$(shell gcc -dumpmachine)))
36+
ifeq ($(GCC_MAJOR_VERSION), 2)
37+
ALIGN_FUNCTIONS="-malign-functions=8"
38+
else
39+
ALIGN_FUNCTIONS=-falign-functions=8
40+
GCC3=-DGCC3
41+
endif
42+
else
43+
ifeq ($(GCC_MAJOR_VERSION), 2)
44+
ALIGN_FUNCTIONS="-malign-functions=4"
45+
else
46+
ALIGN_FUNCTIONS=-falign-functions=4
47+
GCC3=-DGCC3
48+
endif
49+
endif
3150

3251
ADD_LDFLAGS=
3352
ifneq (,$(findstring t,$(shell if [ \( $(GCC_MAJOR_VERSION) -eq 4 -a $(GCC_MINOR_VERSION) -ge 5 \) -o $(GCC_MAJOR_VERSION) -ge 5 ] ; then echo t ;fi )))
3453
ADD_LDFLAGS += -Wl,--no-as-needed
3554
endif
3655

37-
CPU_OPTIMIZE=-march=i586
56+
# set CPU arch with -D
57+
MACHINE=$(shell uname -m)
58+
# need to set 'i486', for conditionals in c/*.[ch].
59+
ifneq ($(shell gcc -dumpmachine | grep "i.*86-linux"),)
60+
MACHINE=i486
61+
endif
3862

39-
# Pentium's arch returns 'i586', which is ignored by conditionals in c/*.[ch].
40-
MACHINE=i486
63+
DEBUG= # -g
4164

42-
# set OFLAGS either to -O or to -g.
43-
OFLAGS=-O
44-
# OFLAGS=-g
4565

4666
# If you use libc.so.5, remove -DLIB6 option.
4767
# If you use old linux that does not know mallopt, add -OLD_LINUX option.
4868

49-
#CFLAGS=-D$(MACHINE) -DLinux -DLIB6 -D_REENTRANT -DVERSION=\"$(VERSION)\" \
50-
# $(CPU_OPTIMIZE) -DGCC \
51-
# -I$(EUSDIR)/include
52-
CFLAGS=-D$(MACHINE) -DLinux -D_REENTRANT -DVERSION=\"$(VERSION)\" \
53-
-DLIB6 $(CPU_OPTIMIZE) -DGCC -falign-functions=4 \
54-
-I$(EUSDIR)/include
55-
PIC= -fpic
69+
CFLAGS:= $(CFLAGS) $(CPPFLAGS) $(WFLAGS) -D$(MACHINE) -DLinux -D_REENTRANT -DVERSION=\"$(VERSION)\" \
70+
-DLIB6 $(ALIGN_FUNCTIONS) -fsigned-char -fno-stack-protector \
71+
$(DEBUG) $(CPU_OPTIMIZE) $(THREAD) -D$(XVERSION) \
72+
-DGCC $(GCC3) \
73+
-I/usr/include -I/usr/X11R6/include -I$(EUSDIR)/include
74+
75+
# machine specific CFLAGS
76+
ifneq ($(shell gcc -dumpmachine | egrep "^(arm|aarch)"),)
77+
ADD_LDFLAGS=-Wl,-z,execstack
78+
CFLAGS+=-DARM -fPIC
79+
ARCH=LinuxARM
80+
endif
81+
ifneq ($(shell gcc -dumpmachine | grep "^x86_64"),)
82+
CFLAGS+=-fPIC
83+
ARCH=Linux64
84+
endif
5685

5786
# Use gcc for C-compiling on SunOS4. Sun's cc is ok on Solaris.
5887
# /usr/ucb/cc cannot compile because of its incapability of recognizing
5988
# prototype declarations.
6089
CC=cc
61-
# CC=gcc
62-
63-
#XVERSION=X_V11R2
64-
#XVERSION=X_V11R3
65-
#XVERSION=X_V11R4
66-
XVERSION=X_V11R6
90+
LD=ld
6791

6892
#
6993
# L I B R A R I E S
@@ -78,24 +102,36 @@ XVERSION=X_V11R6
78102
# On Solaris, XLIB and EUSLIB are combined together into lib/libeusx.so.
79103

80104
# Linux
81-
RAWLIB=-ldl -lm
105+
RAWLIB=-ldl -lm -lpthread -lc
82106
XLIB= -L/usr/X11R6/lib -lX11
83107

84108
# specify directories where euslisp's libraries are located.
85-
EUSLIB= -Xlinker -L$(ADLIBDIR)
86-
# GLLIB= -L$(ADLIBDIR) -ltk -lGLU -lGL -lXext -leusgl
87-
GLLIB= -L$(ADLIBDIR) -L/usr/local/lib -lGLU -lGL -lXext -leusgl
109+
EUSRPATH=-R$(ADLIBDIR):$(EUSDIR)/lib/Linux
110+
EUSLIB= -Xlinker $(EUSRPATH) -L$(ADLIBDIR)
111+
GLLIB= -L$(ADLIBDIR) -lGLU -lGL -lXext -leusgl
112+
113+
# POSIX Thread
114+
THREADDEP=mthread_posix.c
115+
#THREADDEP=pthreads.c
116+
117+
# If you don't like optimization, comment out the next line.
118+
OFLAGS=-O2
119+
120+
# link-editor's default flags ?-rdynamic
121+
SOFLAGS:= $(LDFLAGS) -shared -Xlinker -build-id
122+
LD=gcc
123+
LDFLAGS:= $(LDFLAGS) -rdynamic -fno-stack-protector -z execstack $(ADD_LDFLAGS)
124+
MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/mthread_posix.o
125+
#MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/pthreads.o
126+
MAPOPTION= $(OBJDIR)/par.o
88127

89-
# link-editor's default flags ?-rdynamic
90-
SOFLAGS= -shared -build-id
91-
LDFLAGS= -rdynamic $(ADD_LDFLAGS)
92-
MTOBJECTS=
93-
MTCOBJECTS=
94-
MAPOPTION=-Xlinker -Map -Xlinker $(ADLIBDIR)/eusmap
95128

96129
#################################################################
97130
# end of the customizable section
98131
################################################################
99132

100133
include Makefile.generic2
101134

135+
eusjpeg:
136+
make -C image/jpeg/ ARCHDIR=$(ARCH) EUSDIR=$(EUSDIR)
137+

lisp/c/calleus.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static char *rcsid="@(#)$Id$";
2727
#include "eus.h"
2828

2929
struct foreignpod {
30-
#if vax || sun4 || news || mips || i386 || alpha || x86_64 || ARM
30+
#if vax || sun4 || news || mips || alpha || Linux
3131
unsigned mark:1;
3232
unsigned b:1;
3333
unsigned m:1;

lisp/c/eus.c

+5
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,11 @@ static void initfeatures()
951951
#if aarch64
952952
p=cons(ctx,intern(ctx,"AARCH64",7,keywordpkg),p);
953953
#endif
954+
{
955+
char tmp[32];
956+
sprintf(tmp, "WORD-SIZE=%d", sizeof(void*)*8);
957+
p=cons(ctx,intern(ctx,tmp,strlen(tmp),keywordpkg),p);
958+
}
954959

955960
defvar(ctx,"*FEATURES*",p,lisppkg);
956961

lisp/c/eus.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/****************************************************************/
1010

1111

12-
#if (alpha || IRIX6 || x86_64 || aarch64)
12+
#if (__SIZEOF_SIZE_T__ == 8) || (alpha || IRIX6 || x86_64 || aarch64 || ppc64le)
1313
#define WORD_SIZE 64
1414
#else
1515
#define WORD_SIZE 32
@@ -378,7 +378,7 @@ struct bignum {
378378
/****************************************************************/
379379
typedef
380380
struct cell {
381-
#if vax || sun4 || news || mips || i386 || i486 || i586 || alpha || x86_64 || ARM
381+
#if vax || sun4 || news || mips || alpha || Linux
382382
unsigned mark:1;
383383
unsigned b:1;
384384
unsigned m:1;
@@ -742,7 +742,7 @@ extern int export_all;
742742
#define bpointerof(p) ((bpointer)((eusinteger_t)(p)-2))
743743
#endif
744744

745-
#if vax || sun4 || news || mips || i386 || i486 || i586 || alpha || x86_64 || ARM
745+
#if vax || sun4 || news || mips || alpha || Linux
746746

747747
#define makepointer(bp) ((pointer)((eusinteger_t)(bp)))
748748
// #define isint(p) (((eusinteger_t)(p) & 3)==2) // org
@@ -801,7 +801,7 @@ extern eusinteger_t intval(pointer p);
801801
#define bixof(p) (bpointerof(p)->h.bix)
802802
#endif
803803

804-
#if sun3 || sun4 || system5 || apollo || news || sanyo || vxworks || mips || NEXT || i386 || i486 || i586 || x86_64 || ARM
804+
#if sun3 || sun4 || system5 || apollo || news || sanyo || vxworks || mips || NEXT || Linux
805805
#if (WORD_SIZE == 64)
806806
#define fltval(p) (nu.ival=((eusinteger_t)(p) & ~3L), nu.fval)
807807
#define makeflt(f) (nu.fval=(eusfloat_t)(f), (pointer)((nu.ival & ~3L) | 1L))

lisp/c/eusstream.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ register pointer s;
8888
#if system5 || Solaris2
8989
if (c<0) { breakck; goto tryqread;}
9090
#endif
91-
#if sun3 || sun4 || vax || apollo || news || sanyo || mips || i386 || alpha || x86_64 || ARM
91+
#if sun3 || sun4 || vax || apollo || news || sanyo || mips || alpha || Linux
9292
breakck;
9393
#endif
9494
s->c.stream.buffer->c.str.length=lsave;

lisp/c/printer.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ register int prlevel;
558558
if (isnum(x)) { printnum(ctx,x,f,intval(Spevalof(PRINTBASE)),0,0); return;}
559559
else if (x==UNBOUND) { writestr(f,(byte *)"***UNBOUND***",13); return;}
560560
/*pointed object*/
561-
#if vax || sun4 || news || mips || i386 || alpha || x86_64 || ARM
561+
#if vax || sun4 || news || mips || alpha || Linux
562562
if ((x<(pointer)(ctx->stack)) && ((pointer)(ctx->stacklimit)<x)){
563563
printint(ctx,(eusinteger_t)x,f,intval(Spevalof(PRINTBASE)),0,0); return;}
564564
#endif

lisp/c/reader.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ eusinteger_t labx;
252252
#if sun3 || (!alpha && system5) || sanyo
253253
unsolp=(pointer *)unsol;
254254
#endif
255-
#if sun4 || vax || news || mips || alpha || i386
256-
unsolp=(pointer *)((eusinteger_t)unsol & ~3);/*???? */
257-
#elif (WORD_SIZE == 64)
255+
#if (WORD_SIZE == 64)
258256
unsolp=(pointer *)((eusinteger_t)unsol & ~3L);/*???? */
257+
#else
258+
unsolp=(pointer *)((eusinteger_t)unsol & ~3);/*???? */
259259
#endif
260260
unsol= *unsolp;
261261
pointer_update(*unsolp,result); }
@@ -268,7 +268,7 @@ pointer *addr;
268268
#if sun3 ||( !alpha && system5 ) || sanyo
269269
labp->c.lab.unsolved=(pointer)addr;
270270
#endif
271-
#if sun4 || vax || news || mips || alpha || i386 || x86_64 || ARM
271+
#if sun4 || vax || news || mips || alpha || Linux
272272
{ eusinteger_t i;
273273
i=(((eusinteger_t)addr)>>2);
274274
labp->c.lab.unsolved=makeint(i);}

0 commit comments

Comments
 (0)