From aa79de0b9a1e214e923139c25b02b5313a6305a9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 24 Oct 2016 14:55:06 +0200 Subject: Implement creation/cleanup of testscript root working directory --- build2/test/script/script.cxx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'build2/test/script/script.cxx') 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_path - // for root is just the id). + // for root is just the id which is empty if st is 'testscript'). // - { - auto& wd (const_cast (wd_path)); - wd = tt.out_dir (); - wd /= "test"; - wd /= id_path.string (); - } + const_cast (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 ()) v = p->path (); - else if (tt.is_a ()) + else if (tt.is_a ()) v = path (tt.dir.string ()); // Strip trailing slash. } -- cgit v1.1