diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-10-10 17:22:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-11-06 19:32:09 +0300 |
commit | f41599c8e9435f3dfec60b872c2b4ae31177efdd (patch) | |
tree | 088f8d9bf906e4a2ed734e034699163c9ccc7306 /libbuild2/script/script.ixx | |
parent | ac76a4fd2afff48a0d5db84592babe5cabef3a2c (diff) |
Add support for test timeouts
Diffstat (limited to 'libbuild2/script/script.ixx')
-rw-r--r-- | libbuild2/script/script.ixx | 35 |
1 files changed, 34 insertions, 1 deletions
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<deadline> + to_deadline (const optional<timestamp>& ts, bool success) + { + return ts ? deadline (*ts, success) : optional<deadline> (); + } + + // 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<timeout> + to_timeout (const optional<duration>& d, bool success) + { + return d ? timeout (*d, success) : optional<timeout> (); + } } } |