From patchwork Thu May 25 09:08:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 9748021 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B941B60246 for ; Thu, 25 May 2017 09:08:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0EF8274D2 for ; Thu, 25 May 2017 09:08:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A43432785D; Thu, 25 May 2017 09:08:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26F68274D2 for ; Thu, 25 May 2017 09:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757507AbdEYJIy (ORCPT ); Thu, 25 May 2017 05:08:54 -0400 Received: from mx2.suse.de ([195.135.220.15]:34877 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757500AbdEYJIu (ORCPT ); Thu, 25 May 2017 05:08:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8669AAB09 for ; Thu, 25 May 2017 09:08:49 +0000 (UTC) From: Nikolay Borisov To: fstests@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH] generic/108: Fix return value check from _get_scsi_debug_dev Date: Thu, 25 May 2017 12:08:46 +0300 Message-Id: <1495703326-1269-1-git-send-email-nborisov@suse.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP _get_scsi_debug_dev is supposed to return a "/dev/$device". However, in case the scsi device is not mapped to a disk, hence /dev/sd* doesn't exist, then get_scsi_debug_dev would return only the "/dev/" string. In generic/108 we check whether return value is "" and only then consider it a failure. This behavior allows the test to erroneously consider _get_scsi_debug_dev succeeded even if it returned a malformed string. Fix this by correctly checking whether the return value is "/dev/" Signed-off-by: Nikolay Borisov --- tests/generic/108 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/generic/108 b/tests/generic/108 index cc8d7038..1525dfb6 100755 --- a/tests/generic/108 +++ b/tests/generic/108 @@ -64,7 +64,7 @@ rm -f $seqres.full # _get_scsi_debug_dev returns a scsi debug device with 128M in size by default SCSI_DEBUG_DEV=`_get_scsi_debug_dev` -if [ "$SCSI_DEBUG_DEV" == "" ]; then +if [ "$SCSI_DEBUG_DEV" == "/dev/" ]; then _fail "Failed to initialize scsi debug device" fi echo "SCSI debug device $SCSI_DEBUG_DEV" >>$seqres.full