linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Subject: [PATCH 3/3] script: add simple test script
Date: Mon, 25 Apr 2016 17:28:38 -0700	[thread overview]
Message-ID: <1461630518-16944-3-git-send-email-jaegeuk@kernel.org> (raw)
In-Reply-To: <1461630518-16944-1-git-send-email-jaegeuk@kernel.org>

This patch adds a script to test sload.f2fs, defrag.f2fs, and resize.f2fs.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 scripts/verify.sh | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 137 insertions(+)
 create mode 100755 scripts/verify.sh

diff --git a/scripts/verify.sh b/scripts/verify.sh
new file mode 100755
index 0000000..8a22a2d
--- /dev/null
+++ b/scripts/verify.sh
@@ -0,0 +1,137 @@
+#!/bin/bash
+
+IMG=../test.img
+TMP=/tmp/res
+XFSTESTS=~/xfstests
+TESTS="4 5 8 11 16 25 32 55 64"
+
+TARGET=./testdir
+MNT=/mnt/resize
+
+mkdir $TARGET 2>/dev/null
+mkdir $MNT 2>/dev/null
+
+umount $TARGET
+umount $MNT
+
+_check_out()
+{
+	if [ $1 -ne 0 ]; then
+		grep ASSERT $TMP
+		echo FAIL RETURN $1
+		exit
+	fi
+}
+
+_get_sec()
+{
+	echo $(($1*1024*1024*1024/512))
+}
+
+_mkfs()
+{
+	echo "========== Initialize $1 GB ============"
+	mkfs.f2fs $IMG `_get_sec $1` | grep sectors
+}
+
+_mount()
+{
+	echo "========== mount to $1 ================="
+	mount -t f2fs -o loop,discard,inline_data,inline_xattr $IMG $1 2>&1
+	_check_out $?
+}
+
+_fsck()
+{
+	echo "========== fsck.f2fs ==================="
+	fsck.f2fs $IMG -t 2>&1 >$TMP
+	_check_out $?
+	grep FSCK $TMP
+}
+
+_fsstress()
+{
+	echo "========== fsstress $1 ================="
+	$XFSTESTS/ltp/fsstress -x "echo 3 > /proc/sys/vm/drop_caches && sleep 1" -X 1 -r -f fsync=8 -f sync=0 -f write=8 -f dwrite=2 -f truncate=6 -f allocsp=0 -f bulkstat=0 -f bulkstat1=0 -f freesp=0 -f zero=1 -f collapse=1 -f insert=1 -f resvsp=0 -f unresvsp=0 -S t -p 10 -n $2 -d $1 >/dev/null
+}
+
+_resize()
+{
+	echo "========== resize.f2fs $1 GB ==========="
+	resize.f2fs -t `_get_sec $1` $IMG 2>&1 >$TMP
+	_check_out $?
+	_fsck
+}
+
+_resize_tests()
+{
+	for i in $TESTS
+	do
+		if [ $i -ge $1 ]; then
+			_resize $i
+		fi
+	done
+}
+
+_sload()
+{
+	echo "========== sload $1 ===================="
+	sload.f2fs -f $1 $IMG 2>&1
+	_check_out $?
+}
+
+from_mount()
+{
+	echo ""
+	echo " ****  $1 GB to $2 GB with $3 *** "
+	_mkfs $1
+	_mount $3
+	_fsstress $3 10000
+	umount $3
+	_fsck
+	_resize_tests $2
+}
+
+from_sload()
+{
+	echo ""
+	echo " ****  $1 GB to $2 GB with $3 *** "
+
+	_mkfs $1
+	_sload $3
+	_fsck
+
+	_mount $MNT
+	_fsstress $MNT 10000
+	umount $MNT
+	_fsck
+
+	_resize_tests $2
+
+	_mount $MNT
+	_fsstress $MNT 10000
+	umount $MNT
+	_fsck
+}
+
+test_all()
+{
+	for i in $TESTS
+	do
+		for j in $TESTS
+		do
+			if [ $i -lt $j ]; then
+				$1 $i $j $2
+			fi
+		done
+	done
+}
+
+test_all from_sload ~/grub
+
+rm -rf $TARGET/*
+_fsstress $TARGET 5000
+test_all from_sload $TARGET
+rm -rf $TARGET 2>/dev/null
+
+test_all from_mount $MNT
-- 
2.6.3


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z

  parent reply	other threads:[~2016-04-26  0:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-26  0:28 [PATCH 1/3] resize.f2fs: support to expand partition size Jaegeuk Kim
2016-04-26  0:28 ` [PATCH 2/3] sload.f2fs: support loading files into partition directly Jaegeuk Kim
2016-04-26  0:28 ` Jaegeuk Kim [this message]
2016-04-26  1:57 ` [PATCH 1/3] resize.f2fs: support to expand partition size He YunLei
2016-04-26  2:17   ` Jaegeuk Kim
2016-04-26  2:28     ` He YunLei
2016-04-26  2:17 ` He YunLei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461630518-16944-3-git-send-email-jaegeuk@kernel.org \
    --to=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).