From patchwork Thu Apr 30 15:57:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Foley X-Patchwork-Id: 185925 Delivered-To: patch@linaro.org Received: by 2002:a50:3a95:0:0:0:0:0 with SMTP id v21csp1030362ecc; Thu, 30 Apr 2020 09:11:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJ5wu9bOopOlfvDfPJJ1BtaNzlWtxe1Mv8EUYbVfm6lT4tOfFxJBTMm0yRs53edEDlYermV X-Received: by 2002:a05:620a:1306:: with SMTP id o6mr4132864qkj.443.1588263081195; Thu, 30 Apr 2020 09:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588263081; cv=none; d=google.com; s=arc-20160816; b=tjtgKKE9vsToDik89Xi1lgpcKoRem5pRK2jxIwS3EuHIhosYpheyTGbanmTxeo1hm/ 6AVgYLgQ4uZ0mFV1T04MA/W/nhsKnIDpPb1DOSfzErQeg0KFEgTwPe/rdUVn6RvwM1pc +PnN6ttIsfISRTT2R7tVn0NyDhl/XQtmczdzStpZgCayypYOOKplIWpcNpeVS5uJ6czp M8Mz9is8JMHn6TKrmZrRW1/NtHqoDISOz46sm3vIpGnk5wBfqn7AeRXAwq/FvUApL9LG 6dNllBbtByDqrzgOqAm0YqGPHHzv5/iF5R0KIzhEhQUIp/eP33AvG1bEYntDd1t1yqV0 XHIg== 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=7n0OEOUcViSoi8lDFmvS1FDdqucfcjXxY1zrvZFIRGA=; b=qUDp6jhX7ZTL9+NC3i+WHmBFJJ/a7QcyChYYhHybhPM8I+GUH/wzprYFvQJjIaPeZX VKjFEPVjOWmNnxNhwkDuabehYFq0/eFz9T41dVsfohI/bygi8Uj8WhhGA/S3KG5XUkQT o7zX71XsZ5cX3izuVh6GoVMshJRBbUOwQSWXy8FGHAFR7PrpRPmLF1B7SqYvXDCM8FQD YxBP1q5sWjIRwd3OlDhQ2xgWWCGhvhq7vQEnGFlcEcvma8/+OwbZ6C8Cp7wW4Q+fnrhw LoavUZy0MBnlZiW1rOlNHEsaWzFX5EAzPi4JOo7292bqjf+OrbtXkmDgcB9cGyMMw89O BHaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h5q1pEd1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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. [2001:470:142::17]) by mx.google.com with ESMTPS id p13si1627204qkg.357.2020.04.30.09.11.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Apr 2020 09:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=h5q1pEd1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::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]:53682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUBmS-0006GZ-Ij for patch@linaro.org; Thu, 30 Apr 2020 12:11:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45436) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUBdU-0000UU-Gg for qemu-devel@nongnu.org; Thu, 30 Apr 2020 12:03:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUBaC-0003CJ-Tu for qemu-devel@nongnu.org; Thu, 30 Apr 2020 12:02:04 -0400 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]:40432) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUBaC-0003Bs-Eg for qemu-devel@nongnu.org; Thu, 30 Apr 2020 11:58:40 -0400 Received: by mail-qt1-x844.google.com with SMTP id e17so5377787qtp.7 for ; Thu, 30 Apr 2020 08:58:40 -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=7n0OEOUcViSoi8lDFmvS1FDdqucfcjXxY1zrvZFIRGA=; b=h5q1pEd1IHxUeE3X2QUkC6hHBI/quzW+osUrMvXMbkP26ag2wX+Rpys/RU1awmfLXZ vEhMmZz2odSY3BefYjilamPgqGPyLWO5R3S697pgNocfh2TIlzoMQDn7Pqo0iJr1p+Kh Q2F8QWja/Hz+X8EpKENKbq8NHroiMtV4eBcibLr2aLojHL1qu9AlNfqP6mdrzYMeKKq0 6TWWpNsXdFPDX32TmgAOE4hxDV4JxNGdO3JdYHvNzu3lO3p8vJwQ/pLtwrnT7Jr46N4f SkLhAyCGaHEh8+2RgImqvslORwIp0XtBhJY8P+2LJcjQMpB0cLruNhypHbDknXGxrGYi oduw== 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=7n0OEOUcViSoi8lDFmvS1FDdqucfcjXxY1zrvZFIRGA=; b=OS6OvI2j5NI9OHbJ0lK3gFQ344/4VfhCnhayo2sDf775ynn411bhzR9BeyFLPxH7fo cN5x84NXqH2erL6e/XUqhDGzpyXnaGiouG+iK7rmGeIBZvDo9vJKdME2gGPgMsoVO8o4 BEw7xgt80YOVuMXCqrh9yE3brA4n9g1ZLY4eo48qm/QKVo4mFp/J3E/TzvvDQpumhSlq pS7Ltc/0gP7Cn6/A5kKv4S//1GAdutNEPovWmCQKCXzYXGHJAbEpRcOvj3EnqbSfmAs4 ma7m7uCaDzuR6B8shn0Xh/nwaAEKVYcs88ry+M81wmYjtezJTmhqx9WkwqkXBg1fqb/p V2kQ== X-Gm-Message-State: AGi0PuZrFq1nyvYVvAJC6iu1iZ0jqr32eHAVQfaDwzaxNtWNcAMwcClF 4bszj+Bg3SBGKsCOE49X2DIGPMK7lPfj0w== X-Received: by 2002:aed:3bda:: with SMTP id s26mr4329055qte.261.1588262319113; Thu, 30 Apr 2020 08:58:39 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:7489:3328:3806:7c3]) by smtp.gmail.com with ESMTPSA id v16sm305254qkf.80.2020.04.30.08.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 08:58:38 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v5 3/9] tests/vm: add --boot-console switch Date: Thu, 30 Apr 2020 11:57:12 -0400 Message-Id: <20200430155718.212-4-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430155718.212-1-robert.foley@linaro.org> References: <20200430155718.212-1-robert.foley@linaro.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::844; envelope-from=robert.foley@linaro.org; helo=mail-qt1-x844.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::844 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 Reviewed-by: Peter Puhov --- 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 97f8ac4218..983adbf6ff 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -86,8 +86,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: @@ -551,6 +553,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() @@ -565,7 +569,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, @@ -585,6 +590,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: