test: supported to run test case if the dependency files are installed

to `deps` folder.
This commit is contained in:
Yuansheng 2019-06-20 16:43:01 +08:00
parent 9d1c277d05
commit 0f5a80441d
3 changed files with 17 additions and 7 deletions

View File

@ -21,7 +21,7 @@ help:
.PHONY: dev
dev:
./utils/update_nginx_conf_dev.sh
sudo luarocks install apisix-*.rockspec --only-deps --tree deps
sudo luarocks install apisix-*.rockspec --tree deps
### check: Check Lua srouce code

View File

@ -1,5 +1,18 @@
#! /usr/bin/lua
-- _VERSION = "Lua 5.*"
local lua_ver = string.sub(_VERSION, #"Lua " + 1)
local cur_dir = os.getenv("PWD")
package.cpath = "/usr/local/apisix/deps/lib64/lua/" .. lua_ver .. "/?.so;"
.. cur_dir .. "/deps/lib64/lua/" .. lua_ver .. "/?.so;"
.. package.cpath
package.path = cur_dir .. "/?.lua;"
.. "/usr/local/apisix/deps/share/lua/" .. lua_ver .. "/?.lua;"
.. cur_dir .. "/deps/share/lua/" .. lua_ver .. "/?.lua;"
.. package.path
local yaml = require("apisix.lua.apisix.core.yaml")
local template = require("resty.template")
local apisix_home = "/usr/local/apisix"
@ -213,16 +226,13 @@ local function init()
error("failed to find the Lua source code home path")
end
-- _VERSION = "Lua 5.*"
local lua_version = string.sub(_VERSION, #"Lua " + 1)
-- -- Using template.render
local sys_conf = setmetatable({
lua_path = package.path,
lua_cpath = package.cpath,
os_name = exec("uname"),
apisix_lua_home = apisix_src_path,
lua_version = lua_version,
lua_version = lua_ver,
}, {__index = yaml_conf.apisix})
-- print(sys_conf.allow_admin)

View File

@ -33,8 +33,8 @@ _EOC_
my $http_config = $block->http_config // '';
$http_config .= <<_EOC_;
lua_package_path "$pwd/lua/?.lua;$pwd/t/?.lua;/usr/share/lua/5.1/?.lua;;";
lua_package_cpath '/usr/lib64/lua/5.1/?.so;;';
lua_package_path "$pwd/deps/share/lua/5.1/?.lua;$pwd/lua/?.lua;$pwd/t/?.lua;/usr/share/lua/5.1/?.lua;;";
lua_package_cpath "$pwd/deps/lib64/lua/5.1/?.so;/usr/lib64/lua/5.1/?.so;;";
lua_shared_dict plugin-limit-req 10m;
lua_shared_dict plugin-limit-count 10m;