forked from actboy168/lua-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterceptor.lua
More file actions
44 lines (40 loc) · 1.09 KB
/
interceptor.lua
File metadata and controls
44 lines (40 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
local fs = require "bee.filesystem"
local sp = require "bee.subprocess"
local all_tests = {}
local function find_directory_test(dir)
for file in fs.pairs(dir) do
if fs.is_directory(file) then
find_directory_test(file)
else
local filename = file:filename()
local ext = file:extension()
if tostring(filename):find("test_") and (ext:find(".exe") or ext == "" or ext == nil )then
table.insert(all_tests, tostring(file))
end
end
end
end
find_directory_test("build")
local function run_tests()
local res = true
for i, test in ipairs(all_tests) do
print(("%d/%d : %s"):format(i, #all_tests, test))
local p, err = sp.spawn({
test,
})
if not p then
res = false
print("can't run:", test, "err:", err)
else
local ec = p:wait()
if ec ~= 0 then
print("test return not 0")
res = false
end
end
end
return res
end
if not run_tests() then
os.exit(1)
end