forked from mia/Aegisub
Add support for using busted 2.0 to run automation tests
Supply a definition of socket.gettime() to remove the dependency on LuaSocket, as installing binary deps from luarocks doesn't work with a custom build of luajit.
This commit is contained in:
parent
3747705a43
commit
26361c5003
3 changed files with 24 additions and 3 deletions
|
@ -10,7 +10,7 @@ before_install:
|
|||
- sudo pip install cpp-coveralls
|
||||
install:
|
||||
- sudo apt-get install -y -qq libasound2-dev libfftw3-dev libhunspell-dev yasm libfribidi-dev libass-dev libffms2-dev libwxgtk3.0-dev libicu-dev luarocks
|
||||
- sudo luarocks install busted 1.10.0 > /dev/null
|
||||
- sudo luarocks install busted > /dev/null
|
||||
- sudo luarocks install moonscript > /dev/null
|
||||
- sudo luarocks install uuid > /dev/null
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ aegisub-lua_LIBS := $(LIBS_WX) $(LIBS_BOOST) $(LIBS_ICU)
|
|||
PROGRAM += $(d)aegisub-lua
|
||||
|
||||
test-automation: $(PROGRAM)
|
||||
eval `luarocks path`; cd $(TOP)automation; LUA=./aegisub-lua busted -p 'moon' tests/modules
|
||||
eval `luarocks path`; cd $(TOP)automation; ./aegisub-lua tests/busted.lua -p 'moon' tests/modules
|
||||
|
||||
test: test-automation
|
||||
|
||||
|
|
|
@ -1 +1,22 @@
|
|||
require 'busted.runner'({ batch = true })
|
||||
local ffi = require("ffi")
|
||||
|
||||
ffi.cdef[[
|
||||
typedef struct timeval {
|
||||
long tv_sec;
|
||||
long tv_usec;
|
||||
} timeval;
|
||||
|
||||
int gettimeofday(timeval *t, void *tzp);
|
||||
]]
|
||||
|
||||
-- busted depends on luasocket just for gettime(), so just supply a definition
|
||||
-- of that to avoid the dep
|
||||
package.loaded['socket'] = {
|
||||
gettime = function()
|
||||
local t = ffi.new("timeval")
|
||||
ffi.C.gettimeofday(t, nil)
|
||||
return tonumber(t.tv_sec) + tonumber(t.tv_usec) / 1000000.0
|
||||
end
|
||||
}
|
||||
|
||||
require 'busted.runner'({ batch = true, standalone = false })
|
||||
|
|
Loading…
Reference in a new issue