summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-30 09:35:51 +0800
committerruki <[email protected]>2018-09-30 09:35:51 +0800
commit5f5bbb4ec17f2fcef21e23a04aeb4a992919c074 (patch)
tree7335afb773d2085c882748b27bc427be59d903a9
parenta8be35d88a0c23cf95aaaa365472825c1e60cd18 (diff)
enter the test package directory
-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