From patchwork Sat Jul 28 08:42:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Yi X-Patchwork-Id: 10547909 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5CB18112E for ; Sat, 28 Jul 2018 08:30:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E1772BE43 for ; Sat, 28 Jul 2018 08:30:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 428BA2BE57; Sat, 28 Jul 2018 08:30:32 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 8201D2BE43 for ; Sat, 28 Jul 2018 08:30:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726987AbeG1J4J (ORCPT ); Sat, 28 Jul 2018 05:56:09 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9735 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726711AbeG1J4J (ORCPT ); Sat, 28 Jul 2018 05:56:09 -0400 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 540AA4F452E3C; Sat, 28 Jul 2018 16:30:23 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.382.0; Sat, 28 Jul 2018 16:30:15 +0800 From: "zhangyi (F)" To: , CC: , , , , , Subject: [xfstests PATCH 2/3] overlay: add fsck.overlay stress test Date: Sat, 28 Jul 2018 16:42:41 +0800 Message-ID: <20180728084242.33918-3-yi.zhang@huawei.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180728084242.33918-1-yi.zhang@huawei.com> References: <20180728084242.33918-1-yi.zhang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce a test case for fsck.overlay which runs on the underlying directories created by fsstress (contain a lot of fs objects) to find potential stability issue. Signed-off-by: zhangyi (F) --- tests/overlay/061 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/overlay/061.out | 2 ++ tests/overlay/group | 1 + 3 files changed, 84 insertions(+) create mode 100755 tests/overlay/061 create mode 100644 tests/overlay/061.out diff --git a/tests/overlay/061 b/tests/overlay/061 new file mode 100755 index 0000000..b66b36a --- /dev/null +++ b/tests/overlay/061 @@ -0,0 +1,81 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Huawei. All Rights Reserved. +# +# FS QA Test No. 061 +# +# Stress test: test fsck.overlay running on the underlying dirs +# which were created by fsstress. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/attr + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here +_supported_fs overlay +_supported_os Linux +_require_scratch_nocheck +_require_command "$FSCK_OVERLAY_PROG" fsck.overlay + +# remove all files from previous tests +_scratch_mkfs + +# Create an underlying layer which contain a lot of random objects +create_layer() +{ + for dir in $*; do + $FSSTRESS_PROG -s 42 -d $dir -z \ + -f creat=20 -f link=10 -f mkdir=20 -f mknod=10 \ + -f rename=10 -f setxattr=10 -f symlink=10 -f write=10 \ + -p 4 -n 500 -l50 > /dev/null 2>&1 & + done +} + + +# Create test directories +lowerdir=$OVL_BASE_SCRATCH_MNT/$seq-ovl-lower +lowerdir2=$OVL_BASE_SCRATCH_MNT/$seq-ovl-lower2 +upperdir=$OVL_BASE_SCRATCH_MNT/$seq-ovl-upper +workdir=$OVL_BASE_SCRATCH_MNT/$seq-ovl-workdir + +make_test_dirs() +{ + rm -rf $lowerdir $lowerdir2 $upperdir $workdir + mkdir -p $lowerdir $lowerdir2 $upperdir $workdir +} + + +# Test stability, should not crash and should not fail on "yes" mode. +make_test_dirs +create_layer $lowerdir2 $lowerdir $upperdir +wait %1 %2 %3 + +_overlay_fsck_dirs "$lowerdir:$lowerdir2" $upperdir $workdir -y >> \ + $seqres.full 2>&1 + +[[ "$?" == "$FSCK_OK" || "$?" == "$FSCK_NONDESTRUCT" ]] || \ + echo "fsck return unexpected $?" + +# success, all done +echo "Silence is golden" +status=0 +exit diff --git a/tests/overlay/061.out b/tests/overlay/061.out new file mode 100644 index 0000000..273be9e --- /dev/null +++ b/tests/overlay/061.out @@ -0,0 +1,2 @@ +QA output created by 061 +Silence is golden diff --git a/tests/overlay/group b/tests/overlay/group index b73d7e9..7d13271 100644 --- a/tests/overlay/group +++ b/tests/overlay/group @@ -63,3 +63,4 @@ 058 auto quick exportfs 059 auto quick copyup 060 auto quick metacopy +061 auto stress fsck