From patchwork Thu Mar 12 14:27:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 184463 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp634578ile; Thu, 12 Mar 2020 07:37:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt8au3GRzmwa+L/ws0tsO5BAS6+1OhvXu6GN5uhPqDebF22N62CDsDiOtum1mLS9Uf1xjwY X-Received: by 2002:ac8:340d:: with SMTP id u13mr6412730qtb.235.1584023851865; Thu, 12 Mar 2020 07:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584023851; cv=none; d=google.com; s=arc-20160816; b=gUpFPICqNCsD2vIfOEKEUYN5XdxTV2oWzwGAYCXkqf6gkJ005Q4izBM7cSXNvPNvaQ cPVYlVRRdFUGiDj3Ly9xVpAXrjh3NMvC0oHn3Kx0DkjaQymEDHEP8m6o5wgs8Rtffw+Z WvhpUcyXxvU5Ma7cQlhccQDHujiyp7FLTpiaDldedhWwdU4G9jTatA4PkDyRdCVs/QDt gk/y+WwwuWR/SVc21KH0mPZR0He1dyylL5Gnokuij/vD5dbD/L8cFKLMafiP1YPBQShQ 8YikZVU1pZHrgwuhcT68ML82sX+1he8Cvu/Aylq6oABYs18Zau71fJFoUmRlILCVnsDU bXCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=Kg9peQoC2sg52IZVPinKGbMeesGBXCKH6J+N63DQI98=; b=jqkHncniQx+IDQ2adBMM6UROsNs8GjTLHVLzLS51pXN2L/gyNreHkq23OUoYijBmSv xIWVgEwHOT/Kg6RS8UZLLVgtHzLWkiO0sG9ecFb1CEvsx5hSsQ4e7RVzkcmwHP7vCHDK EwAjf9GNTIVDeWvLZ/aHvG61wHzAfA9ZCzqemj0IfMv6LTvr2flA8cix/+HB1wVIYPKt 29DYnxRM6sFk5I0wXvplCCX4Kplz4oyGfEqtYraQF73D5poK20Rldova9JaMt5al8zfV fePTOgmII4mUKnFcvXjf8Ippu8kHua/dr7MGd7peBOhgRSx6++gjgUoEbJtQNxvYZ12q PTJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IoHMkWn4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q19si2853743qtr.67.2020.03.12.07.37.31 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Mar 2020 07:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=IoHMkWn4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCOxn-0002Tl-Bn for patch@linaro.org; Thu, 12 Mar 2020 10:37:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35664) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jCOrC-0007Cc-PO for qemu-devel@nongnu.org; Thu, 12 Mar 2020 10:30:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jCOrB-0006V8-Ei for qemu-devel@nongnu.org; Thu, 12 Mar 2020 10:30:42 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:33049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jCOrB-0006Ug-8i for qemu-devel@nongnu.org; Thu, 12 Mar 2020 10:30:41 -0400 Received: by mail-pg1-x536.google.com with SMTP id m5so3181182pgg.0 for ; Thu, 12 Mar 2020 07:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Kg9peQoC2sg52IZVPinKGbMeesGBXCKH6J+N63DQI98=; b=IoHMkWn41ef7kLpALelhVQFIr///zjCkq9DW4VuiBLnY/7XyjVca5xJWIjNJSorfja go02LBeI/WFIg8fNltG35vTGmbwka2XnMf2G2Ak+PB4uW8Y8I8xQkM/SkZnYLKuYpZoN 3dYfKtoVcQK57A/GHGDuRVJ7JUgfgIFlzlq/sFXaGYcnRvjbXx5TPgqBwztXqKbeAzkU gBvlJY4oRzdEfRuHA3vZ2vWSX91Cv9ontzwL0vGsgecAHQSaZMrd5JilOW71WwuGmDwq 6A5nvgZeOiPccA1JqAaSKFq6XxJKEcBl4+km7gjA3wShSNtL2dsfcjF5W0IEbv6VHuFf SjWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Kg9peQoC2sg52IZVPinKGbMeesGBXCKH6J+N63DQI98=; b=kwrtbo/SM4pIZNc2JvZFUvCNWZ3c6RSFtKpetCbuYOuKyirv6mVXmyjF9lhqgnBbG4 pqIiiIgUIoQif4Aj3rCjidbtWLbICxQcJg7opAlH0iLbho6E4AIV9ecVVO5TO1ZBuJc1 oHk1z4ltEDM5oGp7t8giHtq2qIvH+AP0cLB0WkGu8414qeAkNr5PWIqF0wWUrAGb0pM7 FWPs4y2F4lxtkLG9FIWgyFHuLu/lIiSzcNoKq5kUdWWQkj6w5iADbhTnuetvHMKO/NHv yrvFzvXhk8rSXDlIRoLCF982bD7UGNXjgkRkGZ3Z/i5iZFve3Izqv/hW79USwQcrWKrX hiRg== X-Gm-Message-State: ANhLgQ26MsPb3ALaMs5QXxhbJUWOUJEIlM8YwW/gGEWKE15yrOAmWKHv 1TshqHllPXvUrqEkncjIvRlTK9AHAP0= X-Received: by 2002:a05:6a00:48:: with SMTP id i8mr6714715pfk.20.1584023439896; Thu, 12 Mar 2020 07:30:39 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:845e:b9f6:81a6:8f5e]) by smtp.gmail.com with ESMTPSA id 63sm14832651pfx.132.2020.03.12.07.30.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2020 07:30:39 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v4 04/10] tests/vm: add --boot-console switch Date: Thu, 12 Mar 2020 10:27:22 -0400 Message-Id: <20200312142728.12285-5-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200312142728.12285-1-robert.foley@linaro.org> References: <20200312142728.12285-1-robert.foley@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::536 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Added ability to view console during boot via --boot-console switch to basevm.py. This helps debug issues that occur during the boot sequence. Also added a new special variable to vm-build: BOOT_CONSOLE=1 will cause this new --boot-console switch to be set. Signed-off-by: Robert Foley --- tests/vm/Makefile.include | 4 ++++ tests/vm/basevm.py | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include index 78a2de1f82..d921ee14cf 100644 --- a/tests/vm/Makefile.include +++ b/tests/vm/Makefile.include @@ -40,6 +40,7 @@ endif @echo ' EXTRA_CONFIGURE_OPTS="..."' @echo " J=[0..9]* - Override the -jN parameter for make commands" @echo " DEBUG=1 - Enable verbose output on host and interactive debugging" + @echo " BOOT_CONSOLE=1 - Show the console output at boot time. " @echo " V=1 - Enable verbose ouput on host and guest commands" @echo " QEMU=/path/to/qemu - Change path to QEMU binary" @echo " QEMU_IMG=/path/to/qemu-img - Change path to qemu-img tool" @@ -62,6 +63,7 @@ $(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ $(call quiet-command, \ $(PYTHON) $< \ $(if $(V)$(DEBUG), --debug) \ + $(if $(BOOT_CONSOLE),--boot-console) \ --image "$@" \ --force \ --build-image $@, \ @@ -76,6 +78,7 @@ vm-build-%: $(IMAGES_DIR)/%.img $(if $(DEBUG), --interactive) \ $(if $(J),--jobs $(J)) \ $(if $(V),--verbose) \ + $(if $(BOOT_CONSOLE),--boot-console) \ --image "$<" \ $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \ --snapshot \ @@ -96,6 +99,7 @@ vm-boot-ssh-%: $(IMAGES_DIR)/%.img $(call quiet-command, \ $(PYTHON) $(SRC_PATH)/tests/vm/$* \ $(if $(J),--jobs $(J)) \ + $(if $(BOOT_CONSOLE),--boot-console) \ --image "$<" \ --interactive \ false, \ diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index dd545d3d1d..aab3d98edf 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -85,8 +85,10 @@ class BaseVM(object): # 4 is arbitrary, but greater than 2, # since we found we need to wait more than twice as long. tcg_ssh_timeout_multiplier = 4 - def __init__(self, debug=False, vcpus=None, config=None): + def __init__(self, debug=False, vcpus=None, config=None, + boot_console=None): self._guest = None + self._boot_console = boot_console # Allow input config to override defaults. self._config = DEFAULT_CONFIG.copy() if config != None: @@ -535,6 +537,8 @@ def parse_args(vmcls): parser.add_option("--config", "-c", default=None, help="Provide config yaml for configuration. "\ "See config_example.yaml for example.") + parser.add_option("--boot-console", action="store_true", + help="Show console during boot. ") parser.disable_interspersed_args() return parser.parse_args() @@ -549,7 +553,8 @@ def main(vmcls, config=None): config = parse_config(config, args) logging.basicConfig(level=(logging.DEBUG if args.debug else logging.WARN)) - vm = vmcls(debug=args.debug, vcpus=args.jobs, config=config) + vm = vmcls(debug=args.debug, vcpus=args.jobs, config=config, + boot_console=args.boot_console) if args.build_image: if os.path.exists(args.image) and not args.force: sys.stderr.writelines(["Image file exists: %s\n" % args.image, @@ -569,6 +574,8 @@ def main(vmcls, config=None): if args.snapshot: img += ",snapshot=on" vm.boot(img) + if vm._boot_console: + vm.wait_boot() vm.wait_ssh() except Exception as e: if isinstance(e, SystemExit) and e.code == 0: