Skip to content

Commit

Permalink
Merge pull request #409 from k-okada/add_multiarch_test
Browse files Browse the repository at this point in the history
add multi-arch test for .travis.yml
  • Loading branch information
k-okada authored Feb 19, 2020
2 parents dbf79e6 + bd01530 commit b970573
Show file tree
Hide file tree
Showing 26 changed files with 233 additions and 113 deletions.
58 changes: 58 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,64 @@ if [ "$TRAVIS_OS_NAME" == "osx" ]; then

fi

### for multiarch compile test
if [ "$QEMU" != "" ]; then
travis_time_start install.dpkg-dev
apt-get install -qq -y dpkg-dev
travis_time_end

echo "uname -a : $(uname -a)"
echo "uname -m : $(uname -m)"
echo "gcc -dumpmachine : $(gcc -dumpmachine)"
echo "gcc -dumpversion : $(gcc -dumpversion)"
echo "getconf LONG_BIT : $(getconf LONG_BIT)"

travis_time_start compile.euslisp
export EUSDIR=`pwd`
eval "$(dpkg-buildflags --export=sh)"
make -C lisp -f Makefile.Linux eus0 eus1 eus2 eusg eusx eusgl eus eusjpeg
travis_time_end

if [[ `gcc -dumpmachine | egrep "^(arm|aarch)"` != "" ]]; then
export ARCHDIR=LinuxARM
elif [[ `gcc -dumpmachine | egrep "^x86_64"` != "" ]]; then
export ARCHDIR=Linux64
else
export ARCHDIR=Linux
fi
export PATH=`pwd`/$ARCHDIR/bin:$PATH

export EXIT_STATUS=0;
set +e
# run test in EusLisp/test
for test_l in test/*.l; do

travis_time_start euslisp.${test_l##*/}.test

sed -i 's/\(i-max\ [0-9]000\)0*/\1/' $test_l

eusgl $test_l;
export TMP_EXIT_STATUS=$?

travis_time_end `expr 32 - $TMP_EXIT_STATUS`

export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;
done;
echo "Exit status : $EXIT_STATUS";

travis_time_start euslisp.eusjpeg.test

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))'

export TMP_EXIT_STATUS=$?

travis_time_end `expr 32 - $TMP_EXIT_STATUS`
export EXIT_STATUS=`expr $TMP_EXIT_STATUS + $EXIT_STATUS`;
echo "Exit status : $EXIT_STATUS";
[ $EXIT_STATUS == 0 ] || exit 1
exit 0
fi

travis_time_start install # Use this to install any prerequisites or dependencies necessary to run your build
cd ${HOME}
[ -e jskeus ] || git clone --depth 1 http://github.com/euslisp/jskeus jskeus
Expand Down
22 changes: 20 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ matrix:
- env: DOCKER_IMAGE=osrf/ubuntu_arm64:xenial
- env: DOCKER_IMAGE=debian:stretch
- env: DOCKER_IMAGE=osrf/debian_arm64:stretch
- env: QEMU=amd64 DOCKER_IMAGE=amd64/debian:unstable # amd64
- env: QEMU=aarch64 DOCKER_IMAGE=arm64v8/debian:buster # arm64
- env: QEMU=arm DOCKER_IMAGE=arm32v5/debian:jessie # armel
- env: QEMU=arm DOCKER_IMAGE=arm32v7/debian:jessie # armhf
# hppa
# hurd-i386
- env: QEMU=i386 DOCKER_IMAGE=i386/debian:unstable # i386
# ia64
# m68k
- env: QEMU=mips64el DOCKER_IMAGE=loongnix/debian:buster # mips64el
# mipsel
# - env: QEMU=ppc DOCKER_IMAGE=vicamo/debian:unstable-powerpc # powerpc / somehow failing loading eusgl
- env: QEMU=ppc64le DOCKER_IMAGE=ppc64le/debian:buster # ppc64
# riscv64
# sh4
# sparc64
- os: osx
env:
global:
Expand All @@ -38,11 +54,13 @@ before_install: # Use this to prepare the system to install prerequisites or dep
install:
- export CI_SOURCE_PATH=$(pwd)
- export REPOSITORY_NAME=${PWD##*/}
- 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
- if [[ "$QEMU" != "" ]]; then docker run --rm --privileged multiarch/qemu-user-static:register; fi
- if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then sudo apt-get install -y -qq qemu-user-static; fi
- if [[ "$DOCKER_IMAGE" == *"arm"* ]]; then git clone http://github.com/euslisp/jskeus ${HOME}/jskeus; fi
script:
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
- 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
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME on $QEMU_VOLUME"
- 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
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./.travis.sh; fi
after_failure:
- echo "failure"
Expand Down
94 changes: 65 additions & 29 deletions lisp/Makefile.Linux
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
ARCH=Linux
include Makefile.generic1

THREAD= -DTHREADED -DPTHREAD
MFLAGS=
XVERSION=X_V11R6_1

#
# Select CFLAGS and XVERSION according to the version of SunOS and Xlib.
#
Expand All @@ -28,42 +32,62 @@ include Makefile.generic1
GCC_MAJOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\1/')
GCC_MINOR_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\+\).*/\2/')
# GCC_PATCH_VERSION=$(shell gcc -dumpversion | sed -e 's/\([0-9]\)\.\([0-9]\)\.\([0-9]\)/\3/')
ifneq (,$(findstring 64,$(shell gcc -dumpmachine)))
ifeq ($(GCC_MAJOR_VERSION), 2)
ALIGN_FUNCTIONS="-malign-functions=8"
else
ALIGN_FUNCTIONS=-falign-functions=8
GCC3=-DGCC3
endif
else
ifeq ($(GCC_MAJOR_VERSION), 2)
ALIGN_FUNCTIONS="-malign-functions=4"
else
ALIGN_FUNCTIONS=-falign-functions=4
GCC3=-DGCC3
endif
endif

ADD_LDFLAGS=
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 )))
ADD_LDFLAGS += -Wl,--no-as-needed
endif

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

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

# set OFLAGS either to -O or to -g.
OFLAGS=-O
# OFLAGS=-g

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

#CFLAGS=-D$(MACHINE) -DLinux -DLIB6 -D_REENTRANT -DVERSION=\"$(VERSION)\" \
# $(CPU_OPTIMIZE) -DGCC \
# -I$(EUSDIR)/include
CFLAGS=-D$(MACHINE) -DLinux -D_REENTRANT -DVERSION=\"$(VERSION)\" \
-DLIB6 $(CPU_OPTIMIZE) -DGCC -falign-functions=4 \
-I$(EUSDIR)/include
PIC= -fpic
CFLAGS:= $(CFLAGS) $(CPPFLAGS) $(WFLAGS) -D$(MACHINE) -DLinux -D_REENTRANT -DVERSION=\"$(VERSION)\" \
-DLIB6 $(ALIGN_FUNCTIONS) -fsigned-char -fno-stack-protector \
$(DEBUG) $(CPU_OPTIMIZE) $(THREAD) -D$(XVERSION) \
-DGCC $(GCC3) \
-I/usr/include -I/usr/X11R6/include -I$(EUSDIR)/include

# machine specific CFLAGS
ifneq ($(shell gcc -dumpmachine | egrep "^(arm|aarch)"),)
ADD_LDFLAGS=-Wl,-z,execstack
CFLAGS+=-DARM -fPIC
ARCH=LinuxARM
endif
ifneq ($(shell gcc -dumpmachine | grep "^x86_64"),)
CFLAGS+=-fPIC
ARCH=Linux64
endif

# Use gcc for C-compiling on SunOS4. Sun's cc is ok on Solaris.
# /usr/ucb/cc cannot compile because of its incapability of recognizing
# prototype declarations.
CC=cc
# CC=gcc

#XVERSION=X_V11R2
#XVERSION=X_V11R3
#XVERSION=X_V11R4
XVERSION=X_V11R6
LD=ld

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

# Linux
RAWLIB=-ldl -lm
RAWLIB=-ldl -lm -lpthread -lc
XLIB= -L/usr/X11R6/lib -lX11

# specify directories where euslisp's libraries are located.
EUSLIB= -Xlinker -L$(ADLIBDIR)
# GLLIB= -L$(ADLIBDIR) -ltk -lGLU -lGL -lXext -leusgl
GLLIB= -L$(ADLIBDIR) -L/usr/local/lib -lGLU -lGL -lXext -leusgl
EUSRPATH=-R$(ADLIBDIR):$(EUSDIR)/lib/Linux
EUSLIB= -Xlinker $(EUSRPATH) -L$(ADLIBDIR)
GLLIB= -L$(ADLIBDIR) -lGLU -lGL -lXext -leusgl

# POSIX Thread
THREADDEP=mthread_posix.c
#THREADDEP=pthreads.c

# If you don't like optimization, comment out the next line.
OFLAGS=-O2

# link-editor's default flags ?-rdynamic
SOFLAGS:= $(LDFLAGS) -shared -Xlinker -build-id
LD=gcc
LDFLAGS:= $(LDFLAGS) -rdynamic -fno-stack-protector -z execstack $(ADD_LDFLAGS)
MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/mthread_posix.o
#MTCOBJECTS= $(OBJDIR)/mthread.o $(OBJDIR)/pthreads.o
MAPOPTION= $(OBJDIR)/par.o

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

#################################################################
# end of the customizable section
################################################################

include Makefile.generic2

eusjpeg:
make -C image/jpeg/ ARCHDIR=$(ARCH) EUSDIR=$(EUSDIR)

2 changes: 1 addition & 1 deletion lisp/c/calleus.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static char *rcsid="@(#)$Id$";
#include "eus.h"

struct foreignpod {
#if vax || sun4 || news || mips || i386 || alpha || x86_64 || ARM
#if vax || sun4 || news || mips || alpha || Linux
unsigned mark:1;
unsigned b:1;
unsigned m:1;
Expand Down
5 changes: 5 additions & 0 deletions lisp/c/eus.c
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,11 @@ static void initfeatures()
#if aarch64
p=cons(ctx,intern(ctx,"AARCH64",7,keywordpkg),p);
#endif
{
char tmp[32];
sprintf(tmp, "WORD-SIZE=%d", sizeof(void*)*8);
p=cons(ctx,intern(ctx,tmp,strlen(tmp),keywordpkg),p);
}

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

Expand Down
8 changes: 4 additions & 4 deletions lisp/c/eus.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/****************************************************************/


#if (alpha || IRIX6 || x86_64 || aarch64)
#if (__SIZEOF_SIZE_T__ == 8) || (alpha || IRIX6 || x86_64 || aarch64 || ppc64le)
#define WORD_SIZE 64
#else
#define WORD_SIZE 32
Expand Down Expand Up @@ -378,7 +378,7 @@ struct bignum {
/****************************************************************/
typedef
struct cell {
#if vax || sun4 || news || mips || i386 || i486 || i586 || alpha || x86_64 || ARM
#if vax || sun4 || news || mips || alpha || Linux
unsigned mark:1;
unsigned b:1;
unsigned m:1;
Expand Down Expand Up @@ -742,7 +742,7 @@ extern int export_all;
#define bpointerof(p) ((bpointer)((eusinteger_t)(p)-2))
#endif

#if vax || sun4 || news || mips || i386 || i486 || i586 || alpha || x86_64 || ARM
#if vax || sun4 || news || mips || alpha || Linux

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

#if sun3 || sun4 || system5 || apollo || news || sanyo || vxworks || mips || NEXT || i386 || i486 || i586 || x86_64 || ARM
#if sun3 || sun4 || system5 || apollo || news || sanyo || vxworks || mips || NEXT || Linux
#if (WORD_SIZE == 64)
#define fltval(p) (nu.ival=((eusinteger_t)(p) & ~3L), nu.fval)
#define makeflt(f) (nu.fval=(eusfloat_t)(f), (pointer)((nu.ival & ~3L) | 1L))
Expand Down
2 changes: 1 addition & 1 deletion lisp/c/eusstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ register pointer s;
#if system5 || Solaris2
if (c<0) { breakck; goto tryqread;}
#endif
#if sun3 || sun4 || vax || apollo || news || sanyo || mips || i386 || alpha || x86_64 || ARM
#if sun3 || sun4 || vax || apollo || news || sanyo || mips || alpha || Linux
breakck;
#endif
s->c.stream.buffer->c.str.length=lsave;
Expand Down
2 changes: 1 addition & 1 deletion lisp/c/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ register int prlevel;
if (isnum(x)) { printnum(ctx,x,f,intval(Spevalof(PRINTBASE)),0,0); return;}
else if (x==UNBOUND) { writestr(f,(byte *)"***UNBOUND***",13); return;}
/*pointed object*/
#if vax || sun4 || news || mips || i386 || alpha || x86_64 || ARM
#if vax || sun4 || news || mips || alpha || Linux
if ((x<(pointer)(ctx->stack)) && ((pointer)(ctx->stacklimit)<x)){
printint(ctx,(eusinteger_t)x,f,intval(Spevalof(PRINTBASE)),0,0); return;}
#endif
Expand Down
8 changes: 4 additions & 4 deletions lisp/c/reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ eusinteger_t labx;
#if sun3 || (!alpha && system5) || sanyo
unsolp=(pointer *)unsol;
#endif
#if sun4 || vax || news || mips || alpha || i386
unsolp=(pointer *)((eusinteger_t)unsol & ~3);/*???? */
#elif (WORD_SIZE == 64)
#if (WORD_SIZE == 64)
unsolp=(pointer *)((eusinteger_t)unsol & ~3L);/*???? */
#else
unsolp=(pointer *)((eusinteger_t)unsol & ~3);/*???? */
#endif
unsol= *unsolp;
pointer_update(*unsolp,result); }
Expand All @@ -268,7 +268,7 @@ pointer *addr;
#if sun3 ||( !alpha && system5 ) || sanyo
labp->c.lab.unsolved=(pointer)addr;
#endif
#if sun4 || vax || news || mips || alpha || i386 || x86_64 || ARM
#if sun4 || vax || news || mips || alpha || Linux
{ eusinteger_t i;
i=(((eusinteger_t)addr)>>2);
labp->c.lab.unsolved=makeint(i);}
Expand Down
Loading

1 comment on commit b970573

@k-okada
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing EusLisp documentation

Please check latest documents before merging

PDF version of English manual: manual.pdf
PDF version of Japanese jmanual: jmanual.pdf
HTML version of English manual: manual.html
HTML version of Japanese manual: jmanual.html
Sphinx (ReST) version of English manual: manual.rst

Please sign in to comment.