From patchwork Mon May 11 08:22:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eryu Guan X-Patchwork-Id: 6374071 Return-Path: X-Original-To: patchwork-fstests@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 38D75BEEE1 for ; Mon, 11 May 2015 08:24:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 587132037F for ; Mon, 11 May 2015 08:24:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E017202E9 for ; Mon, 11 May 2015 08:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752792AbbEKIY3 (ORCPT ); Mon, 11 May 2015 04:24:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59123 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbbEKIY3 (ORCPT ); Mon, 11 May 2015 04:24:29 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 418818F303 for ; Mon, 11 May 2015 08:24:29 +0000 (UTC) Received: from localhost (dhcp12-136.nay.redhat.com [10.66.12.136] (may be forged)) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4B8OR9q024746; Mon, 11 May 2015 04:24:28 -0400 From: Eryu Guan To: fstests@vger.kernel.org Cc: Eryu Guan Subject: [PATCH] check: set failure status before exit Date: Mon, 11 May 2015 16:22:13 +0800 Message-Id: <1431332533-7557-1-git-send-email-eguan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP check has trapped 'exit 1' and exit with $status, but check always returns 0 on error because status never gets updated. This causes problems while running some tests in a loop until it fails, e.g. while ./check generic/081; do : ; done Just set status to 1 before exit, as what we do in the tests. Also remove an unused $flag while we're at it. Signed-off-by: Eryu Guan --- check | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/check b/check index 4fa96ed..a300130 100755 --- a/check +++ b/check @@ -451,7 +451,8 @@ for section in $HOST_OPTIONS_SECTIONS; do mkdir -p $RESULT_BASE if [ ! -d $RESULT_BASE ]; then echo "failed to create results directory $RESULT_BASE" - exit 1; + status=1 + exit fi if $OPTIONS_HAVE_SECTIONS; then @@ -466,12 +467,14 @@ for section in $HOST_OPTIONS_SECTIONS; do echo "our local _test_mkfs routine ..." cat $tmp.err echo "check: failed to mkfs \$TEST_DEV using specified options" - exit 1 + status=1 + exit fi out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR` if [ $? -ne 1 ]; then echo $out - exit 1 + status=1 + exit fi _prepare_test_list elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then @@ -479,7 +482,8 @@ for section in $HOST_OPTIONS_SECTIONS; do out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR` if [ $? -ne 1 ]; then echo $out - exit 1 + status=1 + exit fi fi @@ -508,12 +512,13 @@ for section in $HOST_OPTIONS_SECTIONS; do # call the overridden mkfs - make sure the FS is built # the same as we'll create it later. - if ! _scratch_mkfs $flag >$tmp.err 2>&1 + if ! _scratch_mkfs >$tmp.err 2>&1 then echo "our local _scratch_mkfs routine ..." cat $tmp.err echo "check: failed to mkfs \$SCRATCH_DEV using specified options" - exit 1 + status=1 + exit fi # call the overridden mount - make sure the FS mounts with @@ -523,7 +528,8 @@ for section in $HOST_OPTIONS_SECTIONS; do echo "our local mount routine ..." cat $tmp.err echo "check: failed to mount \$SCRATCH_DEV using specified options" - exit 1 + status=1 + exit fi fi