public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2 2/2] test.sh: make the loop device size can be customized
@ 2016-07-28  5:17 Li Wang
  2016-08-15 11:40 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2016-07-28  5:17 UTC (permalink / raw)
  To: ltp

The LTP_DEV default size is 150MB, but sometimes we need different
(larger or smaller) size of test block device.

For the purpose of satisfying specific requirements, here adding
parameters to tst_acquire_device() to make the loop device can be
customized according to real needed.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/lib/test.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 4fe2773..835ea39 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -257,11 +257,13 @@ ROD()
 
 tst_acquire_device()
 {
+	local acq_dev_size=${1:-150}
+
 	if [ -z ${TST_TMPDIR} ]; then
 		tst_brkm "Use 'tst_tmpdir' before 'tst_acquire_device'"
 	fi
 
-	if [ -n "${LTP_DEV}" ]; then
+	if [ -n "${LTP_DEV}" ] && [ ${acq_dev_size} -eq 150 ]; then
 		tst_resm TINFO "Using test device LTP_DEV='${LTP_DEV}'"
 		if [ ! -b ${LTP_DEV} ]; then
 			tst_brkm TBROK "${LTP_DEV} is not a block device"
@@ -274,7 +276,7 @@ tst_acquire_device()
 		return
 	fi
 
-	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=153600
+	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=$((1024*$acq_dev_size))
 
 	TST_DEVICE=$(losetup -f)
 	if [ $? -ne 0 ]; then
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-16 10:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28  5:17 [LTP] [PATCH v2 2/2] test.sh: make the loop device size can be customized Li Wang
2016-08-15 11:40 ` Cyril Hrubis
2016-08-16 10:58   ` Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox