Line-truncation bug in host_execute?

David Malcolm <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <1453499580.12356.112.camel@surprise>
I'm the maintainer of the "jit" component within gcc.

We're carrying a patched copy of dejagnu's host_execute,
"fixed_host_execute", for reasons given in:
http://lists.gnu.org/archive/html/dejagnu/2014-10/msg00007.html
though I think we may have drifted further.

I'm running into an issue with the patched copy that I think may also
affect the pristine one:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69435
My tests use dejagnu.h to write "PASSED" etc lines, some of which are
very long.  They're sometimes being truncated by fixed_host_execute when
re-emitted as PASS results, so e.g.

PASSED: test-combination.c.exe iteration 1 of 5: make_calc_discriminant: actual: "q->b * q->b - (double)4 * q->a * q->c" == expected: "q->b * q->b - (double)4 * q->a * q->c"

is re-emitted as:
PASS:  test-combination.c.exe iteration 1 of 5: make_calc_discriminant: actual: "q-

(note the truncation in mid-expression).

The exact point of truncation varies from run to run, leading to churn
when comparing .sum files, so this is a pain.

I'm attaching the patch that I've attached to that gcc bug; does this
fix seem reasonable?  (my Tcl and expect skills aren't great, sorry).

Thanks; hope this is helpful
Dave

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
0001-Fix-PR-jit-69435-truncated-lines-in-jit.log.patch (text/x-patch, 2.1 KB)
From 9e49962b374771a5e0d3776fb4f308ce736b541c Mon Sep 17 00:00:00 2001
From: David Malcolm <[email protected]>
Date: Fri, 22 Jan 2016 16:44:01 -0500
Subject: [PATCH] Fix PR jit/69435 (truncated lines in jit.log)

gcc/testsuite/ChangeLog:
	PR jit/69435
	* jit.dg/jit.exp (fixed_host_execute): When capturing
	results emitted by dejagnu.h and re-emitting them,
	add "\r\n" to the -re expressions to ensure that we have
	the full line of output.
---
 gcc/testsuite/jit.dg/jit.exp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp
index 39e37c2..c5cd6b6 100644
--- a/gcc/testsuite/jit.dg/jit.exp
+++ b/gcc/testsuite/jit.dg/jit.exp
@@ -197,35 +197,35 @@ proc fixed_host_execute {args} {
 	    set timetol 0
 	    exp_continue
 	}
-	-re "^$prefix\tNOTE:${text}*" {
+	-re "^$prefix\tNOTE:${text}*\r\n" {
 	    regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
 	    set output [string range $output 6 end]
 	    verbose "$output" 2
 	    set timetol 0
 	    exp_continue
 	}
-	-re "^$prefix\tPASSED:${text}*" {
+	-re "^$prefix\tPASSED:${text}*\r\n" {
 	    regsub "\[\n\r\t\]*PASSED: $text\r\n" $expect_out(0,string) "" output
 	    set output [string range $output 8 end]
 	    pass "$output"
 	    set timetol 0
 	    exp_continue
 	}
-	-re "^$prefix\tFAILED:${text}*" {
+	-re "^$prefix\tFAILED:${text}*\r\n" {
 	    regsub "\[\n\r\t\]*FAILED: $text\r\n" $expect_out(0,string) "" output
 	    set output [string range $output 8 end]
 	    fail "$output"
 	    set timetol 0
 	    exp_continue
 	}
-	-re "^$prefix\tUNTESTED:${text}*" {
+	-re "^$prefix\tUNTESTED:${text}*\r\n" {
 	    regsub "\[\n\r\t\]*TESTED: $text\r\n" $expect_out(0,string) "" output
 	    set output [string range $output 8 end]
 	    untested "$output"
 	    set timetol 0
 	    exp_continue
 	}
-	-re "^$prefix\tUNRESOLVED:${text}*" {
+	-re "^$prefix\tUNRESOLVED:${text}*\r\n" {
 	    regsub "\[\n\r\t\]*UNRESOLVED: $text\r\n" $expect_out(0,string) "" output
 	    set output [string range $output 8 end]
 	    unresolved "$output"
-- 
1.8.5.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.