Skip to contentSkip to conversation

test.sh: make the loop device size can be customized

PATCH Superseded Li Wang 2 participants 6 messages Jul 27, 2016

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/2 test.sh: make the loop device size can be customized

---
 testcases/lib/test.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
testcases/lib/test.sh +3 -1
index 23d68c6..10a3ea7 100644
@@ -257,6 +257,8 @@ ROD()
 
 tst_acquire_device()
 {
+	local dev_size=${1:-100}
+
 	if [ -z ${TST_TMPDIR} ]; then
 		tst_brkm "Use 'tst_tmpdir' before 'tst_acquire_device'"
 	fi
@@ -274,7 +276,7 @@ tst_acquire_device()
 		return
 	fi
 
-	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=102400
+	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=$(($dev_size*1024))
 
 	TST_DEVICE=$(losetup -f)
 	if [ $? -ne 0 ]; then
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 2/2 mkfs01: extend the loop device size to 256M

Increase TST_DEVICE size to make btrfs-progs happy.

---
 testcases/commands/mkfs/mkfs01.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/commands/mkfs/mkfs01.sh +2 -1
index eda9829..9a26899 100755
@@ -32,7 +32,8 @@ setup()
 
 	tst_tmpdir
 
-	tst_acquire_device
+	# set test_dev.img size
+	tst_acquire_device 256
 
 	TST_CLEANUP="cleanup"
 
Signature · 1 line
1.8.3.1
#5 lore raw

PATCH 1/2 test.sh: make the loop device size can be customized

In reply to Li Wang

Hi!

testcases/lib/test.sh tst_acquire_device() · line 279

Quoted 13 lines

tst_acquire_device()
{

testcases/lib/test.sh +3 -1
+	local dev_size=${1:-100}
+
 	if [ -z ${TST_TMPDIR} ]; then
 		tst_brkm "Use 'tst_tmpdir' before 'tst_acquire_device'"
 	fi
@@ -274,7 +276,7 @@ tst_acquire_device()
 		return
 	fi
 
-	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=102400
+	ROD_SILENT dd if=/dev/zero of=test_dev.img bs=1024 count=$(($dev_size*1024))

This is unfortunately not a complete solution. If we want to add parameter(s) to tst_acquire_device() to specify minimal (and possibly maximal) device size we have to check the $LTP_DEV device size and fall back to loopback device if it's not in between the bounds, otherwise the test will still fail if smaller than requested device was created in runltp (which is the case at the moment).

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 2/2 mkfs01: extend the loop device size to 256M

In reply to Li Wang

Hi!

Quoted 10 lines
---
 testcases/commands/mkfs/mkfs01.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/commands/mkfs/mkfs01.sh +0 -0
index eda9829..9a26899 100755

testcases/commands/mkfs/mkfs01.sh setup() · line 36

Quoted 6 lines
testcases/commands/mkfs/mkfs01.sh +2 -1
@@ -32,7 +32,8 @@ setup()
 
 	tst_tmpdir
 
-	tst_acquire_device
+	# set test_dev.img size
+	tst_acquire_device 256

As far as I can tell 150MB should suffice as well, at least for me the btrfs-progs v4.3.1+ requests at least 136MB. Or did they increase the minimal size again?

And I guess that we should bump the size in runltp script as well.

Signature · 2 lines
Cyril Hrubis
[email protected]
#3 lore raw

PATCH 2/2 mkfs01: extend the loop device size to 256M

Hi!

Quoted 2 lines

As far as I can tell 150MB should suffice as well, at least for me the btrfs-progs v4.3.1+ requests at least 136MB. Or did they increase the

^
Should have been v4.5.1+

The v4.3.1+ increased the minimal size to 100MB.

Signature · 2 lines
Cyril Hrubis
[email protected]
author
#4 lore raw

PATCH 2/2 mkfs01: extend the loop device size to 256M

In reply to Cyril Hrubis
Quoted 14 lines · Cyril Hrubis

Hi!

Quoted 13 lines
---
 testcases/commands/mkfs/mkfs01.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/commands/mkfs/mkfs01.sh +0 -0
index eda9829..9a26899 100755
@@ -32,7 +32,8 @@ setup()
 
 	tst_tmpdir
 
Quoted 7 lines

testcases/commands/mkfs/mkfs01.sh setup() · line 36

Quoted 3 lines
testcases/commands/mkfs/mkfs01.sh +2 -1
-	tst_acquire_device
+	# set test_dev.img size
+	tst_acquire_device 256

As far as I can tell 150MB should suffice as well, at least for me the btrfs-progs v4.3.1+ requests at least 136MB. Or did they increase the minimal size again?

No, I just let to 256M in case that they increase that again.

Quoted 2 lines

And I guess that we should bump the size in runltp script as well.

I didn't think of that.

Ok, Let me think it over and rewrite a new method.

Regards,
Li Wang