mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
tests/vm: allow interactive login as root
This is useful when debugging and you want to add packages to an image. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250108121054.1126164-30-alex.bennee@linaro.org>
This commit is contained in:
parent
3f6b694bf0
commit
376c490c1e
2 changed files with 9 additions and 3 deletions
|
@ -66,6 +66,7 @@ endif
|
||||||
@echo "Special variables:"
|
@echo "Special variables:"
|
||||||
@echo " BUILD_TARGET=foo - Override the build target"
|
@echo " BUILD_TARGET=foo - Override the build target"
|
||||||
@echo " DEBUG=1 - Enable verbose output on host and interactive debugging"
|
@echo " DEBUG=1 - Enable verbose output on host and interactive debugging"
|
||||||
|
@echo " ROOT_USER=1 - Login as root user for interactive shell"
|
||||||
@echo ' EXTRA_CONFIGURE_OPTS="..." - Pass to configure step'
|
@echo ' EXTRA_CONFIGURE_OPTS="..." - Pass to configure step'
|
||||||
@echo " J=[0..9]* - Override the -jN parameter for make commands"
|
@echo " J=[0..9]* - Override the -jN parameter for make commands"
|
||||||
@echo " LOG_CONSOLE=1 - Log console to file in: ~/.cache/qemu-vm "
|
@echo " LOG_CONSOLE=1 - Log console to file in: ~/.cache/qemu-vm "
|
||||||
|
@ -141,6 +142,6 @@ vm-boot-ssh-%: $(IMAGES_DIR)/%.img $(VM_VENV)
|
||||||
$(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
|
$(if $(EFI_AARCH64),--efi-aarch64 $(EFI_AARCH64)) \
|
||||||
$(if $(LOG_CONSOLE),--log-console) \
|
$(if $(LOG_CONSOLE),--log-console) \
|
||||||
--image "$<" \
|
--image "$<" \
|
||||||
--interactive \
|
$(if $(ROOT_USER),--interactive-root,-interactive) \
|
||||||
false, \
|
false, \
|
||||||
" VM-BOOT-SSH $*") || true
|
" VM-BOOT-SSH $*") || true
|
||||||
|
|
|
@ -612,8 +612,11 @@ def parse_args(vmcls):
|
||||||
parser.add_argument("--source-path", default=None,
|
parser.add_argument("--source-path", default=None,
|
||||||
help="Path of source directory, "\
|
help="Path of source directory, "\
|
||||||
"for finding additional files. ")
|
"for finding additional files. ")
|
||||||
parser.add_argument("--interactive", "-I", action="store_true",
|
int_ops = parser.add_mutually_exclusive_group()
|
||||||
help="Interactively run command")
|
int_ops.add_argument("--interactive", "-I", action="store_true",
|
||||||
|
help="Interactively run command")
|
||||||
|
int_ops.add_argument("--interactive-root", action="store_true",
|
||||||
|
help="Interactively run command as root")
|
||||||
parser.add_argument("--snapshot", "-s", action="store_true",
|
parser.add_argument("--snapshot", "-s", action="store_true",
|
||||||
help="run tests with a snapshot")
|
help="run tests with a snapshot")
|
||||||
parser.add_argument("--genisoimage", default="genisoimage",
|
parser.add_argument("--genisoimage", default="genisoimage",
|
||||||
|
@ -675,6 +678,8 @@ def main(vmcls, config=None):
|
||||||
exitcode = 3
|
exitcode = 3
|
||||||
if args.interactive:
|
if args.interactive:
|
||||||
vm.ssh()
|
vm.ssh()
|
||||||
|
elif args.interactive_root:
|
||||||
|
vm.ssh_root()
|
||||||
|
|
||||||
if not args.snapshot:
|
if not args.snapshot:
|
||||||
vm.graceful_shutdown()
|
vm.graceful_shutdown()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue