diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2017-09-18 20:04:24 +0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-09-18 15:04:24 -0300 |
commit | 9cb6834fe07297ba79e7453978cf7e7d8d8c339a (patch) | |
tree | 0d5f92eafd97efaa43b2c0b67b19c7b44c35d424 | |
parent | ee2d198f62aeb52751db934a537ee6b0ef164662 (diff) | |
download | lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.tar.gz lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.tar.bz2 lua-compat-5.3-9cb6834fe07297ba79e7453978cf7e7d8d8c339a.zip |
Add Travis-CI integration
-rw-r--r-- | .travis.yml | 47 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | tests/test.lua | 8 | ||||
-rw-r--r-- | tests/testmod.c | 10 |
4 files changed, 60 insertions, 7 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..af458d8 --- /dev/null +++ b/.travis.yml | |||
@@ -0,0 +1,47 @@ | |||
1 | language: c | ||
2 | compiler: gcc | ||
3 | |||
4 | sudo: false | ||
5 | |||
6 | env: | ||
7 | - LUA="lua=5.1" | ||
8 | - LUA="lua=5.1" EXTERNAL=true | ||
9 | - LUA="lua=5.1" COMPILER="g++" | ||
10 | - LUA="lua=5.1" EXTERNAL=true COMPILER="g++" | ||
11 | - LUA="luajit=@v2.1 --compat=none" | ||
12 | - LUA="luajit=@v2.1 --compat=none" EXTERNAL=true | ||
13 | - LUA="luajit=@v2.1 --compat=all" | ||
14 | - LUA="luajit=@v2.1 --compat=all" EXTERNAL=true | ||
15 | - LUA="lua=5.2" | ||
16 | - LUA="lua=5.2" EXTERNAL=true | ||
17 | - LUA="lua=5.2" COMPILER="g++" | ||
18 | - LUA="lua=5.2" EXTERNAL=true COMPILER="g++" | ||
19 | |||
20 | branches: | ||
21 | only: | ||
22 | - master | ||
23 | |||
24 | git: | ||
25 | depth: 3 | ||
26 | |||
27 | notifications: | ||
28 | email: false | ||
29 | |||
30 | before_install: | ||
31 | - pip install --user hererocks | ||
32 | - hererocks old --$LUA | ||
33 | - test -e old/bin/lua || (cd old/bin && ln -s luajit* lua) | ||
34 | - hererocks new --lua=5.3 | ||
35 | |||
36 | install: | ||
37 | - export CC="${COMPILER:-gcc}" DEF="" SRC="" CFLAGS="-Wall -Wextra -Ic-api -O2 -fPIC" | ||
38 | - if [ "x${EXTERNAL:-}" = xtrue ]; then DEF="-DCOMPAT53_PREFIX=compat53" SRC="c-api/compat-5.3.c"; fi | ||
39 | - ${CC} ${CFLAGS} -Iold/include ${DEF} -shared -o old/testmod.so tests/testmod.c ${SRC} | ||
40 | - ${CC} ${CFLAGS} -Inew/include ${DEF} -shared -o new/testmod.so tests/testmod.c ${SRC} | ||
41 | - gcc ${CFLAGS} -Iold/include ${DEF} -shared -o old/compat53.so ltablib.c lutf8lib.c lstrlib.c ${SRC} | ||
42 | |||
43 | script: | ||
44 | - (cd old && bin/lua ../tests/test.lua) > old.txt | ||
45 | - (cd new && bin/lua ../tests/test.lua) > new.txt | ||
46 | - diff old.txt new.txt || true | ||
47 | |||
@@ -1,3 +1,5 @@ | |||
1 | [](https://travis-ci.org/keplerproject/lua-compat-5.3) | ||
2 | |||
1 | # lua-compat-5.3 | 3 | # lua-compat-5.3 |
2 | 4 | ||
3 | Lua-5.3-style APIs for Lua 5.2 and 5.1. | 5 | Lua-5.3-style APIs for Lua 5.2 and 5.1. |
diff --git a/tests/test.lua b/tests/test.lua index 8fafdf3..2f6c7f6 100755 --- a/tests/test.lua +++ b/tests/test.lua | |||
@@ -40,7 +40,7 @@ local mode = "global" | |||
40 | if arg[1] == "module" then | 40 | if arg[1] == "module" then |
41 | mode = "module" | 41 | mode = "module" |
42 | end | 42 | end |
43 | 43 | local self = arg[0] | |
44 | 44 | ||
45 | package.path = "../?.lua;../?/init.lua" | 45 | package.path = "../?.lua;../?/init.lua" |
46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" | 46 | package.cpath = "./?-"..V..".so;./?-"..V..".dll;./?.so;./?.dll" |
@@ -603,11 +603,11 @@ end | |||
603 | ___'' | 603 | ___'' |
604 | do | 604 | do |
605 | writefile("data.txt", "123 18.8 hello world\ni'm here\n") | 605 | writefile("data.txt", "123 18.8 hello world\ni'm here\n") |
606 | for a,b in io.lines("test.lua", 2, "*l") do | 606 | for a,b in io.lines(self, 2, "*l") do |
607 | print("io.lines()", a, b) | 607 | print("io.lines()", a, b) |
608 | break | 608 | break |
609 | end | 609 | end |
610 | for l in io.lines("test.lua") do | 610 | for l in io.lines(self) do |
611 | print("io.lines()", l) | 611 | print("io.lines()", l) |
612 | break | 612 | break |
613 | end | 613 | end |
@@ -624,7 +624,7 @@ do | |||
624 | for l in io.lines("no_such_file.txt") do print(l) end | 624 | for l in io.lines("no_such_file.txt") do print(l) end |
625 | end)) | 625 | end)) |
626 | if mode ~= "module" then | 626 | if mode ~= "module" then |
627 | local f = assert(io.open("test.lua", "r")) | 627 | local f = assert(io.open(self, "r")) |
628 | for a,b in f:lines(2, "*l") do | 628 | for a,b in f:lines(2, "*l") do |
629 | print("file:lines()", a, b) | 629 | print("file:lines()", a, b) |
630 | break | 630 | break |
diff --git a/tests/testmod.c b/tests/testmod.c index 1034d20..a0d2e2a 100644 --- a/tests/testmod.c +++ b/tests/testmod.c | |||
@@ -1,7 +1,5 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <lua.h> | ||
4 | #include <lauxlib.h> | ||
5 | #include "compat-5.3.h" | 3 | #include "compat-5.3.h" |
6 | 4 | ||
7 | 5 | ||
@@ -12,7 +10,7 @@ static int test_isinteger (lua_State *L) { | |||
12 | 10 | ||
13 | 11 | ||
14 | static int test_rotate (lua_State *L) { | 12 | static int test_rotate (lua_State *L) { |
15 | int r = luaL_checkint(L, 1); | 13 | int r = (int)luaL_checkinteger(L, 1); |
16 | int n = lua_gettop(L)-1; | 14 | int n = lua_gettop(L)-1; |
17 | luaL_argcheck(L, (r < 0 ? -r : r) <= n, 1, "not enough arguments"); | 15 | luaL_argcheck(L, (r < 0 ? -r : r) <= n, 1, "not enough arguments"); |
18 | lua_rotate(L, 2, r); | 16 | lua_rotate(L, 2, r); |
@@ -336,6 +334,9 @@ static const luaL_Reg more_funcs[] = { | |||
336 | }; | 334 | }; |
337 | 335 | ||
338 | 336 | ||
337 | #ifdef __cplusplus | ||
338 | extern "C" { | ||
339 | #endif | ||
339 | int luaopen_testmod (lua_State *L) { | 340 | int luaopen_testmod (lua_State *L) { |
340 | int i = 1; | 341 | int i = 1; |
341 | luaL_newlib(L, funcs); | 342 | luaL_newlib(L, funcs); |
@@ -344,4 +345,7 @@ int luaopen_testmod (lua_State *L) { | |||
344 | luaL_setfuncs(L, more_funcs, NUP); | 345 | luaL_setfuncs(L, more_funcs, NUP); |
345 | return 1; | 346 | return 1; |
346 | } | 347 | } |
348 | #ifdef __cplusplus | ||
349 | } | ||
350 | #endif | ||
347 | 351 | ||