* [LTP] [PATCH v3 2/2] mkswap: make the test device size is aligned to pagesize
@ 2016-08-18 13:09 Li Wang
2016-08-22 17:06 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Li Wang @ 2016-08-18 13:09 UTC (permalink / raw)
To: ltp
We get failures like below because of 'DEVICE_SIZE-10000' makes the
test device size is not aligned to system PAGE_SIZE any more.
mkswap01 1 TINFO : Found free device '/dev/loop1'
mkswap01 1 TPASS : 'mkswap /dev/loop1 ' passed.
mkswap01 2 TFAIL : 'mkswap -f /dev/loop1 92400' failed, not expected.
mkswap01 3 TINFO : Can not do swapon on /dev/loop1.
mkswap01 3 TINFO : Device size specified by 'mkswap' greater than real size.
mkswap01 3 TINFO : Swapon failed expectedly.
mkswap01 3 TPASS : 'mkswap -f /dev/loop1 112400' passed.
For the issue, we do some changes in this patch:
1. The orignal test device(LTP_DEV) size is also not aligned to
PAGE_SIZE on all arches. Here fix it.
2. Get the size of the device and align it down to be the multiple
of $PAGE_SIZE and use that as the size for testing.
3. Increase/decrease the $DEVICE_SIZE according to system PAGE_SIZE
Signed-off-by: Li Wang <liwang@redhat.com>
---
runltp | 2 +-
testcases/commands/mkswap/mkswap01.sh | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/runltp b/runltp
index 3a46765..bb2e5d8 100755
--- a/runltp
+++ b/runltp
@@ -978,7 +978,7 @@ main()
create_block()
{
#create a block device
- dd if=/dev/zero of=${TMP}/test.img bs=1kB count=153600 >/dev/null 2>&1
+ dd if=/dev/zero of=${TMP}/test.img bs=1024 count=153600 >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Failed to create loopback device image, please check disk space and re-run"
return 1
diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh
index 9727b0f..1948ff4 100755
--- a/testcases/commands/mkswap/mkswap01.sh
+++ b/testcases/commands/mkswap/mkswap01.sh
@@ -34,9 +34,12 @@ setup()
UUID=`uuidgen`
- DEVICE_SIZE=$((`blockdev --getsize64 $TST_DEVICE`/1024))
-
PAGE_SIZE=`getconf PAGE_SIZE`
+
+ # Here get the size of the device and align it down to be the
+ # multiple of $PAGE_SIZE and use that as the size for testing.
+ real_size=`blockdev --getsize64 $TST_DEVICE`
+ DEVICE_SIZE=$((($real_size/$PAGE_SIZE * $PAGE_SIZE)/1024))
}
cleanup()
@@ -169,8 +172,8 @@ mkswap_test()
setup
mkswap_test "" "" "$TST_DEVICE"
-mkswap_test "" "" "$TST_DEVICE" "$((DEVICE_SIZE-10000))"
-mkswap_test "-f" "" "$TST_DEVICE" "$((DEVICE_SIZE+10000))"
+mkswap_test "" "" "$TST_DEVICE" "$((DEVICE_SIZE-PAGE_SIZE/1024))"
+mkswap_test "-f" "" "$TST_DEVICE" "$((DEVICE_SIZE+PAGE_SIZE/1024))"
mkswap_test "-c" "" "$TST_DEVICE"
mkswap_test "-p" "2048" "$TST_DEVICE"
mkswap_test "-L" "ltp_testswap" "-L ltp_testswap" "" "/dev/disk/by-label/ltp_testswap"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH v3 2/2] mkswap: make the test device size is aligned to pagesize
2016-08-18 13:09 [LTP] [PATCH v3 2/2] mkswap: make the test device size is aligned to pagesize Li Wang
@ 2016-08-22 17:06 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2016-08-22 17:06 UTC (permalink / raw)
To: ltp
Hi!
Pushed with minor changes to the patch description, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-22 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-18 13:09 [LTP] [PATCH v3 2/2] mkswap: make the test device size is aligned to pagesize Li Wang
2016-08-22 17:06 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox