aboutsummaryrefslogtreecommitdiff
path: root/tests/process/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-21 09:17:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-21 09:17:01 +0200
commit5a36f357e174d002722122d2408c57fb43da6e59 (patch)
tree4d31e5ac43a3013426d26f48e7a42850c2aa8aea /tests/process/driver.cxx
parent083834dcc5b76fe6f1318eb2b91c5caf08cd0c5f (diff)
Implement execution of Windows batch files
Diffstat (limited to 'tests/process/driver.cxx')
-rw-r--r--tests/process/driver.cxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx
index fc9ffe9..ae5015c 100644
--- a/tests/process/driver.cxx
+++ b/tests/process/driver.cxx
@@ -143,10 +143,11 @@ exec (const path& p,
}
catch (const process_error& e)
{
+ //cerr << args[0] << ": " << e << endl;
+
if (e.child)
exit (1);
- //cerr << args[0] << ": " << e << endl;
return false;
}
}
@@ -176,6 +177,7 @@ main (int argc, const char* argv[])
for (; i != argc; ++i)
{
string v (argv[i]);
+
if (v == "-c")
child = true;
else if (v == "-b")
@@ -254,6 +256,8 @@ main (int argc, const char* argv[])
return 0;
}
+ dir_path owd (dir_path::current_directory ());
+
// Test processes created as "already terminated".
//
{
@@ -309,7 +313,7 @@ main (int argc, const char* argv[])
assert (exec (dir_path (".") / fp.leaf ()));
- // Fail for unexistent file path.
+ // Fail for non-existent file path.
//
assert (!exec (dir_path (".") / path ("dr")));
@@ -343,4 +347,21 @@ main (int argc, const char* argv[])
pr.handle = reinterpret_cast<process::handle_type> (-1);
assert (!pr.wait (true) && !pr.wait (false));
#endif
+
+ // Test execution of Windows batch files. The test file is in the original
+ // working directory.
+ //
+#ifdef _WIN32
+ {
+ assert (exec (owd / "test.bat"));
+ assert (exec (owd / "test"));
+
+ paths = owd.string () + path::traits::path_separator + paths;
+ assert (_putenv (("PATH=" + paths).c_str ()) == 0);
+
+ assert (exec (path ("test.bat")));
+ assert (exec (path ("test")));
+ assert (!exec (path ("testX.bat")));
+ }
+#endif
}