summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-09-30 09:46:21 +0800
committerruki <[email protected]>2018-09-30 09:46:21 +0800
commit99e772b7719ed355825e1eb7bd989ded395e7ecf (patch)
treef8200ce21368542215746594b7db396573ee2410
parent5f5bbb4ec17f2fcef21e23a04aeb4a992919c074 (diff)
fix test directory bug
-rw-r--r--xmake/actions/require/action/test.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/xmake/actions/require/action/test.lua b/xmake/actions/require/action/test.lua
index 6fec10d5a..dba807865 100644
--- a/xmake/actions/require/action/test.lua
+++ b/xmake/actions/require/action/test.lua
@@ -37,15 +37,15 @@ function main(package)
, package:script("test_after")
}
- -- 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 os.isdir(testdir) then
+ os.tryrm(testdir)
+ end
if not os.isdir(testdir) then
os.mkdir(testdir)
- os.cd(testdir)
end
+ local oldir = os.cd(testdir)
-- test it
for i = 1, 3 do
@@ -55,9 +55,9 @@ function main(package)
end
end
- -- remove the test directory
- os.tryrm(testdir)
-
-- restore the current directory
os.cd(oldir)
+
+ -- remove the test directory
+ os.tryrm(testdir)
end