From patchwork Wed Dec 1 14:44:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 73823 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]) by ozlabs.org (Postfix) with SMTP id C29CBB6EF0 for ; Thu, 2 Dec 2010 01:45:24 +1100 (EST) Received: (qmail 5033 invoked by alias); 1 Dec 2010 14:45:17 -0000 Received: (qmail 5005 invoked by uid 22791); 1 Dec 2010 14:45:14 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Dec 2010 14:45:07 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 0DBF8591; Wed, 1 Dec 2010 15:45:05 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id m0AH0yPfxYSn; Wed, 1 Dec 2010 15:45:02 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 7E734590; Wed, 1 Dec 2010 15:45:02 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id oB1EiuUX014347; Wed, 1 Dec 2010 15:44:56 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Arnaud Charlet , Paolo Bonzini Subject: [testsuite, ada, build] Allow for further differences in type output in run_acats Date: Wed, 01 Dec 2010 15:44:56 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 I've just noticed that the ACATS tests weren't run on IRIX 6.5 with /bin/ksh as CONFIG_SHELL. It turned out that the which() shell function in ada/acats/run_acats still isn't robust enough. type -p gnatchop would e.g. print gnatchop is a tracked alias for /vol/gcc-4.4/bin/gnatchop under some circumstances, and /bin/ksh on Tru64 UNIX V5.1B gives gnatchop is /vol/gcc-4.4/bin/gnatchop despite the -p. This is all a total mess and calls for moving ACATS to Dejagnu instead. I really hope to tackle this for 4.7. For the time being, I've made the following changes to make which() more robust: * Save the output of type -p/type/whence in a variable and only emit/process it if successful, otherwise we use the awk exit code, not that from type et al. * I'm no longer relying on a particular type etc. output format, but instead just extract the last output field with awk. I've been able run make check-acats on mips-sgi-irix6.5 with a previous version of this patch, and the final one below has been tested with the following script #!/bin/sh which_old () { type -p $* 2>/dev/null && return 0 type $* 2>/dev/null | awk '{print $3}' && return 0 whence $* 2>/dev/null && return 0 return 1 } which_new () { path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } path=`whence $* 2>/dev/null` && { echo $path; return 0; } return 1 } old_gnatchop=`which_old gnatchop` old_gnatdir=`dirname $old_gnatchop` echo "old: $old_gnatchop $old_gnatdir" new_gnatchop=`which_new gnatchop` new_gnatdir=`dirname $new_gnatchop` echo "new: $new_gnatchop $new_gnatdir" with /bin/sh, /bin/ksh and bash on mips-sgi-irix5.3, mips-sgi-irix6.5, alpha-dec-osf4.0f, alpha-dec-osf5.1b, sparc-sun-solaris2.8, sparc-sun-solaris2.10 and sparc-sun-solaris2.11. Ok for mainline and the 4.4, 4.5 branches after testing/soaktime on mainline? Thanks. Rainer 2010-11-30 Rainer Orth gcc/testsuite: * ada/acats/run_acats (which): Assign output to temporary variable, only use if successful. Use last field of type output. diff -r 48851c3efb44 gcc/testsuite/ada/acats/run_acats --- a/gcc/testsuite/ada/acats/run_acats Fri Nov 26 17:38:20 2010 +0000 +++ b/gcc/testsuite/ada/acats/run_acats Wed Dec 01 15:34:05 2010 +0100 @@ -14,9 +14,9 @@ # Fall back to whence which ksh88 and ksh93 provide, but bash does not. which () { - type -p $* 2>/dev/null && return 0 - type $* 2>/dev/null | awk '{print $3}' && return 0 - whence $* 2>/dev/null && return 0 + path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } + path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; } + path=`whence $* 2>/dev/null` && { echo $path; return 0; } return 1 }