Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/indent tests/indent: separate stdout from stderr



details:   https://anonhg.NetBSD.org/src/rev/7eeefe5bdb56
branches:  trunk
changeset: 376377:7eeefe5bdb56
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Jun 14 17:07:32 2023 +0000

description:
tests/indent: separate stdout from stderr

Due to buffering, there was no guarantee that the output would be
exactly in the same order as written in the tests.

diffstat:

 tests/usr.bin/indent/fmt_expr.c           |   6 +++---
 tests/usr.bin/indent/lsym_preprocessing.c |  10 +++++-----
 tests/usr.bin/indent/psym_else.c          |   4 ++--
 tests/usr.bin/indent/t_options.lua        |   7 +++++--
 4 files changed, 15 insertions(+), 12 deletions(-)

diffs (102 lines):

diff -r 9198232ca28a -r 7eeefe5bdb56 tests/usr.bin/indent/fmt_expr.c
--- a/tests/usr.bin/indent/fmt_expr.c   Wed Jun 14 16:14:30 2023 +0000
+++ b/tests/usr.bin/indent/fmt_expr.c   Wed Jun 14 17:07:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fmt_expr.c,v 1.7 2023/06/10 08:17:04 rillig Exp $ */
+/* $NetBSD: fmt_expr.c,v 1.8 2023/06/14 17:07:32 rillig Exp $ */
 
 /*
  * Tests for all kinds of expressions that are not directly related to unary
@@ -44,8 +44,6 @@
 //indent end
 
 //indent run -di0
-error: Standard Input:7: Unbalanced parentheses
-warning: Standard Input:9: Extra ')'
 {
        int var = ({1});
        int var = ({
@@ -57,4 +55,6 @@ warning: Standard Input:9: Extra ')'
        });
 }
 exit 1
+error: Standard Input:7: Unbalanced parentheses
+warning: Standard Input:9: Extra ')'
 //indent end
diff -r 9198232ca28a -r 7eeefe5bdb56 tests/usr.bin/indent/lsym_preprocessing.c
--- a/tests/usr.bin/indent/lsym_preprocessing.c Wed Jun 14 16:14:30 2023 +0000
+++ b/tests/usr.bin/indent/lsym_preprocessing.c Wed Jun 14 17:07:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lsym_preprocessing.c,v 1.12 2023/06/14 10:29:52 rillig Exp $ */
+/* $NetBSD: lsym_preprocessing.c,v 1.13 2023/06/14 17:07:32 rillig Exp $ */
 
 /*
  * Tests for the token lsym_preprocessing, which represents a '#' that starts
@@ -294,10 +294,6 @@ int before;
 //indent end
 
 //indent run
-error: Standard Input:1: Unmatched #else
-error: Standard Input:2: Unmatched #elif
-error: Standard Input:3: Unmatched #elifdef
-error: Standard Input:4: Unmatched #endif
 #else
 #elif 0
 #elifdef var
@@ -306,4 +302,8 @@ error: Standard Input:4: Unmatched #endi
 #unknown
 # 3 "file.c"
 exit 1
+error: Standard Input:1: Unmatched #else
+error: Standard Input:2: Unmatched #elif
+error: Standard Input:3: Unmatched #elifdef
+error: Standard Input:4: Unmatched #endif
 //indent end
diff -r 9198232ca28a -r 7eeefe5bdb56 tests/usr.bin/indent/psym_else.c
--- a/tests/usr.bin/indent/psym_else.c  Wed Jun 14 16:14:30 2023 +0000
+++ b/tests/usr.bin/indent/psym_else.c  Wed Jun 14 17:07:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: psym_else.c,v 1.5 2023/06/10 17:35:41 rillig Exp $ */
+/* $NetBSD: psym_else.c,v 1.6 2023/06/14 17:07:32 rillig Exp $ */
 
 /*
  * Tests for the parser symbol psym_else, which represents the keyword 'else'
@@ -80,9 +80,9 @@ function(void)
 //indent end
 
 //indent run
-error: Standard Input:2: Unmatched 'else'
 {
        else
 }
 exit 1
+error: Standard Input:2: Unmatched 'else'
 //indent end
diff -r 9198232ca28a -r 7eeefe5bdb56 tests/usr.bin/indent/t_options.lua
--- a/tests/usr.bin/indent/t_options.lua        Wed Jun 14 16:14:30 2023 +0000
+++ b/tests/usr.bin/indent/t_options.lua        Wed Jun 14 17:07:32 2023 +0000
@@ -1,4 +1,4 @@
--- $NetBSD: t_options.lua,v 1.4 2023/05/22 06:35:56 rillig Exp $
+-- $NetBSD: t_options.lua,v 1.5 2023/06/14 17:07:32 rillig Exp $
 --
 -- Copyright (c) 2023 The NetBSD Foundation, Inc.
 -- All rights reserved.
@@ -126,7 +126,7 @@ end
 
 local function run_indent(inp, args)
        local indent = os.getenv("INDENT") or "indent"
-       local cmd = indent .. " " .. args .. " 2>&1"
+       local cmd = indent .. " " .. args .. " 2>t_options.err"
 
        local indent_in = assert(io.popen(cmd, "w"))
        indent_in:write(inp)
@@ -134,6 +134,9 @@ local function run_indent(inp, args)
        if not ok then
                print(kind .. " " .. info)
        end
+       for line in io.lines("t_options.err") do
+               print(line)
+       end
 end
 
 local function handle_empty_section(line)



Home | Main Index | Thread Index | Old Index