[Top][All Lists]

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

[DejaGnu] lib/remote.exp: Strip also a \r before the \n in front of the

From: Hans-Peter Nilsson
Subject: [DejaGnu] lib/remote.exp: Strip also a \r before the \n in front of the exit status message.
Date: Sun, 31 Mar 2002 13:25:12 -0500 (EST)

Some tests in the GCC test-suite check for exact output modulo
_some_ variance in the newline-sequence.  See for example
g77.dg/f77-edit-apostrophe-out.f.  Since testglue.c emits "\n***
EXIT code", where the \n is translated to \015\012 (crlf) by
newlib, remote.exp must strip both \015 and \012 to avoid
extraneous control characters in the output.  Without this
patch, only the last \012 would be stripped, leaving an
"extra" \015, which the test match patterns (correctly IMHO)
interpret as an extraneous control character; an extra new-line.

To avoid matching e.g. \r\r, I don't check for \[\r\n\]\[\r\n\]
(which was my "first impression" of a fix); the patch instead
matches only the exact \r\n sequence.  Copyright year list also
updated, new year added comma-separated as per GNU standards.
The patch is against savannah repo; the copyright line diverges
on sourceware.

(GDB hackers, please sync the sourceware dejagnu with the
savannah repo.  Or give me clearance and I'll do it when
priorities are aligned.)

2002-03-31  Hans-Peter Nilsson  <address@hidden>

        * lib/remote.exp (check_for_board_status): Also strip a \r before
        a \n before the exit message.

Index: remote.exp
RCS file: /cvsroot/dejagnu/dejagnu/lib/remote.exp,v
retrieving revision 1.6
diff -u -p -r1.6 remote.exp
--- remote.exp  7 Mar 2002 05:12:59 -0000       1.6
+++ remote.exp  31 Mar 2002 17:44:40 -0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1992 - 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1992 - 2000, 2001, 2002 Free Software Foundation, Inc.

 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1081,7 +1081,7 @@ proc check_for_board_status  { variable
     if [regexp "(^|\[\r\n\])\\*\\*\\* EXIT code" $output] {
        regsub "^.*\\*\\*\\* EXIT code " $output "" result;
        regsub "\[\r\n\].*$" $result "" result;
-       regsub -all "(^|\[\r\n\])\\*\\*\\* EXIT code 
\[^\r\n\]*(\[\r\n\]\[\r\n\]?|$)" $output "" output;
+       regsub -all "(^|\[\r\n\]|\r\n)\\*\\*\\* EXIT code 
\[^\r\n\]*(\[\r\n\]\[\r\n\]?|$)" $output "" output;
        regsub "^\[^0-9\]*" $result "" result
        regsub "\[^0-9\]*$" $result "" result
        verbose "got board status $result" 3

brgds, H-P

reply via email to

[Prev in Thread] Current Thread [Next in Thread]