Module Name: src
Committed By: rillig
Date: Wed Jun 14 17:07:33 UTC 2023
Modified Files:
src/tests/usr.bin/indent: fmt_expr.c lsym_preprocessing.c psym_else.c
t_options.lua
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/indent/fmt_expr.c
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/indent/lsym_preprocessing.c
cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/psym_else.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/t_options.lua
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/indent/fmt_expr.c
diff -u src/tests/usr.bin/indent/fmt_expr.c:1.7 src/tests/usr.bin/indent/fmt_expr.c:1.8
--- src/tests/usr.bin/indent/fmt_expr.c:1.7 Sat Jun 10 08:17:04 2023
+++ src/tests/usr.bin/indent/fmt_expr.c Wed Jun 14 17:07:32 2023
@@ -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
Index: src/tests/usr.bin/indent/lsym_preprocessing.c
diff -u src/tests/usr.bin/indent/lsym_preprocessing.c:1.12 src/tests/usr.bin/indent/lsym_preprocessing.c:1.13
--- src/tests/usr.bin/indent/lsym_preprocessing.c:1.12 Wed Jun 14 10:29:52 2023
+++ src/tests/usr.bin/indent/lsym_preprocessing.c Wed Jun 14 17:07:32 2023
@@ -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
Index: src/tests/usr.bin/indent/psym_else.c
diff -u src/tests/usr.bin/indent/psym_else.c:1.5 src/tests/usr.bin/indent/psym_else.c:1.6
--- src/tests/usr.bin/indent/psym_else.c:1.5 Sat Jun 10 17:35:41 2023
+++ src/tests/usr.bin/indent/psym_else.c Wed Jun 14 17:07:32 2023
@@ -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
Index: src/tests/usr.bin/indent/t_options.lua
diff -u src/tests/usr.bin/indent/t_options.lua:1.4 src/tests/usr.bin/indent/t_options.lua:1.5
--- src/tests/usr.bin/indent/t_options.lua:1.4 Mon May 22 06:35:56 2023
+++ src/tests/usr.bin/indent/t_options.lua Wed Jun 14 17:07:32 2023
@@ -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)