From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32104 invoked by alias); 13 Oct 2014 15:17:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 31965 invoked by uid 89); 13 Oct 2014 15:17:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 13 Oct 2014 15:17:20 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9DFHJgN005636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 13 Oct 2014 11:17:19 -0400 Received: from surprise.redhat.com (vpn-233-7.phx2.redhat.com [10.3.233.7]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9DFHICR020486; Mon, 13 Oct 2014 11:17:18 -0400 From: David Malcolm To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [jit] Work around a bug in dejagnu.exp's host_execute Date: Mon, 13 Oct 2014 15:28:00 -0000 Message-Id: <1413213202-11441-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg01142.txt.bz2 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 + * 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 + * 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