Skip to content

Commit

Permalink
Merge pull request #218 from bgurney-rh/testharness-loopdevinfo
Browse files Browse the repository at this point in the history
Run blockdev report commands after _make_loopbacked_devices()
  • Loading branch information
mulkieran authored Oct 4, 2023
2 parents 885b1f2 + 41f97bc commit 55c61f8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# isort: STDLIB
import argparse
import itertools
import logging
import os
import subprocess
import tempfile
Expand Down Expand Up @@ -61,6 +62,13 @@ def _run_command(num_devices, command):
:param list command: the command to be run
"""
devices = _make_loopbacked_devices(num_devices)
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")
logging.debug("output of %s: %s", diagcmd, blockdevoutput)

command = command + list(itertools.chain(*[["--disk", dev] for dev in devices]))
subprocess.run(command, check=True)

Expand Down Expand Up @@ -108,6 +116,13 @@ def _gen_parser():
"clean up resources, such as temporary directories."
)
)
parser.add_argument(
"--log-level",
help="Log level",
action="store",
choices=["debug", "info", "warning", "error", "critical"],
default="info",
)

subparsers = parser.add_subparsers(title="subcommand")

Expand Down Expand Up @@ -149,6 +164,8 @@ def main():

namespace, unittest_args = parser.parse_known_args()

logging.basicConfig(level=namespace.log_level.upper())

namespace.func(namespace, unittest_args)


Expand Down

0 comments on commit 55c61f8

Please sign in to comment.