rsh.exp: Handle regexp return status

Christophe Lyon <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <CAKdteOY7s9hSpCHDx3X4TXhpvDoMuzBXThbnxV1W=EFmqAqz-w@mail.gmail.com>
Hello,

I noticed that in rsh.exp, we do not handle regexp return status.
In some cases where the test output is truncated, XYZ$?ZYX
cannot match, but this is un-noticed.

The attached patch fixes this. Note that I also needed to patch
GCC's testsuite/lib/gcc-dg.exp because we now return unresolved
for testcases where the output is truncated while GCC
only expects "pass" or "fail". The GCC patch looks like:

diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index 9e4ecce..6cdce0d 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -380,6 +380,7 @@ if { [info procs ${tool}_load] != [list] \
            switch [lindex $result 0] {
                "pass" { set status "fail" }
                "fail" { set status "pass" }
+               default { set status [lindex $result 0] }
            }
            set result [list $status [lindex $result 1]]
        }

I will submit it separately of course.

OK?

Christophe

_______________________________________________
DejaGnu mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/dejagnu
dj-rsh.log.txt (text/plain, 115 B)
2016-04-12  Christophe Lyon  <[email protected]>

	* lib/rsh.exp (rsh_exec): Handle regexp return status.
dj-rsh.patch.txt (text/plain, 590 B)
diff --git a/lib/rsh.exp b/lib/rsh.exp
index 123f245..c5d1cfc 100644
--- a/lib/rsh.exp
+++ b/lib/rsh.exp
@@ -310,7 +310,9 @@ proc rsh_exec { boardname program pargs inp outp } {
 	regsub "XYZ(\[0-9\]*)ZYX\n?" $output "" output
 	return [list $status "$RSH to $boardname failed for $program, $output"]
     }
-    regexp "XYZ(\[0-9\]*)ZYX" $output junk status
+    if { [regexp "XYZ(\[0-9\]*)ZYX" $output junk status] == 0 } {
+	set status ""
+    }
     verbose "rsh_exec: status:$status text:$output" 4
     if { $status == "" } {
 	return [list -1 "Couldn't parse $RSH output, $output."]
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.