From patchwork Thu Jun 9 17:49:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 99789 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 35526B6FF1 for ; Fri, 10 Jun 2011 03:49:33 +1000 (EST) Received: (qmail 14818 invoked by alias); 9 Jun 2011 17:49:31 -0000 Received: (qmail 14808 invoked by uid 22791); 9 Jun 2011 17:49:30 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Jun 2011 17:49:13 +0000 Received: from wpaz1.hot.corp.google.com (wpaz1.hot.corp.google.com [172.24.198.65]) by smtp-out.google.com with ESMTP id p59HnC5g008348; Thu, 9 Jun 2011 10:49:12 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by wpaz1.hot.corp.google.com with ESMTP id p59HnBbr018806; Thu, 9 Jun 2011 10:49:11 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id F3F741DA1CD; Thu, 9 Jun 2011 13:49:10 -0400 (EDT) To: reply@codereview.appspotmail.com, gchare@google.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] New script to reproduce failures from a .log file (issue4601050) Message-Id: <20110609174910.F3F741DA1CD@topo.tor.corp.google.com> Date: Thu, 9 Jun 2011 13:49:10 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true 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 This small script searches for the spawn line corresponding to a given grep pattern inside a dejagnu log file. If it finds the spawn line, it executes it with any other arguments provided on the command line. It's generally useful for cutting and pasting failed test cases. I did not find anything close to it in gcc/contrib, so I will be adding it to trunk shortly. Gab, Lawrence, this ought to simplify reproducing pph failures from g++.log. Feel free to add more functionality to it, or use it to find writer and reader pairs in the log file and execute them separately. Diego. * repro_fail: New. --- This patch is available for review at http://codereview.appspot.com/4601050 diff --git a/contrib/repro_fail b/contrib/repro_fail new file mode 100755 index 0000000..d5bce04 --- /dev/null +++ b/contrib/repro_fail @@ -0,0 +1,49 @@ +#!/bin/bash +# +# Script to reproduce a test failure from a dejagnu .log file +# +# Contributed by Diego Novillo +# +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING. If not, write to +# the Free Software Foundation, 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +if [ $# -lt 2 ] ; then + echo "usage: $0 pattern file.log [additional-args]" + echo + echo "Finds the 'spawn' line matching PATTERN in FILE.LOG and executes" + echo "the command with any arguments in ADDITIONAL-ARGS." + echo + exit 1 +fi + +set -e +pattern=$1 +logf=$2 +shift 2 +args="$@" +line=$(grep "^spawn .*$pattern" $logf | sed -e "s:^spawn ::") + +if [ "$line" = "" ] ; then + echo "Could not find a spawn command for pattern $1" + exit 1 +fi + +set -x +e +$line $args +exit $?