From patchwork Thu Jun 21 03:27:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 932533 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41B6sB390kz9s2R for ; Thu, 21 Jun 2018 13:39:54 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 1EB963E6339 for ; Thu, 21 Jun 2018 05:39:51 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-7.smtp.seeweb.it (in-7.smtp.seeweb.it [IPv6:2001:4b78:1:20::7]) by picard.linux.it (Postfix) with ESMTP id 808E33E6327 for ; Thu, 21 Jun 2018 05:39:49 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-7.smtp.seeweb.it (Postfix) with ESMTP id B5D51200B91 for ; Thu, 21 Jun 2018 05:39:45 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="41328028" Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 21 Jun 2018 11:39:43 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id D04BE4B314BC; Thu, 21 Jun 2018 11:39:35 +0800 (CST) Received: from RHEL7U5Alpha_SERVER.g08.fujitsu.local (10.167.220.185) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 21 Jun 2018 11:39:37 +0800 From: Xiao Yang To: Date: Thu, 21 Jun 2018 11:27:05 +0800 Message-ID: <1529551625-366-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.167.220.185] X-yoursite-MailScanner-ID: D04BE4B314BC.AA205 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=0.0 required=7.0 tests=none autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-7.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-7.smtp.seeweb.it Subject: [LTP] [PATCH] commands/mkswap01.sh: Revert the original retry loops X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Before kernel commit c3473c6(e.g. RHEL6), mkswap -L or mkswap -U for loop devices can not generate corresponding "/dev/disk/by-*" files and gets TBROK. It is just a way to check the success of mkswap rather than a bug, so the test should not get TBROK when "/dev/disk/by-*" files are not generated but swapon enable loop devices for swapping sucessfully. Signed-off-by: Xiao Yang --- testcases/commands/mkswap/mkswap01.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh index 5ead4cd..1c01c86 100755 --- a/testcases/commands/mkswap/mkswap01.sh +++ b/testcases/commands/mkswap/mkswap01.sh @@ -37,14 +37,25 @@ setup() DEVICE_SIZE=$((($real_size/$PAGE_SIZE * $PAGE_SIZE)/1024)) } -check_for_file() +wait_for_file() { local path="$1" + local retries=10 - if [ -z "$path" -o -e "$path" ]; then + if [ -z "$path" ]; then return fi - return 1 + + while [ $retries -gt 0 ]; do + if [ -e "$path" ]; then + return + fi + tst_res TINFO "Waiting for $path to appear" + retries=$((retries - 1)) + tst_sleep 10ms + done + + tst_res TINFO "The file $path haven't appeared" } mkswap_verify() @@ -64,7 +75,7 @@ mkswap_verify() local pagesize=$PAGE_SIZE fi - TST_RETRY_FUNC "check_for_file $dev_file" 0 + wait_for_file "$dev_file" swapon $swapfile 2>/dev/null