diff mbox

Remove regexp and expected output from gtest pass/fail line

Message ID 8738m3ab1f.fsf@talisman.default
State New
Headers show

Commit Message

Richard Sandiford Dec. 8, 2013, 10:31 a.m. UTC
I sent a patch to upstream dejagnu so that things 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[^
]*(
|
)

become:

FAIL: c-c++-common/asan/global-overflow-1.c  -Os  output pattern test

The actual and expected output are printed to the log instead:

    http://lists.gnu.org/archive/html/dejagnu/2013-12/msg00000.html

This patch does the same for the gtest stuff.  Tested on x86_64-linux-gnu
{,-m32} with a ulimit in place.  OK to install?

Thanks,
Richard

Comments

Richard Sandiford Dec. 8, 2013, 11:17 a.m. UTC | #1
Richard Sandiford <rdsandiford@googlemail.com> writes:
> I sent a patch to upstream dejagnu so that things 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[^
> ]*(
> |
> )
>
> become:
>
> FAIL: c-c++-common/asan/global-overflow-1.c  -Os  output pattern test
>
> The actual and expected output are printed to the log instead:
>
>     http://lists.gnu.org/archive/html/dejagnu/2013-12/msg00000.html
>
> This patch does the same for the gtest stuff.  Tested on x86_64-linux-gnu
> {,-m32} with a ulimit in place.  OK to install?

Sorry, changelog is:

gcc/testsuite/
	* lib/asan-dg.exp (asan-gtest): Remove actual and expected output
	from the pass/fail line and add it to the log instead.

> Index: gcc/testsuite/lib/asan-dg.exp
> ===================================================================
> --- gcc/testsuite/lib/asan-dg.exp	(revision 205654)
> +++ gcc/testsuite/lib/asan-dg.exp	(working copy)
> @@ -288,9 +288,10 @@
>  		    if { "$status" == "fail" } {
>  			pass "$testname execution test"
>  			if { ![regexp $regexpr ${output}] } {
> -			    fail "$testname output pattern test, should match $regexpr"
> +			    fail "$testname output pattern test"
> +			    send_log "Output was:\n${output}\nShould match:\n$regexpr\n"
>  			} else {
> -			    pass "$testname output pattern test, $regexpr"
> +			    pass "$testname output pattern test"
>  			}
>  		    } elseif { "$status" == "pass" } {
>  			fail "$testname execution test"
Jakub Jelinek Dec. 8, 2013, 1:03 p.m. UTC | #2
On Sun, Dec 08, 2013 at 10:31:56AM +0000, Richard Sandiford wrote:
> --- gcc/testsuite/lib/asan-dg.exp	(revision 205654)
> +++ gcc/testsuite/lib/asan-dg.exp	(working copy)
> @@ -288,9 +288,10 @@
>  		    if { "$status" == "fail" } {
>  			pass "$testname execution test"
>  			if { ![regexp $regexpr ${output}] } {
> -			    fail "$testname output pattern test, should match $regexpr"
> +			    fail "$testname output pattern test"
> +			    send_log "Output was:\n${output}\nShould match:\n$regexpr\n"

Are you sure you need to print ${output}?  At least looking at current
g++.log or gcc.log file, it looks like the program's output is already
there, so it is IMHO undesriable to print it there once again.

	Jakub
diff mbox

Patch

Index: gcc/testsuite/lib/asan-dg.exp
===================================================================
--- gcc/testsuite/lib/asan-dg.exp	(revision 205654)
+++ gcc/testsuite/lib/asan-dg.exp	(working copy)
@@ -288,9 +288,10 @@ 
 		    if { "$status" == "fail" } {
 			pass "$testname execution test"
 			if { ![regexp $regexpr ${output}] } {
-			    fail "$testname output pattern test, should match $regexpr"
+			    fail "$testname output pattern test"
+			    send_log "Output was:\n${output}\nShould match:\n$regexpr\n"
 			} else {
-			    pass "$testname output pattern test, $regexpr"
+			    pass "$testname output pattern test"
 			}
 		    } elseif { "$status" == "pass" } {
 			fail "$testname execution test"