From 52a29dd64479e9313848941078a2619b47f2c61b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Mar 2017 00:39:30 +0300 Subject: Add support for config.test.output variable --- build2/test/rule.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'build2/test/rule.cxx') diff --git a/build2/test/rule.cxx b/build2/test/rule.cxx index 33ffb90..6ef2587 100644 --- a/build2/test/rule.cxx +++ b/build2/test/rule.cxx @@ -422,9 +422,16 @@ namespace build2 if (exists (wd)) { - warn << "working directory " << wd << " exists " - << (empty (wd) ? "" : "and is not empty ") << "at the beginning " - << "of the test"; + if (before != output_before::clean) + { + bool fail (before == output_before::fail); + + (fail ? error : warn) << "working directory " << wd << " exists " + << (empty (wd) ? "" : "and is not empty ") + << "at the beginning of the test"; + if (fail) + throw failed (); + } // Remove the directory itself not to confuse the runner which tries // to detect when tests stomp on each others feet. @@ -533,7 +540,7 @@ namespace build2 // Cleanup. // - if (!one && !mk) + if (!one && !mk && after == output_after::clean) { if (!empty (wd)) fail << "working directory " << wd << " is not empty at the " -- cgit v1.1