At the moment a failing dg-output test is printed as:

    fail "$name output pattern test, is ${output}, should match $texttmp"

and a passing one is printed as:

    pass "$name output pattern test, $texttmp"

This means that a failing test causes the entire program output to be dumped
to the .sum file and to the terminal.  It's then harder to compare FAILs
from different runs if the output can vary from run to run (e.g. because
it uses random numbers or because address randomisation is turned on).

The regexp itself can contain newlines so the pass message can also span
several lines.

This patch turns the pass/fail line into a simple "$name output pattern test"
and prints the expected and actual output to the log, in a similar way to
excess errors tests.

FWIW the motivating example was a FAIL like:

FAIL: c-c++-common/asan/global-overflow-1.c  -Os  output pattern test, is ==4731
==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) byte
s at address 0x02008fff7000 (12)
==4731==ReserveShadowMemoryRange failed while trying to map 0xdfff0001000 bytes.
 Perhaps you're using ulimit -v
, should match READ of size 1 at 0x[0-9a-f]+ thread T0.*(
|
)    #0 0x[0-9a-f]+ (in _*main ([^
]*global-overflow-1.c:20|[^
]*:0)|[(])[^
]*(
|
).*0x[0-9a-f]+ is located 0 bytes to the right of global variable.*YYY[^
]* of size 10[^
]*(
|
)

in a testsuite run on GCC trunk.

Tested using GCC.

Thanks,
Richard

>From fd8de779aeefe31b34e1ee0e369286e089b48023 Mon Sep 17 00:00:00 2001
From: Richard Sandiford <rdsandif...@googlemail.com>
Date: Sat, 7 Dec 2013 11:57:21 +0000
Subject: [PATCH] 2013-12-07  Richard Sandiford  <rdsandif...@googlemail.com>

	* lib/dg.exp (dg-test): Don't put the expected and actual output
	of a pattern test in the test name; send it to the log instead.
---
 ChangeLog  | 5 +++++
 lib/dg.exp | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 36d02b7..59a2e76 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-12-07  Richard Sandiford  <rdsandif...@googlemail.com>
+
+	* lib/dg.exp (dg-test): Don't put the expected and actual output
+	of a pattern test in the test name; send it to the log instead.
+
 2013-11-01  Steve Ellcey  <sell...@mips.com>
 
 	* Makefile.am (baseboard_SCRIPTS): Add multi-sim.exp baseboard.
diff --git a/lib/dg.exp b/lib/dg.exp
index 889585f..3eaccf1 100644
--- a/lib/dg.exp
+++ b/lib/dg.exp
@@ -851,10 +851,11 @@ proc dg-test { args } {
 		    }
 		    set texttmp [lindex ${dg-output-text} 1]
 		    if { ![regexp $texttmp ${output}] } {
-			fail "$name output pattern test, is ${output}, should match $texttmp"
+			fail "$name output pattern test"
+			send_log "Output was:\n${output}\nShould match:\n$texttmp\n"
 			verbose "Failed test for output pattern $texttmp" 3
 		    } else {
-			pass "$name output pattern test, $texttmp"
+			pass "$name output pattern test"
 			verbose "Passed test for output pattern $texttmp" 3
 		    }
 		    unset texttmp
-- 
1.8.3.1

_______________________________________________
DejaGnu mailing list
DejaGnu@gnu.org
https://lists.gnu.org/mailman/listinfo/dejagnu

Reply via email to