From patchwork Tue Nov 6 11:53:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 197471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 659912C00D7 for ; Tue, 6 Nov 2012 22:53:57 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TVhjA-0001SQ-7P; Tue, 06 Nov 2012 11:53:56 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TVhj8-0001SL-61 for fwts-devel@lists.ubuntu.com; Tue, 06 Nov 2012 11:53:54 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TVhj8-0007wO-3k for fwts-devel@lists.ubuntu.com; Tue, 06 Nov 2012 11:53:54 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] utilities: kernelscan.sh: Check that the file exists Date: Tue, 6 Nov 2012 11:53:53 +0000 Message-Id: <1352202833-24425-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.10.4 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King kernelscan.sh makes assumptions about which files to scan and this can change over time because files get renamed or removed from the kernel. So add a check so see if the source exists before trying to scan it. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/utilities/kernelscan.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh index 529d9cc..fd0f662 100755 --- a/src/utilities/kernelscan.sh +++ b/src/utilities/kernelscan.sh @@ -41,12 +41,16 @@ fi scan_source_file() { - $KERNELSCAN < $1 -E | gcc -E $CONFIGS - | $KERNELSCAN -P > $TMP - if [ $(stat -c%s $TMP) -gt 0 ]; then - echo "Source: $1" - cat $TMP + if [ -f $1 ]; then + $KERNELSCAN < $1 -E | gcc -E $CONFIGS - | $KERNELSCAN -P > $TMP + if [ $(stat -c%s $TMP) -gt 0 ]; then + echo "Source: $1" + cat $TMP + fi + rm $TMP + else + echo "Source: $1 does not exist" fi - rm $TMP } scan_source_tree()