forked from sogou/workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
44 lines (38 loc) · 1.11 KB
/
Copy pathxmake.lua
File metadata and controls
44 lines (38 loc) · 1.11 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
set_group("test")
set_default(false)
add_requires("gtest")
add_deps("workflow")
add_packages("gtest")
add_links("gtest_main")
if not is_plat("macosx") then
add_ldflags("-lrt")
end
function all_tests()
local res = {}
for _, x in ipairs(os.files("**.cc")) do
local item = {}
local s = path.filename(x)
if ((s == "upstream_unittest.cc" and not has_config("upstream")) or
(s == "redis_unittest.cc" and not has_config("redis")) or
(s == "mysql_unittest.cc" and not has_config("mysql"))) then
else
table.insert(item, s:sub(1, #s - 3)) -- target
table.insert(item, path.relative(x, ".")) -- source
table.insert(res, item)
end
end
return res
end
for _, test in ipairs(all_tests()) do
target(test[1])
set_kind("binary")
add_files(test[2])
if has_config("memcheck") then
on_run(function (target)
local argv = {}
table.insert(argv, target:targetfile())
table.insert(argv, "--leak-check=full")
os.execv("valgrind", argv)
end)
end
end