aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/script.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-10-31 21:21:17 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:37 +0200
commit35c9e7698e768883065d944b2c43e5af9cb37ee4 (patch)
treec9a5299b90af3264c95f189c8595a0573d2d0b9f /build2/test/script/script.cxx
parent4876a5f56c72f64a54627f9b6d0656878b7ca547 (diff)
Update test runner to accommodate cleanup types
Diffstat (limited to 'build2/test/script/script.cxx')
-rw-r--r--build2/test/script/script.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/build2/test/script/script.cxx b/build2/test/script/script.cxx
index 058720a..77b8902 100644
--- a/build2/test/script/script.cxx
+++ b/build2/test/script/script.cxx
@@ -126,7 +126,11 @@ namespace build2
for (const auto& p: c.cleanups)
{
o << " &";
- print_path (p);
+
+ if (p.type != cleanup_type::always)
+ o << (p.type == cleanup_type::maybe ? '?' : '!');
+
+ print_path (p.path);
}
if (c.exit.comparison != exit_comparison::eq || c.exit.status != 0)
@@ -288,15 +292,20 @@ namespace build2
const_cast<dir_path&> (wd_path) = dir_path (p->wd_path) /= id;
}
- // command
- //
void scope::
- clean (path p)
+ clean (cleanup c, bool implicit)
{
using std::find; // Hidden by scope::find().
- if (find (cleanups.begin (), cleanups.end (), p) == cleanups.end ())
- cleanups.emplace_back (move (p));
+ assert (!implicit || c.type == cleanup_type::always);
+
+ auto pr = [&c] (const cleanup& v) -> bool {return v.path == c.path;};
+ auto i (find_if (cleanups.begin (), cleanups.end (), pr));
+
+ if (i == cleanups.end ())
+ cleanups.emplace_back (move (c));
+ else if (!implicit)
+ i->type = c.type;
}
// script_base