From patchwork Wed Nov 26 01:34:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 414940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6D0EC1401EB for ; Wed, 26 Nov 2014 12:27:48 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=EGaBzXaATh1ePEUG1IsGGh2DBL79UvG4gmbWaVoEv90sbXXoLmrXu AnXSQ/fnsy5l0XkVam13GyWapqq+ix7ZL7gYAB6EO/fTiZiVS8Lepthd6c4o0Enb 1EhkF3BxwN2xPjLuZnCsxOFQVLZZJdpbkN+1GDMypXgIkvbBeNXEFk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=4n/tNOzPl7O1Y+4LMlPWY5nO/C8=; b=LVIklNdShCqTqiYzvnHH 4XCOWgHrv0plyupNuH+6kDugG38Pv55wsOWf13AgPUK9+RfhkG1e3tuEXOAD5w2Y I13V+9FETip+SZKb0XEo8psJJVRxvlN7Zuv4gi8+VXCrOc8x8uyYW5HPu0NSfb1A q0VHcVc87cIc54R2r2zBIcA= Received: (qmail 14873 invoked by alias); 26 Nov 2014 01:26:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 14702 invoked by uid 89); 26 Nov 2014 01:26:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 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; Wed, 26 Nov 2014 01:26:53 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAQ1Qpi7013632 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 25 Nov 2014 20:26:51 -0500 Received: from c64.redhat.com (vpn-239-49.phx2.redhat.com [10.3.239.49]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAQ1QhSc017972; Tue, 25 Nov 2014 20:26:51 -0500 From: David Malcolm To: gcc-patches@gcc.gnu.org, jit@gcc.gnu.org Cc: Jeff Law , David Malcolm Subject: [PATCH 04/05] jit.exp: Verify the exit status of the spawnee Date: Tue, 25 Nov 2014 20:34:23 -0500 Message-Id: <1416965664-15360-5-git-send-email-dmalcolm@redhat.com> In-Reply-To: <1416965664-15360-1-git-send-email-dmalcolm@redhat.com> References: <546CCC00.209@redhat.com> <1416965664-15360-1-git-send-email-dmalcolm@redhat.com> X-IsSubscribed: yes gcc/testsuite/ChangeLog: * jit.dg/jit.exp (verify_exit_status): New function. (fixed_host_execute): Verify the exit status of the spawnee. --- gcc/testsuite/jit.dg/jit.exp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gcc/testsuite/jit.dg/jit.exp b/gcc/testsuite/jit.dg/jit.exp index 2edd048..a37ccc7 100644 --- a/gcc/testsuite/jit.dg/jit.exp +++ b/gcc/testsuite/jit.dg/jit.exp @@ -65,6 +65,35 @@ proc parse_valgrind_logfile {name logfile} { close $f } +# Given WRES, the result from "wait", issue a PASS +# if the spawnee exited cleanly, or a FAIL for various kinds of +# unexpected exits. + +proc verify_exit_status { executable wres } { + lassign $wres pid spawnid os_error_flag value + verbose "pid: $pid" 3 + verbose "spawnid: $spawnid" 3 + verbose "os_error_flag: $os_error_flag" 3 + verbose "value: $value" 3 + + # Detect segfaults etc: + if { [llength $wres] > 4 } { + if { [lindex $wres 4] == "CHILDKILLED" } { + fail "$executable killed: $wres" + return + } + } + if { $os_error_flag != 0 } { + fail "$executable: OS error: $wres" + return + } + if { $value != 0 } { + fail "$executable: non-zero exit code: $wres" + return + } + pass "$executable exited cleanly" +} + # This is host_execute from dejagnu.exp commit # 126a089777158a7891ff975473939f08c0e31a1c # with the following patch applied, and renaming to "fixed_host_execute". @@ -214,6 +243,7 @@ proc fixed_host_execute {args} { catch wait wres verbose "wres: $wres" 2 + verify_exit_status $executable $wres if $run_under_valgrind { upvar 2 name name