From f41599c8e9435f3dfec60b872c2b4ae31177efdd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 10 Oct 2020 17:22:46 +0300 Subject: Add support for test timeouts --- libbuild2/script/script.ixx | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'libbuild2/script/script.ixx') diff --git a/libbuild2/script/script.ixx b/libbuild2/script/script.ixx index 56043b2..37c77ec 100644 --- a/libbuild2/script/script.ixx +++ b/libbuild2/script/script.ixx @@ -25,7 +25,6 @@ namespace build2 inline command_to_stream operator| (command_to_stream x, command_to_stream y) {return x |= y;} - // command // inline ostream& @@ -52,5 +51,39 @@ namespace build2 to_stream (o, e, command_to_stream::all); return o; } + + // deadline + // + inline bool + operator< (const deadline& x, const deadline& y) + { + if (x.value != y.value) + return x.value < y.value; + + return x.success < y.success; + } + + inline optional + to_deadline (const optional& ts, bool success) + { + return ts ? deadline (*ts, success) : optional (); + } + + // timeout + // + inline bool + operator< (const timeout& x, const timeout& y) + { + if (x.value != y.value) + return x.value < y.value; + + return x.success < y.success; + } + + inline optional + to_timeout (const optional& d, bool success) + { + return d ? timeout (*d, success) : optional (); + } } } -- cgit v1.1