sanitycheck: add argument --pre-script

add argument --pre-script to specify a pre script. This will be
executed before device handler open serial port and invoke runner.

Currently, pre_script can only get from hardware.map file. just like:
./scripts/sanitycheck  --hardware-map xxx.map
and set pre_script in xxx.map file.

Signed-off-by: Watson Zeng <zhiwei@synopsys.com>
This commit is contained in:
Watson Zeng 2020-08-25 15:29:43 +08:00 committed by Carles Cufí
parent 3b43d946fd
commit 0079cecc19
2 changed files with 10 additions and 2 deletions

View File

@ -3520,14 +3520,15 @@ class HardwareMap:
self.detected = []
self.connected_hardware = []
def load_device_from_cmdline(self, serial, platform, is_pty):
def load_device_from_cmdline(self, serial, platform, pre_script, is_pty):
device = {
"serial": None,
"platform": platform,
"serial_pty": None,
"counter": 0,
"available": True,
"connected": True
"connected": True,
"pre_script": pre_script
}
if is_pty:

View File

@ -619,6 +619,11 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
for testing on hardware that is listed in the file.
""")
parser.add_argument("--pre-script",
help="""specify a pre script. This will be executed
before device handler open serial port and invoke runner.
""")
parser.add_argument(
"--west-flash", nargs='?', const=[],
help="""Uses west instead of ninja or make to flash when running with
@ -878,10 +883,12 @@ def main():
if options.device_serial:
hwm.load_device_from_cmdline(options.device_serial,
options.platform[0],
options.pre_script,
False)
else:
hwm.load_device_from_cmdline(options.device_serial_pty,
options.platform[0],
options.pre_script,
True)
suite.connected_hardware = hwm.connected_hardware