forked from github/server
replace config.install with environment variable
This commit is contained in:
parent
6176e5e754
commit
2bb18d27bc
|
@ -1,3 +1,15 @@
|
|||
local path = os.getenv("ERESSEA_DIR")
|
||||
if not path then
|
||||
if config.install then
|
||||
path = config.install
|
||||
else
|
||||
path = '.'
|
||||
end
|
||||
else
|
||||
config.install = path
|
||||
end
|
||||
path = path .. "/scripts"
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
if config.paths ~= nil then
|
||||
for path in string.gmatch(config.paths, "([^:]+)") do
|
||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
local path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
end
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
|
||||
require 'eressea.path'
|
||||
require 'eressea'
|
||||
require 'eressea.xmlconf'
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
-- Tests that work in all games. With game config of E2.
|
||||
-- Tests are under scripts/test/e2 and all files must be in scripts/test/e2/init.lua
|
||||
|
||||
lunit = require('lunit')
|
||||
config.rules = 'e2'
|
||||
lunit = require 'lunit'
|
||||
if _VERSION >= 'Lua 5.2' then
|
||||
module = lunit.module
|
||||
end
|
||||
|
||||
path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
end
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
|
||||
config.rules = 'e2'
|
||||
|
||||
require 'eressea.path'
|
||||
require 'eressea'
|
||||
require 'eressea.xmlconf'
|
||||
require 'eressea.path'
|
||||
require 'tests.e2'
|
||||
|
||||
rng.inject(0)
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
-- Tests that work in E3. With game config of E3.
|
||||
-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua
|
||||
|
||||
lunit = require('lunit')
|
||||
config.rules = 'e3'
|
||||
lunit = require 'lunit'
|
||||
if _VERSION >= 'Lua 5.2' then
|
||||
module = lunit.module
|
||||
end
|
||||
|
||||
path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
end
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
|
||||
config.rules = 'e3'
|
||||
|
||||
require 'eressea'
|
||||
require 'eressea.path'
|
||||
require 'eressea'
|
||||
require 'eressea.xmlconf'
|
||||
require 'tests.e3'
|
||||
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
-- Basic test without loading XML Config. Test care about needed settings.
|
||||
-- Tests are under scripts/test/ and all files must be in scripts/test/init.lua
|
||||
|
||||
lunit = require('lunit')
|
||||
lunit = require 'lunit'
|
||||
if _VERSION >= 'Lua 5.2' then
|
||||
module = lunit.module
|
||||
end
|
||||
|
||||
path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
end
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
|
||||
require 'eressea'
|
||||
require 'eressea.path'
|
||||
require 'eressea'
|
||||
require 'tests'
|
||||
result = lunit.main()
|
||||
return result.errors + result.failed
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'eressea.path'
|
||||
|
||||
function nmr_check(maxnmrs)
|
||||
local nmrs = get_nmrs(1)
|
||||
if nmrs > maxnmrs then
|
||||
|
@ -188,11 +190,6 @@ end
|
|||
|
||||
math.randomseed(rng.random())
|
||||
|
||||
local path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
end
|
||||
package.path = path .. '/?.lua;' .. path .. '/?/init.lua;' .. package.path
|
||||
require 'eressea'
|
||||
require 'eressea.xmlconf' -- read xml data
|
||||
|
||||
|
|
|
@ -5,10 +5,12 @@ IF EXIST ..\build-vs12 SET BUILD=..\build-vs12\Debug
|
|||
IF EXIST ..\build-vs14 SET BUILD=..\build-vs14\Debug
|
||||
IF EXIST ..\build-vs15 SET BUILD=..\build-vs15\Debug
|
||||
IF EXIST ..\build-vs16 SET BUILD=..\build-vs16\Debug
|
||||
IF EXIST ..\out\build\x86-Debug\eressea.exe SET BUILD=..\out\build\x86-Debug
|
||||
IF EXIST ..\out\build\x64-Debug\eressea.exe SET BUILD=..\out\build\x64-Debug
|
||||
|
||||
SET SERVER=%BUILD%\eressea.exe
|
||||
%BUILD%\test_eressea.exe
|
||||
REM SET LUA_PATH=..\share\lua\5.4\?.lua;;
|
||||
SET LUA_PATH=..\scripts\?.lua;..\share\lua\5.4\?.lua;;
|
||||
|
||||
%SERVER% -v1 ..\scripts\run-tests.lua
|
||||
%SERVER% -v1 -re2 ..\scripts\run-tests-e2.lua
|
||||
|
|
Loading…
Reference in New Issue