aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-01-20 20:25:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-01-24 14:53:00 +0300
commit28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 (patch)
tree8b912a7c9a2bd2ba1263695428d8343d022953a5 /build2/test/script/parser.cxx
parenteeed734583c2f553e71ae0bd78a4b6e7e4d9cc2b (diff)
Add support for comparison of test command output to a file
Diffstat (limited to 'build2/test/script/parser.cxx')
-rw-r--r--build2/test/script/parser.cxx30
1 files changed, 24 insertions, 6 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 4b1c777..c3dc233 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -1518,7 +1518,6 @@ namespace build2
}
r.file.path = parse_path (move (w), what);
- r.file.append = r.modifiers.find ('&') != string::npos;
};
switch (p)
@@ -1684,7 +1683,9 @@ namespace build2
case type::out_merge:
case type::out_str:
case type::out_doc:
- case type::out_file:
+ case type::out_file_cmp:
+ case type::out_file_ovr:
+ case type::out_file_app:
{
if ((fd = fd == 3 ? 1 : fd) == 0)
fail (l) << "invalid out redirect file descriptor " << fd;
@@ -1733,7 +1734,9 @@ namespace build2
}
case type::in_file:
- case type::out_file: rt = redirect_type::file; break;
+ case type::out_file_cmp:
+ case type::out_file_ovr:
+ case type::out_file_app: rt = redirect_type::file; break;
}
redirect& r (fd == 0 ? c.in : fd == 1 ? c.out : c.err);
@@ -1797,6 +1800,15 @@ namespace build2
case 1: p = pending::out_file; break;
case 2: p = pending::err_file; break;
}
+
+ // Also sets for stdin, but this is harmless.
+ //
+ r.file.mode = tt == type::out_file_ovr
+ ? redirect_fmode::overwrite
+ : (tt == type::out_file_app
+ ? redirect_fmode::append
+ : redirect_fmode::compare);
+
break;
}
};
@@ -1875,7 +1887,9 @@ namespace build2
case type::out_doc:
case type::in_file:
- case type::out_file:
+ case type::out_file_cmp:
+ case type::out_file_ovr:
+ case type::out_file_app:
case type::clean:
{
@@ -2013,7 +2027,9 @@ namespace build2
case type::out_doc:
case type::in_file:
- case type::out_file:
+ case type::out_file_cmp:
+ case type::out_file_ovr:
+ case type::out_file_app:
{
parse_redirect (t, l);
break;
@@ -2263,7 +2279,9 @@ namespace build2
case type::out_str:
case type::in_file:
- case type::out_file:
+ case type::out_file_cmp:
+ case type::out_file_ovr:
+ case type::out_file_app:
{
parse_redirect (t, l);
break;