From patchwork Tue Oct 29 05:57:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chengguang Xu X-Patchwork-Id: 11216989 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44CB413BD for ; Tue, 29 Oct 2019 05:57:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 054F520659 for ; Tue, 29 Oct 2019 05:57:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mykernel.net header.i=cgxu519@mykernel.net header.b="MOemag0B" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731814AbfJ2F5x (ORCPT ); Tue, 29 Oct 2019 01:57:53 -0400 Received: from sender2-of-o52.zoho.com.cn ([163.53.93.247]:21128 "EHLO sender2-of-o52.zoho.com.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726034AbfJ2F5x (ORCPT ); Tue, 29 Oct 2019 01:57:53 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1572328649; cv=none; d=zoho.com.cn; s=zohoarc; b=gjZ1PFZRgY8Agq/T/hduysaNRwqveF9mKJZNiDErVWa+umts2pzAerkWJMCxm0x9ux0ep116i842+bAZ+Df+P58AFrt0gqwvNNIZ0Qim08tnE9lOSpKQLhmdv52B3Rci6cY/PlSC2f9yDHKhYcn4qlqGHLhIsGryPHMqA47OzsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1572328649; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To:ARC-Authentication-Results; bh=9MMqK2dQpAOitvEQ/yVoeB2aYORDeQJgRBVaZ629Wp8=; b=LWy+btKzyd6SNm3p1LtfTQvet8xsXVDmuzj6pKD1ainodl1CtrRiHJAaV2n2a5pzJQrkbivIhbY5mpzWaS31Nzr+DsdBxJjs4MgK0myuv5mSF4+c/TfOeXlz3k+BbKXHBXnXLtztM9cpiKllMzTuXqoHrKnJpPH0ZQOwN3HkdeE= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=mykernel.net; spf=pass smtp.mailfrom=cgxu519@mykernel.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1572328649; s=zohomail; d=mykernel.net; i=cgxu519@mykernel.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Transfer-Encoding:Content-Type; l=6554; bh=9MMqK2dQpAOitvEQ/yVoeB2aYORDeQJgRBVaZ629Wp8=; b=MOemag0BXXBed3lqIEtg9mwVeMw8Q/oqT0Z10m0BoQYFtCfhKd3B2mixCZ0ug47b xS/dBVkxTREjqvrGLSz40F3a33ybmGFmZebH932KbvLuNzEZ4qP4hHo2znJCu1GbrSX Q8VTMmZgmkQwlUsrAj169ov7F+ICdN4a78Hi4sZs= Received: from localhost.localdomain (218.18.229.179 [218.18.229.179]) by mx.zoho.com.cn with SMTPS id 1572328646680578.4244767295933; Tue, 29 Oct 2019 13:57:26 +0800 (CST) From: Chengguang Xu To: fstests@vger.kernel.org, linux-unionfs@vger.kernel.org Cc: guaneryu@gmail.com, amir73il@gmail.com, miklos@szeredi.hu, Chengguang Xu Message-ID: <20191029055713.28191-1-cgxu519@mykernel.net> Subject: [PATCH] overlay/066: adjust test file size && add more test patterns Date: Tue, 29 Oct 2019 13:57:13 +0800 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-ZohoCNMailClient: External Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org Make many small holes in 10M test file seems not very helpful for test coverage and it takes too much time on creating test files. So in order to improve test speed we adjust test file size to (10 * iosize) for iosize aligned hole files meanwhile add more test patterns for small random holes and small empty file. Signed-off-by: Chengguang Xu --- tests/overlay/066 | 89 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/tests/overlay/066 b/tests/overlay/066 index 285a5aff..fb8f5e5c 100755 --- a/tests/overlay/066 +++ b/tests/overlay/066 @@ -40,49 +40,82 @@ _require_scratch # Remove all files from previous tests _scratch_mkfs -# We have totally 14 test files in this test. +# We have totally 16 test files in this test. # The detail as below: -# 1 empty file(10M) + 2^0(K)..2^11(K) hole size files(each 10M) + 1 random hole size file(100M). +# 1 small empty file 4K +# 1 big empty file 4M +# 1 small random hole file 10M +# 1 big random hole file 100M +# +# 12 files with variant iosize aligned holes. +# 2^0(K)..2^11(K) hole size files(file size = 10 * iosize) # # Considering both upper and lower fs will fill zero when copy-up # hole area in the file, this test at least requires double disk # space of the sum of above test files' size. -_require_fs_space $OVL_BASE_SCRATCH_MNT $(((10*1024*13 + 100*1024*1) * 2)) +_require_fs_space $OVL_BASE_SCRATCH_MNT $((((4) + (4096) + (10 * 1024) \ + + (100 * 1024) + (10 * (1 + 2048) * 12 / 2)) * 2)) lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER testfile="copyup_sparse_test" -# Create a completely empty hole file(10M). -file_size=10240 -$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_empty_holefile" \ +# Create a small completely empty hole file(4K). +file_size=4 +$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_empty_small_holefile" \ + >>$seqres.full + +# Create a big completely empty hole file(4M). +file_size=4096 +$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_empty_big_holefile" \ >>$seqres.full -# Create 2^0(K)..2^11(K) hole size test files(each 10M). +# Create 2^0(K)..2^11(K) hole size test files(file size = 10 * iosize). # # The pattern is like below, both hole and data are equal to # iosize except last hole. # # |-- hole --|-- data --| ... |-- data --|-- hole --| -iosize=1 +min_iosize=1 max_iosize=2048 -file_size=10240 -max_pos=`expr $file_size - $max_iosize` +iosize=$min_iosize while [ $iosize -le $max_iosize ]; do + file_size=$(($iosize * 10)) + max_pos=$(($file_size - $iosize)) pos=$iosize $XFS_IO_PROG -fc "truncate ${file_size}K" \ "${lowerdir}/${testfile}_iosize${iosize}K_holefile" >>$seqres.full while [ $pos -lt $max_pos ]; do $XFS_IO_PROG -fc "pwrite ${pos}K ${iosize}K" \ "${lowerdir}/${testfile}_iosize${iosize}K_holefile" >>$seqres.full - pos=`expr $pos + $iosize + $iosize` + pos=$(($pos + $iosize * 2)) done - iosize=`expr $iosize + $iosize` + iosize=$(($iosize * 2)) done +# Create test file with many random small holes(hole size is between 4K and 512K), +# total file size is 10M. + +pos=4 +max_pos=9216 +file_size=10240 +min_hole=4 +max_hole=512 + +$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_random_small_holefile" \ + >>$seqres.full + +while [ $pos -le $max_pos ]; do + iosize=$(($RANDOM % ($max_hole - $min_hole) + $min_hole)) + $XFS_IO_PROG -fc "pwrite ${pos}K ${iosize}K" \ + "${lowerdir}/${testfile}_random_small_holefile" >>$seqres.full + pos=$(($pos + $iosize * 2)) +done + + # Create test file with many random holes(hole size is between 1M and 5M), # total file size is 100M. @@ -92,14 +125,14 @@ file_size=102400 min_hole=1024 max_hole=5120 -$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_random_holefile" \ +$XFS_IO_PROG -fc "truncate ${file_size}K" "${lowerdir}/${testfile}_random_big_holefile" \ >>$seqres.full while [ $pos -le $max_pos ]; do iosize=$(($RANDOM % ($max_hole - $min_hole) + $min_hole)) $XFS_IO_PROG -fc "pwrite ${pos}K ${iosize}K" \ - "${lowerdir}/${testfile}_random_holefile" >>$seqres.full - pos=`expr $pos + $iosize + $iosize` + "${lowerdir}/${testfile}_random_big_holefile" >>$seqres.full + pos=$(($pos + $iosize * 2)) done _scratch_mount @@ -112,18 +145,30 @@ done echo "Silence is golden" # Check all copy-up files in upper layer. -iosize=1 -while [ $iosize -le 2048 ]; do +min_iosize=1 +max_iosize=2048 +iosize=$min_iosize + +while [ $iosize -le $max_iosize ]; do diff "${lowerdir}/${testfile}_iosize${iosize}K_holefile" \ "${upperdir}/${testfile}_iosize${iosize}K_holefile" >>$seqres.full ||\ echo "${upperdir}/${testfile}_iosize${iosize}K_holefile" copy up failed! - iosize=`expr $iosize + $iosize` + iosize=$(($iosize * 2)) done -diff "${lowerdir}/${testfile}_empty_holefile" "${upperdir}/${testfile}_empty_holefile" \ - >>$seqres.full || echo "${upperdir}/${testfile}_empty_holefile" copy up failed! -diff "${lowerdir}/${testfile}_random_holefile" "${upperdir}/${testfile}_random_holefile" \ - >>$seqres.full || echo "${upperdir}/${testfile}_random_holefile" copy up failed! +# Check empty hole files +diff "${lowerdir}/${testfile}_empty_small_holefile" "${upperdir}/${testfile}_empty_small_holefile" \ + >>$seqres.full || echo "${upperdir}/${testfile}_empty_small_holefile" copy up failed! + +diff "${lowerdir}/${testfile}_empty_big_holefile" "${upperdir}/${testfile}_empty_big_holefile" \ + >>$seqres.full || echo "${upperdir}/${testfile}_empty_big_holefile" copy up failed! + +# Check random hole files +diff "${lowerdir}/${testfile}_random_small_holefile" "${upperdir}/${testfile}_random_small_holefile" \ + >>$seqres.full || echo "${upperdir}/${testfile}_random_small_holefile" copy up failed! + +diff "${lowerdir}/${testfile}_random_big_holefile" "${upperdir}/${testfile}_random_big_holefile" \ + >>$seqres.full || echo "${upperdir}/${testfile}_random_big_holefile" copy up failed! # success, all done status=0