Add a one-liner help message for each type of error inject
command, and use raw formatter to keep line breaks.
While here, use a more uniform language.
With that, "ghes_inject -h" will now show:
usage: ghes_inject.py [options]
Handles ACPI GHESv2 error injection via the QEMU QMP interface.
It uses UEFI BIOS APEI features to generate GHES records, which helps to
test CPER and GHES drivers on the guest OS and see how user‑space
applications on that guest handle such errors.
positional arguments:
{arm,pci-bus,fuzzy-test,fuzzy,raw-error,raw}
arm Inject an ARM processor error CPER, compatible with
UEFI 2.9A Errata.
pci-bus Inject a PCI/PCI-X bus error CPER
fuzzy-test (fuzzy) Inject fuzzy test CPER packets
raw-error (raw) Inject CPER records from previously recorded ones.
options:
-h, --help show this help message and exit
QEMU QMP socket options:
-H, --host HOST host name (default: localhost)
-P, --port PORT TCP port number (default: 4445)
-d, --debug enable debug output (default: False)
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
scripts/arm_processor_error.py | 6 ++++--
scripts/fuzzy_error.py | 4 +++-
scripts/ghes_inject.py | 18 +++++++++---------
scripts/pci_bus_error.py | 4 +++-
scripts/raw_error.py | 6 +++---
5 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/scripts/arm_processor_error.py b/scripts/arm_processor_error.py
index d9845adb0c0a..597382031ab8 100644
--- a/scripts/arm_processor_error.py
+++ b/scripts/arm_processor_error.py
@@ -122,7 +122,7 @@ class ArmProcessorEinj:
"""
DESC = """
- Generates an ARM processor error CPER, compatible with
+ Inject an ARM processor error CPER, compatible with
UEFI 2.9A Errata.
"""
@@ -169,7 +169,9 @@ def __init__(self, subparsers):
self.data = bytearray()
- parser = subparsers.add_parser("arm", description=self.DESC)
+ parser = subparsers.add_parser("arm",
+ help=self.DESC,
+ description=self.DESC)
arm_valid_bits = ",".join(self.arm_valid_bits.keys())
flags = ",".join(self.pei_flags.keys())
diff --git a/scripts/fuzzy_error.py b/scripts/fuzzy_error.py
index 9f80abb72319..3ddb90f743a1 100644
--- a/scripts/fuzzy_error.py
+++ b/scripts/fuzzy_error.py
@@ -121,8 +121,10 @@ def __init__(self, subparsers):
},
}
+ DESC = "Inject fuzzy test CPER packets"
+
parser = subparsers.add_parser("fuzzy-test", aliases=['fuzzy'],
- description="Inject a fuzzy test CPER",
+ help=DESC, description=DESC,
formatter_class=argparse.RawTextHelpFormatter)
g_fuzzy = parser.add_argument_group("Fuzz testing error inject")
diff --git a/scripts/ghes_inject.py b/scripts/ghes_inject.py
index dd2b34a64f15..21cdea774f17 100755
--- a/scripts/ghes_inject.py
+++ b/scripts/ghes_inject.py
@@ -17,28 +17,28 @@
from raw_error import RawError
EINJ_DESC = """
-Handle ACPI GHESv2 error injection logic QEMU QMP interface.
+Handles ACPI GHESv2 error injection via the QEMU QMP interface.
-It allows using UEFI BIOS EINJ features to generate GHES records.
-
-It helps testing CPER and GHES drivers at the guest OS and how
-userspace applications at the guest handle them.
+It uses UEFI BIOS APEI features to generate GHES records, which helps to
+test CPER and GHES drivers on the guest OS and see how user‑space
+applications on that guest handle such errors.
"""
def main():
"""Main program"""
# Main parser - handle generic args like QEMU QMP TCP socket options
- parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
usage="%(prog)s [options]",
description=EINJ_DESC)
g_options = parser.add_argument_group("QEMU QMP socket options")
g_options.add_argument("-H", "--host", default="localhost", type=str,
- help="host name")
+ help="host name (default: %(default)s)")
g_options.add_argument("-P", "--port", default=4445, type=int,
- help="TCP port number")
- g_options.add_argument('-d', '--debug', action='store_true')
+ help="TCP port number (default: %(default)s)")
+ g_options.add_argument('-d', '--debug', action='store_true',
+ help="enable debug output (default: %(default)s)")
subparsers = parser.add_subparsers()
diff --git a/scripts/pci_bus_error.py b/scripts/pci_bus_error.py
index 5abfdf11c868..87d1f7c95dd2 100644
--- a/scripts/pci_bus_error.py
+++ b/scripts/pci_bus_error.py
@@ -35,8 +35,10 @@ def __init__(self, subparsers):
self.data = bytearray()
+ DESC = "Inject a PCI/PCI-X bus error CPER"
+
parser = subparsers.add_parser("pci-bus",
- description="Generate PCI/PCI-X bus error CPER")
+ help=DESC, description=DESC)
g_pci = parser.add_argument_group("PCI/PCI-X bus error")
valid_bits = ",".join(self.valid_bits.keys())
diff --git a/scripts/raw_error.py b/scripts/raw_error.py
index f5e77bdfcead..1e9eb1bcf15b 100644
--- a/scripts/raw_error.py
+++ b/scripts/raw_error.py
@@ -21,8 +21,8 @@ class RawError:
SCRIPT_NAME = sys.argv[0]
- HELP=f"""
- Inject a CPER record from a previously recorded one.
+ HELP="Inject CPER records from previously recorded ones."
+ DESC=HELP + f"""
One or more CPER records can be recorded. The records to be
injected are read from an specified file or from stdin and should
@@ -58,7 +58,7 @@ def __init__(self, subparsers):
self.size = 0
parser = subparsers.add_parser("raw-error", aliases=['raw'],
- description=self.HELP,
+ help=self.HELP, description=self.DESC,
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("-f", "--file",
--
2.52.0