diff options
Diffstat (limited to 'build2/test/rule.cxx')
-rw-r--r-- | build2/test/rule.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
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 " |