summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/actions/require/action/test.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/xmake/actions/require/action/test.lua b/xmake/actions/require/action/test.lua
index 5b8b40aee..6fec10d5a 100644
--- a/xmake/actions/require/action/test.lua
+++ b/xmake/actions/require/action/test.lua
@@ -40,6 +40,13 @@ function main(package)
-- save the current directory
local oldir = os.curdir()
+ -- enter the test directory
+ local testdir = path.join(os.tmpdir(), "pkgtest", package:name(), package:version_str() or "lastest")
+ if not os.isdir(testdir) then
+ os.mkdir(testdir)
+ os.cd(testdir)
+ end
+
-- test it
for i = 1, 3 do
local script = scripts[i]
@@ -48,6 +55,9 @@ function main(package)
end
end
+ -- remove the test directory
+ os.tryrm(testdir)
+
-- restore the current directory
os.cd(oldir)
end