From patchwork Fri Jan 20 08:23:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 644633 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp658604pvb; Fri, 20 Jan 2023 00:26:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXvar4/yUVUjC1IoUlsCyYHRakNnyRJsNPHRAX1dak4j+ap0E1pHOonQ7XONzE9UjxscS92C X-Received: by 2002:a05:622a:4a83:b0:3b4:7e41:daa8 with SMTP id fw3-20020a05622a4a8300b003b47e41daa8mr20884061qtb.28.1674203175718; Fri, 20 Jan 2023 00:26:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674203175; cv=none; d=google.com; s=arc-20160816; b=oh0aTvWtRsQNGz21nb8E7QbEX90f/0kgt1OcbURUwyl32qmxlX+xKSs3Kdm8fhv+rq wh/sHo7m2T1dBf2fQWCSeWqf9qgbMtm7mWzhJir380O61jv+P6bhU10GYiNMDJc/hDIq JyQmLiE/lOTSGoMqEJ7KsUOBWE0RXVQ+6kzLOLmjVQyFDP6ojNU3H2ielC6uhn06zHzL k43CqjWeYSD1VaMRH09INrvukQu8HPCf2eJgPpxpsIUsU5XgJRmvW/xVzRGxhd8nzBTe jMb9bUEpYgV0DN1v6FXW1cWioAVKgfM7Uza3hqeWrJ25PSIrbFqASR6xdJFy8a9dtUd9 jzPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=96awe59Bl1JmrEDLbt0RIPfUyUqBQm6nbi4HGeicux4=; b=DkjpcSziu6OoXiB5m5ryWs3z/uA3RbmJTMbJt2ACd3bJCaI2CZcYbZipd5RkVNznpR 9mPi8GUNWsgEOLvoE1bRbIizYBZCxDPR4rF+N6OrE5s6Ouqoass7xRc7qkQ+QURgNKm8 NMCFsfOitxF/tUkafReBNeWcDV4S33ejifia+d2aexir3/Bv6IRqfc+3WzzXf8JV5lDl XgJvtWK0WJFGHOO78QOEdQPPd74crS2aJMEdnqg7ROOI9NUBP3gfUWK1p6u+iEt4z//6 kjYguIvILqnIGFIpm+QjJ9ElpJqlgD1VeyHAy35E5/3P8E302zqE7pzAV6NWbAAvKSOl Zb5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SiTX1Vhs; 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=pass (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 fg26-20020a05622a581a00b003b69de6b99asi197597qtb.229.2023.01.20.00.26.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jan 2023 00:26:15 -0800 (PST) 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=pass header.i=@linaro.org header.s=google header.b=SiTX1Vhs; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pImgp-0004fl-1U; Fri, 20 Jan 2023 03:23:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pImgl-0004ch-W0 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:23:57 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pImgk-0004Yl-F1 for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:23:55 -0500 Received: by mail-wm1-x32d.google.com with SMTP id k16so3391185wms.2 for ; Fri, 20 Jan 2023 00:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=96awe59Bl1JmrEDLbt0RIPfUyUqBQm6nbi4HGeicux4=; b=SiTX1VhsgcvxE1cKCro2n5Mi9jtOQaep9/ODJ5g0I8+IccdsjcoIpUGTPMAivMl57Q OaRxlXCu+tR9/p3M1Y5Tud8mXI0nVmo2kgJ7S9qBnKY0dh0PqQkuHEZr0TcmC86xsd3O 4vPMCgQSXG+msdPBFmNTR4OJiiTutJ8O5KeQhuE9R6jza0UaWXZJgdSGX/BxJRsEq2v3 zHeGDMqOrRGAFzDaVmAjOAMRiLxz/ubqnvgCGANAgh+oH9hQNlzHMkYNTOX/M8PcxeGj tESNWrq6K+XPjPacohfOGBXxO86UDMcXnYxAgVjbfs/+2nztFZLYBjfjjNkAO29ceibc KMOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=96awe59Bl1JmrEDLbt0RIPfUyUqBQm6nbi4HGeicux4=; b=OqMpDgTkXkh5Mxn2bBvbbWL+gJUosAZvUsB6K363yhHmk4jy3yvYj33bLVG3wJo/7V GHT900zwVyvAZEQnVpsuJc0v+5BddtrcXYuGOQv67MGehbDPdz10o5d4gDMUxTi3fzm3 QJITXtQkL97TvGKld4YtbIePw3a9vqvYs+vDS7y1VHySuNd4MvwSgiJB8tF74ODBg2cE oygTaIAb7q/NDyRhOkVh6BuTGKCc3xhb+raY8nxFyBstAlJ/b0U7qq8rvaI3XGBXHC/D VPiIF8Hn44e0XZ4Nu2ra0MBE8g2HIIAmH0XYhkCnpI0t7RpY/zLXrwrCVh8mW/zkhCZ+ pY9A== X-Gm-Message-State: AFqh2ko1d81ZQVvnSsDHbikrpIlBXlcOqDkshh9WlTPHaDw1xTGtHPrK MIDiQ3re+yZjXCbqpGicSfbRvCSpv8LrxbIA X-Received: by 2002:a05:600c:3d9b:b0:3db:1afd:ac36 with SMTP id bi27-20020a05600c3d9b00b003db1afdac36mr6977627wmb.32.1674203033493; Fri, 20 Jan 2023 00:23:53 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id u8-20020a05600c19c800b003db0647645fsm1571932wmq.48.2023.01.20.00.23.52 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jan 2023 00:23:53 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , "Dr. David Alan Gilbert" , Thomas Huth , Fabiano Rosas , Juan Quintela , Laurent Vivier , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Richard Henderson Subject: [PATCH v3 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit Date: Fri, 20 Jan 2023 09:23:32 +0100 Message-Id: <20230120082341.59913-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230120082341.59913-1-philmd@linaro.org> References: <20230120082341.59913-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Slighly modify test_machine() to simplify next commit review. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- tests/qtest/boot-serial-test.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 3aef3a97a9..3a854b0174 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -227,7 +227,6 @@ static void test_machine(const void *data) g_autofree char *serialtmp = NULL; g_autofree char *codetmp = NULL; const char *codeparam = ""; - const uint8_t *code = NULL; QTestState *qts; int ser_fd; @@ -235,21 +234,13 @@ static void test_machine(const void *data) g_assert(ser_fd != -1); close(ser_fd); - if (test->kernel) { - code = test->kernel; - codeparam = "-kernel"; - } else if (test->bios) { - code = test->bios; - codeparam = "-bios"; - } - - if (code) { + if (test->kernel || test->bios) { ssize_t wlen; int code_fd; code_fd = g_file_open_tmp("qtest-boot-serial-cXXXXXX", &codetmp, NULL); g_assert(code_fd != -1); - wlen = write(code_fd, code, test->codesize); + wlen = write(code_fd, test->kernel ? : test->bios, test->codesize); g_assert(wlen == test->codesize); close(code_fd); } @@ -258,12 +249,14 @@ static void test_machine(const void *data) * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - qts = qtest_initf("%s %s -M %s -no-shutdown " + qts = qtest_initf("%s %s %s -M %s -no-shutdown " "-chardev file,id=serial0,path=%s " "-serial chardev:serial0 -accel tcg -accel kvm %s", - codeparam, code ? codetmp : "", test->machine, + codeparam, + test->kernel ? "-kernel " : test->bios ? "-bios " : "", + codetmp ? : "", test->machine, serialtmp, test->extra); - if (code) { + if (codetmp) { unlink(codetmp); }