From patchwork Thu Jan 19 14:58:29 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: 644083 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp256715pvb; Thu, 19 Jan 2023 06:59:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXs9a4B7szBmi51kbHMosMNbSMj6lau1Ejs4E1mYkJiTlCDrakaF+nom59lcXcif2DvNAaUC X-Received: by 2002:a05:6214:5f87:b0:534:61a9:6f60 with SMTP id ls7-20020a0562145f8700b0053461a96f60mr15307109qvb.18.1674140371712; Thu, 19 Jan 2023 06:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674140371; cv=none; d=google.com; s=arc-20160816; b=eRSQ6nRkVMf8Re3Nm6b7ayhZ3K1XPo0fH8JK3XTyaxmY3QfWT/oLQ0s+IwvOQeL5pm 1KovwgGDaFfQ0kay6qRV/eDm5Udshf2mSzfWYMq6n7iPTOJ0zfdHl/FlVXU3MvSBV/bO y/ufAwea6Nanp7+l0+FQfEKie+gwsDYFk7NV6B3IFOvg6AAcMx6ZFtJ57FHPwbQoqzuf bvJOVL8eqJ2mfNDBNw1MbJ5pCD+eCwQdjs6sDBwOjbz3k7eeHQOVJKd1jm1+xPoQ6v+7 ihYRSHe7h2olq0HSbZWednl6+HaAeUFD4fzuaRGzqXrh7f3sG+VdoGdDdQ9Eb9+Ht1eW KU3A== 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=Dbql9l7vSKPentsKxfsPytXlVVV9PrWNWaeeTqrtx+A=; b=w7OH2UtRB7PK4bZE9nvkz91Zw4YI9tCbSg7Nnzpyk/DrQFCH+9ry8K34U505mZvWGI 5MQaP5tIAKa9/msLHJTHfqZ6zcLGH79TK7RjnMg+Dl16jti2XlghZ4oWXipDdNMbC3rd uWdbVtTpL2eQ0xqsBaYOT565gVhM1Huy+ct8QMbcWdA7s8EGjM/Y8zIbgyXFe5BJ/9Vy yybW7L2c8SetHP1mr39TM9EilRe2wddqXPAa7KJFfwh26YRfNhYCyhOSj8vGxfclrY1D 9eP6xzfSCCSNaQhwhGmm0Xa1SaQJ4MI3icFdWXjWqbty/rEm5pHrpWb3BnDqaUucZKya sjIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oEOk9AIQ; 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 6-20020a056214202600b005355c76d48bsi295869qvf.537.2023.01.19.06.59.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 06:59:31 -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=oEOk9AIQ; 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 1pIWNS-00066U-Fg; Thu, 19 Jan 2023 09:58:54 -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 1pIWNR-00065I-7z for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:58:53 -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 1pIWNP-0003Xh-Ox for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:58:52 -0500 Received: by mail-wm1-x32d.google.com with SMTP id o17-20020a05600c511100b003db021ef437so1455828wms.4 for ; Thu, 19 Jan 2023 06:58:51 -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=Dbql9l7vSKPentsKxfsPytXlVVV9PrWNWaeeTqrtx+A=; b=oEOk9AIQ/Fvj26tENwefQ4Gk1I/NGhdiZwSqLMwxte9ZzMTIZAKIgE0pXqFONYj2gq FBw0altoZ/+Dc6qpuF3XQFDmPdqPl1EtLggluXdCwy59w6lp9a9fmTtfLYAAkDFz+p0x +8PGA0AXy/NPs4dsh9ZhAO7Moqmt31MLqkafg0QNMGpPwcu3GwF5oZjUb4ajojO1plEo U17DUwgu1GN0dU1FgDzHiMXWkCQPUdE18u/gjClQxzFAv0AUD8y7Q2gEaB0/KNMlucCv nOVmyeyTO0SSKJ4OocqNVWHkjCkMlLKpqmV1Q+XYEPIXiP2FKSZPz1xG9ispuXd2BPxU 5gMg== 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=Dbql9l7vSKPentsKxfsPytXlVVV9PrWNWaeeTqrtx+A=; b=dQVbOALwtwO0Zu648+TuWDNrMkyLAOY4aezO2PiKlu5m+HgEAnUh8MGzDs9KF9wLL+ wZRPFXrQD2goG9Nh5TQrkSK9L6vema+wmS9grOmTDma3P4pEeHN2Jhc4v1hbF4PPd2un u5ZSP3ATuSeHsXosqSfcjS1MXuEO47OhhE0B5FIJTZDSEv/jLSpR9vVQnrHkbxax3pob a3j1a2mIJOP13Alb2IbCwlF+hc2vyLAAbYU3cOkXTBHME+UMXM0X+IpFxjV36Qrq/Hzx inqZMI6i14zA7H6aT5ShZS4OsG+YZDakAsa5eff1fuw1z/CpHfW9CPXc3xuNVnnDqFNh dxcg== X-Gm-Message-State: AFqh2krMzgzQQwuDwh031ogRPGBH7c4jz89wGLJKoub/JE6nTNLnNM6H 2f04ELd5u4KflKxpBWljatz7CjEen6PHvd4f X-Received: by 2002:a05:600c:4b0f:b0:3d6:2952:679b with SMTP id i15-20020a05600c4b0f00b003d62952679bmr10446693wmp.34.1674140330223; Thu, 19 Jan 2023 06:58:50 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id ay13-20020a05600c1e0d00b003cf71b1f66csm5521830wmb.0.2023.01.19.06.58.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Jan 2023 06:58:49 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Juan Quintela , Laurent Vivier , Paolo Bonzini , "Dr. David Alan Gilbert" , qemu-arm@nongnu.org, Fabiano Rosas , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 02/11] tests/qtest/boot-serial-test: Simplify test_machine() a bit Date: Thu, 19 Jan 2023 15:58:29 +0100 Message-Id: <20230119145838.41835-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119145838.41835-1-philmd@linaro.org> References: <20230119145838.41835-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=unavailable 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); }