Skip to content

Commit 5def7dd

Browse files
committed
bugfix: support to run the test case with luarocks + Lua 5.3 .
1 parent 0c4ac74 commit 5def7dd

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2+
# dev
13
test*.lua
24
go
35
\.*
6+
deps

Makefile

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
OR_EXEC ?= $(shell which openresty)
22
LUA_JIT_DIR ?= $(shell ${OR_EXEC} -V 2>&1 | grep prefix | grep -Eo 'prefix=(.*?)/nginx' | grep -Eo '/.*/')luajit
33
LUAROCKS_VER ?= $(shell luarocks --version | grep -E -o "luarocks [0-9]+.")
4-
LUA_PATH ?= $(shell luajit -e "print(package.path)")
5-
LUA_CPATH ?= $(shell luajit -e "print(package.cpath)")
4+
LUA_PATH ?= "./lib/?.lua;./deps/lib/lua/5.1/?.lua;./deps/share/lua/5.1/?.lua;;"
5+
LUA_CPATH ?= "./deps/lib/lua/5.1/?.so;;"
66

77

88
### help: Show Makefile rules.
@@ -14,28 +14,29 @@ help:
1414

1515

1616
### dev: Create a development ENV
17-
.PHONY: dev
17+
.PHONY: deps
1818
dev:
19+
git submodule update --init --recursive
20+
mkdir -p deps
1921
ifeq ($(LUAROCKS_VER),luarocks 3.)
20-
luarocks install --lua-dir=$(LUA_JIT_DIR) rockspec/jsonschema-master-0.rockspec --only-deps
21-
luarocks install --lua-dir=$(LUA_JIT_DIR) luaposix
22+
luarocks install --lua-dir=$(LUA_JIT_DIR) rockspec/jsonschema-master-0.rockspec --only-deps --tree=deps --local
23+
luarocks install --lua-dir=$(LUA_JIT_DIR) luaposix --tree=deps --local
2224
else
23-
luarocks install rockspec/jsonschema-master-0.rockspec --only-deps
24-
luarocks install luaposix
25+
luarocks install rockspec/jsonschema-master-0.rockspec --only-deps --tree=deps --local
26+
luarocks install luaposix --tree=deps --local
2527
endif
2628

2729

2830
### test: Run the test case
2931
test:
30-
LUA_PATH="./lib/?.lua;$(LUA_PATH)" LUA_CPATH="$(LUA_CPATH)" resty t/draft4.lua
31-
LUA_PATH="./lib/?.lua;$(LUA_PATH)" LUA_CPATH="$(LUA_CPATH)" resty t/draft6.lua
32-
LUA_PATH="./lib/?.lua;$(LUA_PATH)" LUA_CPATH="$(LUA_CPATH)" resty t/draft7.lua
33-
LUA_PATH="./lib/?.lua;$(LUA_PATH)" LUA_CPATH="$(LUA_CPATH)" resty t/default.lua
32+
LUA_PATH=$(LUA_PATH) LUA_CPATH=$(LUA_CPATH) resty t/draft4.lua
33+
LUA_PATH=$(LUA_PATH) LUA_CPATH=$(LUA_CPATH) resty t/draft6.lua
34+
LUA_PATH=$(LUA_PATH) LUA_CPATH=$(LUA_CPATH) resty t/draft7.lua
35+
LUA_PATH=$(LUA_PATH) LUA_CPATH=$(LUA_CPATH) resty t/default.lua
3436

3537

36-
### help: Show Makefile rules.
37-
.PHONY: help
38-
help:
39-
@echo Makefile rules:
40-
@echo
41-
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
38+
### clean: Clean the test case
39+
.PHONY: clean
40+
clean:
41+
@rm -rf deps
42+

0 commit comments

Comments
 (0)