aboutsummaryrefslogtreecommitdiff
path: root/build2/test/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-03-07 10:24:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-03-07 10:24:02 +0200
commit8205a652a4616aea84f24ff31235ea9941f47db6 (patch)
treebd63a17e6944575f0d8dc0519e86d8a5513b6b5c /build2/test/init.cxx
parentec2247ead804e7cde1fe6a0f0b8112440e80a61c (diff)
Specify config.test.output variable
Diffstat (limited to 'build2/test/init.cxx')
-rw-r--r--build2/test/init.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/build2/test/init.cxx b/build2/test/init.cxx
index fd8db99..a367206 100644
--- a/build2/test/init.cxx
+++ b/build2/test/init.cxx
@@ -48,6 +48,11 @@ namespace build2
//
vp.insert ("config.test", true);
+ // Test working directory before/after cleanup (see Testscript spec for
+ // semantics).
+ //
+ vp.insert<name_pair> ("config.test.output", true);
+
// Note: none are overridable.
//
// The test variable is a name which can be a path (with the
@@ -130,6 +135,36 @@ namespace build2
m.root_ = s;
}
+ // config.test.output
+ //
+ if (lookup l = config::omitted (rs, "config.test.output").first)
+ {
+ const name_pair& p (cast<name_pair> (l));
+
+ // If second half is empty, then first is the after value.
+ //
+ const name& a (p.second.empty () ? p.first : p.second); // after
+ const name& b (p.second.empty () ? p.second : p.first); // before
+
+ // Parse and validate.
+ //
+ if (!b.simple ())
+ fail << "invalid config.test.output before value '" << b << "'";
+
+ if (!a.simple ())
+ fail << "invalid config.test.output after value '" << a << "'";
+
+ if (a.value == "clean") m.after = output_after::clean;
+ else if (a.value == "keep") m.after = output_after::keep;
+ else fail << "invalid config.test.output after value '" << a << "'";
+
+ if (b.value == "fail") m.before = output_before::fail;
+ else if (b.value == "warn") m.before = output_before::warn;
+ else if (b.value == "clean") m.before = output_before::clean;
+ else if (b.value == "") m.before = output_before::clean;
+ else fail << "invalid config.test.output before value '" << b << "'";
+ }
+
//@@ TODO: Need ability to specify extra diff options (e.g.,
// --strip-trailing-cr, now hardcoded).
//