Skip to content

Commit 4d57e9f

Browse files
committed
qemu: Add -x for running shell commands
As a special case of a callback. eg: qemu-pseries -x "ls /"
1 parent 3d4593c commit 4d57e9f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/qemu.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def configure_from_args(self, orig_args):
9191
parser.add_argument('--qemu-path', dest='qemu_path', type=str, help='Path to qemu bin directory')
9292
parser.add_argument('--root-disk-path', dest='root_disk_path', type=str, help='Path to root disk directory')
9393
parser.add_argument('--callback', metavar='callback', dest='callbacks', type=str, default=[], action='append', help='Callback to run')
94+
parser.add_argument('-x', metavar='shell command', dest='shell_commands', type=str, default=[], action='append', help='Shell command to run')
9495
args = parser.parse_args(orig_args)
9596

9697
if args.gdb:
@@ -174,6 +175,10 @@ def make_callback(func, arg_str):
174175
func = getattr(qemu_callbacks, name)
175176
self.callbacks.append(make_callback(func, arg_str))
176177

178+
func = getattr(qemu_callbacks, 'sh')
179+
for cmd in args.shell_commands:
180+
self.callbacks.append(make_callback(func, cmd))
181+
177182

178183
def apply_defaults(self):
179184
if not self.expected_release:

0 commit comments

Comments
 (0)