summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-08-15 23:16:26 +0800
committerruki <[email protected]>2024-08-15 23:16:26 +0800
commit0eca52f9590f9fc4015cb9e4ea9b34d89522c85e (patch)
treeb6bc8c7121025077ee0e66083ee702f1aefed299
parent3306faaf609b1dd9bde3a7c7e59c314b7d07b098 (diff)
improve test output path #5450
-rw-r--r--xmake/actions/test/main.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua
index c1bb156dd..6d202fe09 100644
--- a/xmake/actions/test/main.lua
+++ b/xmake/actions/test/main.lua
@@ -57,8 +57,12 @@ function _do_test_target(target, opt)
local rundir = opt.rundir or target:rundir()
local targetfile = path.absolute(target:targetfile())
local runargs = table.wrap(opt.runargs or target:get("runargs"))
- local outfile = os.tmpfile()
- local errfile = os.tmpfile()
+ local autogendir = path.join(target:autogendir(), "tests")
+ local outfile = path.join(autogendir, opt.name .. ".out")
+ local errfile = path.join(autogendir, opt.name .. ".err")
+ os.tryrm(outfile)
+ os.tryrm(errfile)
+ os.mkdir(autogendir)
local run_timeout = opt.run_timeout
local ok, syserrors = os.execv(targetfile, runargs, {try = true, timeout = run_timeout,
curdir = rundir, envs = envs, stdout = outfile, stderr = errfile})
@@ -256,7 +260,8 @@ function _show_output(testinfo, kind)
if output then
if option.get("diagnosis") then
local target = testinfo.target
- local logfile = path.join(target:autogendir(), "tests", testinfo.name .. "." .. kind .. ".log")
+ local autogendir = path.join(target:autogendir(), "tests")
+ local logfile = path.join(autogendir, testinfo.name .. "." .. kind .. ".log")
io.writefile(logfile, output)
print("%s: %s", kind, logfile)
elseif option.get("verbose") then