* [jit] Work around a bug in dejagnu.exp's host_execute
@ 2014-10-13 15:28 David Malcolm
0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2014-10-13 15:28 UTC (permalink / raw)
To: jit, gcc-patches; +Cc: David Malcolm
Committed to branch dmalcolm/jit:
dejagnu.exp's host_execute has a bug, which (for me) reliably breaks
the jit testsuite when running "make check" (though not when
running "make check-jit" by itself, and appears to be unpleasantly
timing-related).
See the discussion at:
http://lists.gnu.org/archive/html/dejagnu/2014-10/msg00000.html
For now, work around it by adding a patched copy of host_execute to
jit.exp, deleting the bogus line.
gcc/testsuite/ChangeLog.jit:
* jit.dg/jit.exp (fixed_host_execute): New function, taken from
"host_execute" in DejaGnu's dejagnu.exp, with one line removed.
(jit-dg-test): Use fixed_host_execute, rathern than host_execute.
---
gcc/testsuite/ChangeLog.jit | 6 ++
gcc/testsuite/jit.dg/jit.exp | 137 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 141 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/ChangeLog.jit b/gcc/testsuite/ChangeLog.jit
index 7703212..97d0f8b 100644
--- a/gcc/testsuite/ChangeLog.jit
+++ b/gcc/testsuite/ChangeLog.jit
@@ -1,5 +1,11 @@
2014-10-13 David Malcolm <dmalcolm@redhat.com>
+ * jit.dg/jit.exp (fixed_host_execute): New function, taken from
+ "host_execute" in DejaGnu's dejagnu.exp, with one line removed.
+ (jit-dg-test): Use fixed_host_execute, rathern than host_execute.
+
+2014-10-13 David Malcolm <dmalcolm@redhat.com>
+
* jit.dg/harness.h [MAKE_DEJAGNU_H_THREADSAFE] (note): Redefine
"note" from dejagnu.h to new function dejagnu_note so that we can
make "note" be threadsafe.
diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp
index 4672063..76a1d9d 100644
--- a/gcc/testsuite/jit.dg/jit.exp
+++ b/gcc/testsuite/jit.dg/jit.exp
@@ -23,6 +23,135 @@ load_lib target-libpath.exp
load_lib gcc.exp
load_lib dejagnu.exp
+# This is host_execute from dejagnu.exp commit
+# 126a089777158a7891ff975473939f08c0e31a1c
+# with the following patch applied, and renaming to "fixed_host_execute".
+# See the discussion at
+# http://lists.gnu.org/archive/html/dejagnu/2014-10/msg00000.html
+#
+# --- /usr/share/dejagnu/dejagnu.exp.old 2014-10-08 13:38:57.274068541 -0400
+# +++ /usr/share/dejagnu/dejagnu.exp 2014-10-10 12:27:51.113813659 -0400
+# @@ -113,8 +113,6 @@ proc host_execute {args} {
+# set timetol 0
+# set arguments ""
+#
+# - expect_before buffer_full { perror "Buffer full" }
+# -
+# if { [llength $args] == 0} {
+# set executable $args
+# } else {
+
+
+# Execute the executable file, and anaylyse the output for the
+# test state keywords.
+# Returns:
+# A "" (empty) string if everything worked, or an error message
+# if there was a problem.
+#
+proc fixed_host_execute {args} {
+ global text
+ global spawn_id
+
+ set timeoutmsg "Timed out: Never got started, "
+ set timeout 100
+ set file all
+ set timetol 0
+ set arguments ""
+
+ if { [llength $args] == 0} {
+ set executable $args
+ } else {
+ set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+ set params [string trimleft [lindex [split $args " "] 1] "\{"]
+ set params [string trimright $params "\}"]
+ }
+
+ verbose "The executable is $executable" 2
+ if {![file exists ${executable}]} {
+ perror "The executable, \"$executable\" is missing" 0
+ return "No source file found"
+ }
+
+ # spawn the executable and look for the DejaGnu output messages from the
+ # test case.
+ # spawn -noecho -open [open "|./${executable}" "r"]
+ spawn -noecho "./${executable}" ${params}
+ expect_after full_buffer { error "got full_buffer" }
+
+ set prefix "\[^\r\n\]*"
+ expect {
+ -re "^$prefix\[0-9\]\[0-9\]:..:..:${text}*\r\n" {
+ regsub "\[\n\r\t\]*NOTE: $text\r\n" $expect_out(0,string) "" output
+ verbose "$output" 3
+ set timetol 0
+ exp_continue
+ }
+ -re "^$prefix\tNOTE:${text}*" {
+ 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}*" {
+ 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}*" {
+ 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}*" {
+ 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}*" {
+ regsub "\[\n\r\t\]*UNRESOLVED: $text\r\n" $expect_out(0,string) "" output
+ set output [string range $output 8 end]
+ unresolved "$output"
+ set timetol 0
+ exp_continue
+ }
+ -re "^Totals" {
+ verbose "All done" 2
+ }
+ eof {
+ # unresolved "${executable} died prematurely"
+ # catch close
+ # return "${executable} died prematurely"
+ }
+ timeout {
+ warning "Timed out executing test case"
+ if { $timetol <= 2 } {
+ incr timetol
+ exp_continue
+ } else {
+ - catch close
+ return "Timed out executing test case"
+ }
+ }
+ -re "^$prefix\r\n" {
+ exp_continue
+ }
+ }
+
+ # force a close of the executable to be safe.
+ catch close
+
+ return ""
+}
+
+# (end of code from dejagnu.exp)
+
# GCC_UNDER_TEST is needed by gcc_target_compile
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
@@ -105,8 +234,12 @@ proc jit-dg-test { prog do_what extra_tool_flags } {
# dejagnu.exp's host_execute has code to scrape out test results
# from the DejaGnu C API and bring back into the tcl world, so we
- # use that to invoke the built code:
- set result [host_execute $output_file]
+ # use that to invoke the built code.
+ # However, it appears to be buggy; see:
+ # http://lists.gnu.org/archive/html/dejagnu/2014-10/msg00000.html
+ # We instead call a patched local copy, "fixed_host_execute", defined
+ # above.
+ set result [fixed_host_execute $output_file]
verbose "result: $result"
# Restore PATH
--
1.7.11.7
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-13 15:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-13 15:28 [jit] Work around a bug in dejagnu.exp's host_execute David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).