diff --git a/test_harness.py b/test_harness.py index 5a7f1a0..e826ffe 100644 --- a/test_harness.py +++ b/test_harness.py @@ -53,7 +53,7 @@ def _make_loopbacked_devices(num): return devices -def _run_command(num_devices, command): +def _run_command(namespace, num_devices, command): """ Prepare devices and run command on devices. @@ -61,6 +61,14 @@ def _run_command(num_devices, command): :param list command: the command to be run """ devices = _make_loopbacked_devices(num_devices) + if namespace.log_level > 0: + for device in devices: + for option in ["--getss", "--getpbsz", "--getiomin", "--getioopt"]: + diagcmd = ["blockdev", option, device] + with subprocess.Popen(diagcmd, stdout=subprocess.PIPE) as proc: + blockdevoutput = proc.stdout.readline().strip().decode("utf-8") + print(f"output of {diagcmd}: {blockdevoutput}") + command = command + list(itertools.chain(*[["--disk", dev] for dev in devices])) subprocess.run(command, check=True) @@ -77,7 +85,7 @@ def _run_stratisd_cert(namespace): ) + ["-v"] ) - _run_command(3, command) + _run_command(namespace, 3, command) def _run_stratis_cli_cert(namespace): @@ -92,7 +100,7 @@ def _run_stratis_cli_cert(namespace): ) + ["-v"] ) - _run_command(3, command) + _run_command(namespace, 3, command) def _gen_parser(): @@ -119,6 +127,9 @@ def _gen_parser(): stratisd_cert_parser.add_argument( "--verify-devices", help="Verify /dev/disk/by-id devices", action="store_true" ) + stratisd_cert_parser.add_argument( + "--log-level", help="Log level", action="store", type=int + ) stratisd_cert_parser.add_argument( "--highest-revision-number",