# # # patch ".mtn-ignore" # from [e2370f92c1d06cec6be76782ca4c0e5d478acc97] # to [81c942269cb9fa921e5e3353ecc2052bc468abef] # # patch "tester.cc" # from [46f5ccca7e68d99d1397aa38b9d0a98607b91eba] # to [545fbaad9a01df3c2ee1f7eea0e49003fd94b5e6] # # patch "tester.lua" # from [ff331bfe3880d27ad016976a761ea1c2a12baf75] # to [aab22309dc5de1e0fe9d3fb38af959db0243648c] # # patch "tests/automate_stdio/__driver__.lua" # from [56f4bbe463ab7f5f88ee45e3b7add9531fc6d732] # to [b6715d0c442e5080dffd611d0551ad01ff43994f] # # patch "tests/common/netsync.lua" # from [b4979ef69470997f5edd77961c1657d78cb0b6fd] # to [f56b506a2c31f495a53090f29bcb7c44aeab98cf] # ============================================================ --- .mtn-ignore e2370f92c1d06cec6be76782ca4c0e5d478acc97 +++ .mtn-ignore 81c942269cb9fa921e5e3353ecc2052bc468abef @@ -1,4 +1,5 @@ testsuite\.dir +tester_dir \.dirstamp ^txt2c$ ^unit_tests$ ============================================================ --- tester.cc 46f5ccca7e68d99d1397aa38b9d0a98607b91eba +++ tester.cc 545fbaad9a01df3c2ee1f7eea0e49003fd94b5e6 @@ -100,6 +100,14 @@ break; } } +bool make_accessible(string const &name) +{ + DWORD attrs = GetFileAttributes(name.c_str()); + if (attrs == INVALID_FILE_ATTRIBUTES) + return false; + bool ok = SetFileAttributes(name.c_str(), attrs & ~FILE_ATTRIBUTE_READONLY); + return ok; +} #else #include namespace redirect {typedef int savetype;} @@ -155,6 +163,14 @@ dup2(saved, from); close(saved); } +bool make_accessible(string const &name) +{ + struct stat st; + bool ok = (stat(name.c_str(), &st) == 0); + if (!ok) + return false; + ok = )chmod(name.c_str(), st.st_mode | S_IREAD | S_IWRITE | S_IEXEC) == 0); +} #endif namespace redirect { @@ -226,12 +242,25 @@ throw oops("lua error"); } +void do_remove_recursive(fs::path const &rem) +{ + if (!fs::exists(rem)) + return; + make_accessible(rem.native_file_string()); + if (fs::is_directory(rem)) + { + for (fs::directory_iterator i(rem); i != fs::directory_iterator(); ++i) + do_remove_recursive(*i); + } + fs::remove(rem); +} + void do_copy_recursive(fs::path const &from, fs::path const &to) { if (!fs::exists(from)) return; if (fs::exists(to)) - fs::remove_all(to); + do_remove_recursive(to); if (fs::is_directory(from)) { fs::create_directory(to); @@ -251,7 +280,7 @@ fs::path tname(testname); fs::path testdir = run_dir / tname.leaf(); if (fs::exists(testdir)) - fs::remove_all(testdir); + do_remove_recursive(testdir); fs::create_directory(testdir); go_to_workspace(testdir.native_file_string()); lua_pushstring(L, testdir.native_file_string().c_str()); @@ -283,7 +312,7 @@ fs::path tname(testname, fs::native); fs::path testdir = run_dir / tname.leaf(); go_to_workspace(run_dir.native_file_string()); - fs::remove_all(testdir); + do_remove_recursive(testdir); return 0; } @@ -291,7 +320,7 @@ remove_recursive(lua_State *L) { fs::path dir(luaL_checkstring(L, -1)); - fs::remove_all(dir); + do_remove_recursive(dir); return 0; } ============================================================ --- tester.lua ff331bfe3880d27ad016976a761ea1c2a12baf75 +++ tester.lua aab22309dc5de1e0fe9d3fb38af959db0243648c @@ -839,7 +839,7 @@ if e.e == true then P(string.format("skipped (line %i)\n", test.errline)) test.log:close() - if not debugging then clean_test_dir(testname) end + if not debugging then clean_test_dir(tname) end counts.skip = counts.skip + 1 elseif e.e == false then P(string.format("expected failure (line %i)\n", test.errline)) ============================================================ --- tests/automate_stdio/__driver__.lua 56f4bbe463ab7f5f88ee45e3b7add9531fc6d732 +++ tests/automate_stdio/__driver__.lua b6715d0c442e5080dffd611d0551ad01ff43994f @@ -21,6 +21,6 @@ check(mtn("automate", "inventory"), 0, true, false) canonicalize("stdout") -rename("stdout", "output") +rename_over("stdout", "output") check(mtn("automate", "stdio"), 0, true, false, "l9:inventorye") check(parse_stdio(readfile("stdout"), 0) == readfile("output")) ============================================================ --- tests/common/netsync.lua b4979ef69470997f5edd77961c1657d78cb0b6fd +++ tests/common/netsync.lua f56b506a2c31f495a53090f29bcb7c44aeab98cf @@ -45,7 +45,7 @@ function netsync.internal.sync(srv, pat, n, res) srv:client("sync", pat, n, res) end function netsync.start(pat, n, min) - if pat == "" or pat == nil then pat = "*" end + if pat == "" or pat == nil then pat = "{*}" end local args = {} local fn = mtn local addr = "localhost:" .. math.random(20000, 50000)