From 28106f96de8ae5cdb3a0ee0e3a8a8185551e3b00 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 20 Jan 2017 20:25:59 +0300 Subject: Add support for comparison of test command output to a file --- build2/test/script/parser.cxx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'build2/test/script/parser.cxx') 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; -- cgit v1.1