| 1275 | ], wait=wait) |
| 1276 | |
| 1277 | def write_test_pattern(self, filename, size): |
| 1278 | log.info("Writing {0} bytes to {1}".format(size, filename)) |
| 1279 | return self.run_python(dedent(""" |
| 1280 | import zlib |
| 1281 | path = "{path}" |
| 1282 | with open(path, 'w') as f: |
| 1283 | for i in range(0, {size}): |
| 1284 | val = zlib.crc32(str(i).encode('utf-8')) & 7 |
| 1285 | f.write(chr(val)) |
| 1286 | """.format( |
| 1287 | path=os.path.join(self.hostfs_mntpt, filename), |
| 1288 | size=size |
| 1289 | ))) |
| 1290 | |
| 1291 | def validate_test_pattern(self, filename, size, timeout=None): |
| 1292 | log.info("Validating {0} bytes from {1}".format(size, filename)) |