-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathtest.lua
More file actions
42 lines (38 loc) · 941 Bytes
/
test.lua
File metadata and controls
42 lines (38 loc) · 941 Bytes
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
local subprocess = require "bee.subprocess"
local platform = require "bee.platform"
local fs = require "bee.filesystem"
local luaexe = fs.absolute(platform.os == "windows"
and "./build/bin/bootstrap.exe"
or "./build/bin/bootstrap"):string()
local bench = false
local bench_args = {}
local test_args = {}
for i, v in ipairs(arg) do
if v == "-bench" then
bench = true
elseif bench then
bench_args[#bench_args+1] = v
else
test_args[#test_args+1] = v
end
end
local process
if bench then
process = assert(subprocess.spawn {
luaexe,
"bench.lua", bench_args,
stdout = io.stdout,
stderr = "stdout",
cwd = "benchmark"
})
else
process = assert(subprocess.spawn {
luaexe, "test/test.lua", test_args,
stdout = io.stdout,
stderr = "stdout",
})
end
local code = process:wait()
if code ~= 0 then
os.exit(code, true)
end