Skip to content

Commit

Permalink
Merge pull request #3 from softdevteam/travisci
Browse files Browse the repository at this point in the history
Setup travisci to run the luajit test suite
  • Loading branch information
ltratt authored Nov 3, 2017
2 parents eaa148f + c5f6519 commit 6ac351a
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
*.manifest
*.dmp
*.swp
.tags
.tags
test/builds/
24 changes: 24 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
language: c
sudo: false

addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
env:
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0"

before_install:
- eval "${MATRIX_EVAL}"

before_script:
- ./test/setup.sh

script:
- make -C test -f test.make normal.test
- make -C test -f test.make gc64.test
- make -C test -f test.make dualnum.test
- make -C test -f test.make nojit.test

9 changes: 9 additions & 0 deletions test/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd ${DIR}

if [ ! -d "testsuite" ]; then
git clone -b lib_apichanges https://github.com/softdevteam/LuaJIT-test-cleanup testsuite
fi
64 changes: 64 additions & 0 deletions test/test.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
.SECONDEXPANSION:
all::
SRC=../src

BUILDS= normal gc64 dualnum nojit
normal : XCFLAGS=
gc64 : XCFLAGS=-DLUAJIT_ENABLE_GC64
dualnum : XCFLAGS=-DLUAJIT_NUMMODE=2
nojit : XCFLAGS=-DLUAJIT_DISABLE_JIT

SRC_LUA= $(wildcard $(SRC)/jit/*.lua)
#Skip the dynamically generated VM info file that is generated at compile time
SRC_LUA:= $(filter-out vmdef.lua,$(SRC_LUA))
LUA_NAMES= $(notdir $(SRC_LUA))

define make_buildtarget
$1_BUILD_OUTPUTS= builds/$1/libluajit.so builds/$1/luajit builds/$1/jit/vmdef.lua
$1_LUAFILES= $(addprefix builds/$1/jit/,$(LUA_NAMES))
$$($1_LUAFILES): $1.copylua
$$($1_BUILD_OUTPUTS): $1.build
$1: $$($1_BUILD_OUTPUTS) $$($1_LUAFILES)
$1: BUILD_TARGET=$1
BUILD_TARGETS += $1.build
LUA_TARGETS += $1.copylua
TEST_TARGETS += $1.test
CLEAN_TARGETS += $1.clean
endef

$(foreach build, $(BUILDS), $(eval $(call make_buildtarget,$(build))))

.INTERMEDIATE: $(BUILD_TARGETS) $(LUA_TARGETS)

%.copylua: $(SRC_LUA)
mkdir -p builds/$*/jit/
$(foreach luafile, $(SRC_LUA), $(eval $(shell cp $(luafile) builds/$*/jit/)))

%.build: $(SRC)/*.h $(SRC)/*.c
@echo "==== Building LuaJIT target = ${BUILD_TARGET} ===="
$(MAKE) -C $(SRC) -j XCFLAGS="-DLUAJIT_ENABLE_LUA52COMPAT ${XCFLAGS}"
mkdir -p builds/${BUILD_TARGET}/
cp $(SRC)/luajit builds/${BUILD_TARGET}/
cp $(SRC)/libluajit.so builds/${BUILD_TARGET}/
mkdir -p builds/${BUILD_TARGET}/jit/
cp $(SRC)/jit/vmdef.lua builds/${BUILD_TARGET}/jit/
$(MAKE) -C $(SRC) clean
@echo "==== Successfully built LuaJIT ===="

build : $(BUILDS)

all test:: $(TEST_TARGETS)

#Builds the binaries if they don't exist first
%.test: $$*
./builds/$*/luajit testsuite/test/test.lua

%.clean:
rm -f ./builds/$*/luajit
rm -f ./builds/$*/libluajit.so
rm -f ./builds/$*/jit/*.lua

clean: $(CLEAN_TARGETS)
$(MAKE) -C $(SRC) clean

.PHONY: all build test clean $(BUILDS)

0 comments on commit 6ac351a

Please sign in to comment.