autotest: do not do a blkdiscard during hardware_TrimIntegrity
hardware_StorageFio now does a blkdiscard before running fio to
make sure the test is not impacted by previous tests, but
hardware_TrimIntegrity runs hardware_StorageFio with a read script
to check the read speed/latency before and after trim. We want to
maintain the random data written at the start of the test so we
can verify the trimmed and untrimmed data, so added a parameter to
fio_test to specify whether we want to do the blkdiscard and set it
as False when run within hardware_TrimIntegrity
BUG=chromium:1038166, chromium:994412
TEST=Ran hardware_TrimIntegrity
Change-Id: I06673e6bd47e0aca13bea67e3fc8dca61daccc5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1987012
Tested-by: Alexis Savery <asavery@chromium.org>
Commit-Queue: Alexis Savery <asavery@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
diff --git a/client/cros/storage_tests/fio_test.py b/client/cros/storage_tests/fio_test.py
index 53f2fdd..f5858c8 100644
--- a/client/cros/storage_tests/fio_test.py
+++ b/client/cros/storage_tests/fio_test.py
@@ -121,7 +121,7 @@
logging.info('filesize: %d', self.__filesize)
def run_once(self, dev='', quicktest=False, requirements=None,
- integrity=False, wait=60 * 60 * 72):
+ integrity=False, wait=60 * 60 * 72, blkdiscard=True):
"""
Runs several fio jobs and reports results.
@@ -130,6 +130,7 @@
@param requirements: list of jobs for fio to run
@param integrity: test to check data integrity
@param wait: seconds to wait between a write and subsequent verify
+ @param blkdiscard: do a blkdiscard before running fio
"""
@@ -170,7 +171,7 @@
if os.path.exists(self.__filename) and \
stat.S_ISBLK(os.stat(self.__filename).st_mode) and \
- self.__filesize != 0:
+ self.__filesize != 0 and blkdiscard:
try:
fd = os.open(self.__filename, os.O_RDWR)
fcntl.ioctl(fd, self.IOCTL_TRIM_CMD,
diff --git a/client/site_tests/hardware_StorageFio/hardware_StorageFio.py b/client/site_tests/hardware_StorageFio/hardware_StorageFio.py
index 0103fd4..b517e95 100644
--- a/client/site_tests/hardware_StorageFio/hardware_StorageFio.py
+++ b/client/site_tests/hardware_StorageFio/hardware_StorageFio.py
@@ -28,7 +28,7 @@
super(hardware_StorageFio, self).initialize(dev=dev, filesize=filesize)
def run_once(self, dev='', quicktest=False, requirements=None,
- integrity=False, wait=60 * 60 * 72):
+ integrity=False, wait=60 * 60 * 72, blkdiscard=True):
"""
Runs several fio jobs and reports results.
@@ -37,9 +37,11 @@
@param requirements: list of jobs for fio to run
@param integrity: test to check data integrity
@param wait: seconds to wait between a write and subsequent verify
+ @param blkdiscard: do a blkdiscard before running fio
"""
super(hardware_StorageFio, self).run_once(dev=dev, quicktest=quicktest,
requirements=requirements,
integrity=integrity,
- wait=wait)
+ wait=wait,
+ blkdiscard=blkdiscard)
diff --git a/client/site_tests/hardware_TrimIntegrity/hardware_TrimIntegrity.py b/client/site_tests/hardware_TrimIntegrity/hardware_TrimIntegrity.py
index 58f37b7..880920c 100644
--- a/client/site_tests/hardware_TrimIntegrity/hardware_TrimIntegrity.py
+++ b/client/site_tests/hardware_TrimIntegrity/hardware_TrimIntegrity.py
@@ -163,6 +163,7 @@
self.job.run_test('hardware_StorageFio',
disable_sysinfo=True,
filesize=fio_file_size,
+ blkdiscard=False,
requirements=[('4k_read_qd32', [])],
tag='before_trim')
@@ -230,6 +231,7 @@
self.job.run_test('hardware_StorageFio',
disable_sysinfo=True,
filesize=fio_file_size,
+ blkdiscard=False,
requirements=[('4k_read_qd32', [])],
tag='after_trim')