On 11/17/22 17:05, Logan Gunthorpe wrote:
Add a test which writes a file with a 16KB buffer pattern, then
verify the file with the same pattern.
The test writes a single 16KB block and thus should be the same as
the patttern file. Verify that this is the case after the test is
run.
Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
---
t/jobs/t0027.fio | 14 ++++++++++++++
t/run-fio-tests.py | 29 +++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
create mode 100644 t/jobs/t0027.fio
diff --git a/t/jobs/t0027.fio b/t/jobs/t0027.fio
new file mode 100644
index 000000000000..b5b97a30d3d7
--- /dev/null
+++ b/t/jobs/t0027.fio
@@ -0,0 +1,14 @@
+[global]
+filename=t0027file
+size=16k
+bs=16k
+
+[write_job]
+readwrite=write
+buffer_pattern='t0027.pattern'
+
+[read_job]
+stonewall=1
+readwrite=read
+verify=pattern
+verify_pattern='t0027.pattern'
diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py
index e5b307ac0db8..a06f812683cb 100755
--- a/t/run-fio-tests.py
+++ b/t/run-fio-tests.py
@@ -799,6 +799,26 @@ class FioJobTest_t0025(FioJobTest):
if self.json_data['jobs'][0]['read']['io_kbytes'] != 128:
self.passed = False
+class FioJobTest_t0027(FioJobTest):
+ def setup(self, *args, **kws):
+ super(FioJobTest_t0027, self).setup(*args, **kws)
+ self.pattern_file = os.path.join(self.test_dir, "t0027.pattern")conv
+ self.output_file = os.path.join(self.test_dir, "t0027file")
+ self.pattern = os.urandom(16 << 10)
+ with open(self.pattern_file, "wb") as f:
+ f.write(self.pattern)
+
+ def check_result(self):
+ super(FioJobTest_t0027, self).check_result()
+
+ if not self.passed:
+ return
+
+ with open(self.output_file, "rb") as f:
+ data = f.read()
+
+ if data != self.pattern:
+ self.passed = False
class FioJobTest_iops_rate(FioJobTest):
"""Test consists of fio test job t0009
@@ -1214,6 +1234,15 @@ TEST_LIST = [
'pre_success': None,
'requirements': [Requirements.not_windows],
},
+ {
+ 'test_id': 27,
+ 'test_class': FioJobTest_t0027,
+ 'job': 't0027.fio',
+ 'success': SUCCESS_DEFAULT,
+ 'pre_job': None,
+ 'pre_success': None,
+ 'requirements': [],
+ },
{
'test_id': 1000,
'test_class': FioExeTest,
This test fails on Windows because Windows open() converts line endings
and treats Ctrl-Z as end of file:
https://ci.appveyor.com/project/vincentkfu/fio/builds/45418556
This diff resolves the problem:
diff --git a/lib/pattern.c b/lib/pattern.c
index 1ae05758..9be29af6 100644
--- a/lib/pattern.c
+++ b/lib/pattern.c
@@ -47,7 +47,11 @@ static const char *parse_file(const char *beg, char *out,
if (file == NULL)
goto err_out;
+#ifdef _WIN32
+ fd = open(file, O_RDONLY | O_BINARY);
+#else
fd = open(file, O_RDONLY);
+#endif
if (fd < 0)
goto err_free_out;
--
https://ci.appveyor.com/project/vincentkfu/fio