From 0c42d253e0b9cb39ebdd4cdd22516f80cea7dc0e Mon Sep 17 00:00:00 2001
From: ruki <waruqi@gmail.com>
Date: Sat, 14 Sep 2024 13:46:31 +0800
Subject: [PATCH] fix log path for test

---
 xmake/actions/test/main.lua | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua
index 408fa5d5f4..7fa42e3cfd 100644
--- a/xmake/actions/test/main.lua
+++ b/xmake/actions/test/main.lua
@@ -58,8 +58,9 @@ function _do_test_target(target, opt)
     local targetfile = path.absolute(target:targetfile())
     local runargs = table.wrap(opt.runargs or target:get("runargs"))
     local autogendir = path.join(target:autogendir(), "tests")
-    local outfile = path.join(autogendir, opt.name .. ".out")
-    local errfile = path.join(autogendir, opt.name .. ".err")
+    local logname = opt.name:gsub("[/\\>=<|%*]", "_")
+    local outfile = path.absolute(path.join(autogendir, logname .. ".out"))
+    local errfile = path.absolute(path.join(autogendir, logname .. ".err"))
     os.tryrm(outfile)
     os.tryrm(errfile)
     os.mkdir(autogendir)
