Skip to content

Commit

Permalink
Set working directory in unittest script
Browse files Browse the repository at this point in the history
  • Loading branch information
ludocode committed Aug 26, 2019
1 parent 069b160 commit e76ea66
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tools/unittest.lua
Expand Up @@ -28,6 +28,10 @@
--
-- This requires at least Lua 5.1, with rocks luafilesystem and rapidjson.

---------------------------------------------------
-- Dependencies
---------------------------------------------------

require 'lfs'
local rapidjson = require 'rapidjson'

Expand All @@ -53,9 +57,18 @@ function execute(args)
end

---------------------------------------------------
-- Load Cached Config
-- Setup
---------------------------------------------------

-- switch working directory to root of library
if debug.getinfo(1) ~= nil and debug.getinfo(1).short_src ~= nil then
local debugname = debug.getinfo(1).short_src
if debugname:find("/") then
debugname = string.gsub(debugname, "(.*/)(.*)", "%1")
lfs.chdir(debugname .. "/..")
end
end

local ccvar = os.getenv("CC")
local config = {ccvar = os.getenv("CC")}

Expand Down

0 comments on commit e76ea66

Please sign in to comment.