Author: gnichols
Date: 2011-09-16 15:39:01 +0000 (Fri, 16 Sep 2011)
New Revision: 1074
Modified:
trunk/tests/storage/storage.py
Log:
736638 - v7 storage test won't work on 4K sector storage device
736666 - v7 storage test has an improper write/read sequence
736675 - v7 storage test sets an improper I/O records
736679 - v7 storage test: improper dt options for raw I/O test
Modified: trunk/tests/storage/storage.py
===================================================================
--- trunk/tests/storage/storage.py 2011-09-16 15:08:49 UTC (rev 1073)
+++ trunk/tests/storage/storage.py 2011-09-16 15:39:01 UTC (rev 1074)
@@ -93,11 +93,13 @@
tests[disk] = test
return tests.values()
- def doDt(self, minBs, maxBs, options):
+ def doDt(self, minBs, maxBs, size, options):
"""Helper function: run dt with various block sizes and reasonable
defaults."""
bs = minBs
while bs <= maxBs:
- (returnValue,junk) = commands.getstatusoutput("dt enable=aio aios=8
pattern=0xDEADBEEF bs=%s %s" % (bs,options))
+ records = size * 1024 / bs
+ # dt will default enable verify
+ (returnValue,junk) = commands.getstatusoutput("dt pattern=0xDEADBEEF
bs=%d records=%d %s" % (bs, records, options))
print junk
print "returns %s" % returnValue
sys.stdout.flush()
@@ -109,31 +111,21 @@
def dtTest(self, minBs, maxBs, file, size, otherOptions):
"""Do a few passes of read/write testing on the given
device."""
- # Find out how many maxBs-sized blocks we can fit on the test file/dev
- blocks = ((size/(maxBs/1024)))
- seqWriOpt = "of=%s records=%s iotype=sequential dispose=keep disable=verify
%s" % (file, blocks, otherOptions)
- seqReaOpt = "if=%s records=%s iotype=sequential %s" % (file, blocks,
otherOptions)
+ seq_opt = "of=%s iotype=sequential dispose=keep %s" % (file,
otherOptions)
# random passes
# generate a random seed first
seed = random.randint(0,32767)
if "direct" in otherOptions:
otherOptions = otherOptions + " rlimit=%s" % (size * 1024)
- ranWriOpt = "of=%s records=%s iotype=random dispose=keep disable=verify
ralign=%s rseed=%s dlimit=%s %s" % (file, blocks, minBs, seed, size, otherOptions)
- ranReaOpt = "if=%s records=%s iotype=random ralign=%s rseed=%s dlimit=%s
%s" % (file, blocks, minBs, seed, size, otherOptions)
+ ran_opt = "of=%s iotype=random dispose=keep enable=verify ralign=%s rseed=%s
dlimit=%s %s" % (file, minBs, seed, size, otherOptions)
# start
- print "--- sequential write"
+ print "--- sequential write/read"
sys.stdout.flush()
- returnValue1 = self.doDt(minBs, maxBs, seqWriOpt)
- print "--- sequential read"
+ returnValue1 = self.doDt(minBs, maxBs, size, seq_opt)
+ print "--- random write/read"
sys.stdout.flush()
- returnValue2 = self.doDt(minBs, maxBs, seqReaOpt)
- print "--- random write"
- sys.stdout.flush()
- returnValue3 = self.doDt(minBs, maxBs, ranWriOpt)
- print "--- random read"
- sys.stdout.flush()
- returnValue4 = self.doDt(minBs, maxBs, ranReaOpt)
- if returnValue1 and returnValue2 and returnValue3 and returnValue4:
+ returnValue2 = self.doDt(minBs, maxBs, size, ran_opt)
+ if returnValue1 and returnValue2:
returnValue = True
else:
returnValue = False
@@ -154,6 +146,15 @@
sys.stdout.flush()
return size
+ def dev_sector_size(self, testdev):
+ size = 0
+ (status, output) = commands.getstatusoutput("cat
/sys/block/%s/queue/hw_sector_size" % testdev)
+ if not status:
+ size = int(output)
+ else:
+ print "Warning: can't get device sector size from
/sys/block/%s/queue/hw_sector_size" % testdev
+ return size
+
def deviceIsLvm(self,key,Device):
"""Return true if the given device is actually an LV, and that LV
is only on
the device we're trying to test."""
@@ -350,7 +351,7 @@
junkSize = int(junkSize)
if junkSize < self.maxSize:
size = junkSize
- otherOptions = " "
+ otherOptions = " enable=aio aios=8"
if self.dtTest(minBs,maxBs,dtTestFile,size,otherOptions):
if self.unmount(testdev):
print "umount ok"
@@ -462,6 +463,10 @@
else:
minBs = self.defaultMinBs
maxBs = self.defaultMaxBs
+ # Check set min block size to its sector size
+ size_tmp = self.dev_sector_size(testdev)
+ if size_tmp:
+ minBs = size_tmp
# start to torture the disks
returnValue = self.testVFS(storageDevice,testdev,minBs,maxBs)
if returnValue: