aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/script.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-24 14:55:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:35 +0200
commitaa79de0b9a1e214e923139c25b02b5313a6305a9 (patch)
tree3104cdb7f0d4008c443df43beaf70aebeb8e7ec4 /build2/test/script/script.cxx
parent0f7ecf29943c9d8112fff923d93eeadb99a816f3 (diff)
Implement creation/cleanup of testscript root working directory
Diffstat (limited to 'build2/test/script/script.cxx')
-rw-r--r--build2/test/script/script.cxx21
1 files changed, 8 insertions, 13 deletions
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx
index 6602518..4dd47c5 100644
--- a/build2/test/script/script.cxx
+++ b/build2/test/script/script.cxx
@@ -159,19 +159,14 @@ namespace build2
}
script::
- script (target& tt, testscript& st)
+ script (target& tt, testscript& st, const dir_path& rwd)
: group (script_id (st.path ())),
test_target (tt), script_target (st)
{
// Set the script working dir ($~) to $out_base/test/<id> (id_path
- // for root is just the id).
+ // for root is just the id which is empty if st is 'testscript').
//
- {
- auto& wd (const_cast<dir_path&> (wd_path));
- wd = tt.out_dir ();
- wd /= "test";
- wd /= id_path.string ();
- }
+ const_cast<dir_path&> (wd_path) = dir_path (rwd) /= id_path.string ();
// Unless we have the test variable set on the test or script target,
// set it at the script level to the test target's path.
@@ -180,14 +175,14 @@ namespace build2
{
value& v (assign (test_var));
- // If this is a path-based target, then we use the path. If this
- // is a directory (alias) target, then we use the directory path.
- // Otherwise, we leave it NULL expecting the testscript to set it
- // to something appropriate, if used.
+ // If this is a path-based target, then we use the path. If this is
+ // an alias target (e.g., dir{}), then we use the directory path.
+ // Otherwise, we leave it NULL expecting the testscript to set it to
+ // something appropriate, if used.
//
if (auto* p = tt.is_a<path_target> ())
v = p->path ();
- else if (tt.is_a<dir> ())
+ else if (tt.is_a<alias> ())
v = path (tt.dir.string ()); // Strip trailing slash.
}