From patchwork Fri Jan 20 08:23:33 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: 644622 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp658106pvb; Fri, 20 Jan 2023 00:24:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXuhkojOabvR0isIsnBFW+nPQxC3MDMC7aAlwK4tIjxuf2UxpqqDTEjW1BGge8V3xkZcio0g X-Received: by 2002:a05:6214:3506:b0:535:27d5:f05b with SMTP id nk6-20020a056214350600b0053527d5f05bmr20718588qvb.17.1674203083753; Fri, 20 Jan 2023 00:24:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674203083; cv=none; d=google.com; s=arc-20160816; b=TZiZvfXwdj+dLxnRDMcXchE2BGLHpr2mcS1cfkUm02y/+fXvi1FOA6rtQjVyfVQup6 NedCB9McbWion7DJ8Ko0zs6/QQvbBOBOuNcdXNHtTr2IPKBZGTJo0S29+9dTUqgaWVtg SZ/IBT3kMUnBjj4K50zSdMxV0S/o+0LiFuNKTnGZD0Ozh5BUsp4vtMGACjulfw17zthZ H8o33umwMYVui1K2f07WMTay0mrt9S6QK3Io9Z8S4WXN67orca4hxMqZQ/PTjPlsCJ8c m3PWY3GzY9OjjkHGLA7MkJUaYjzJRD/t6Dhal6fXPFWOKbn7ZQ0d63EEhf+Di0cMyvQ/ lT+w== 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=1A5XESI7TZ+yAtbO2UTL/bHexDg6E6J3DUKnc81TIsg=; b=BHrQbbdzuc6wX4JcdgaMMOZ5FN7DblpaXcZ5Ma42kE4jPwd9me6pFX+VeVuctCOjbM Az2anltljC7Rn3MNqYpgJsJB5hrkqiTk2wIW+/aNNViWsNXHs6xC/ZSZGRgTKNbMAAKF tjeLdSsfUqb8qAaz7RKB6v9CO2q413fY6wASpXrPJjOO+LpO8le0IYo/NxIlVsRUiZ0z EprAS2RtgeI533ev63qG3YqOA6jFMosFfnHWmCYz1Cz12Qv+MW6iaYsv4elRbH03KS8e cPKiLt2/BGsUrC9m7upmDG0JI4oeS9ZTRGnW+KjJ33Af+sJpkRsUxqmJP1zLcXiLOTd2 +R9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sij4FTf8; 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 k12-20020ad45bec000000b005318cf5172asi4376814qvc.520.2023.01.20.00.24.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jan 2023 00:24:43 -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=sij4FTf8; 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 1pImgy-0004i7-29; Fri, 20 Jan 2023 03:24:08 -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 1pImgs-0004ga-Dx for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:24:03 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pImgq-0004aU-Ai for qemu-devel@nongnu.org; Fri, 20 Jan 2023 03:24:02 -0500 Received: by mail-wr1-x42a.google.com with SMTP id d14so446574wrr.9 for ; Fri, 20 Jan 2023 00:23:59 -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=1A5XESI7TZ+yAtbO2UTL/bHexDg6E6J3DUKnc81TIsg=; b=sij4FTf8IkBYLrd8CAQVgE2UQ7XoNGnRjyz4CuHxqJ5axll55NYvvPM++dJGCBMbW7 gQLLsZ4bjPl3pTq7+7ASYx7fZ2tWD35dIhf4w1QqU0eaqdpWdun/3DrDEypBIDcb9BNE dzuVHpYP5D+toXTbos1pgLwNQLlz9hZMpRwcE5SDOFUwPPDqvPfyLN1Gg/Kahpxnvw2Q rWh/nzhKEo61zV/Y/lDcbo+MlsyVSsDOXkoCqDYDiIJq6TrN0IBwIo0MJw9QmLm9+eH4 bAgSHRwY5yIg+BGbTBuZQpP81fhAeRFcwJBH5woEBNuZtH881ww9zI1xkcYfs/xMOZEV WGtg== 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=1A5XESI7TZ+yAtbO2UTL/bHexDg6E6J3DUKnc81TIsg=; b=ntr4v7udm1uTcKrk/yqtYQ+GF7REhmD8krhAMImDMIgo8VzoE0tYyzgLsd/YAFx/fq yZMbQPRSB1SU8lDT2/MtMW0Z+SyV3J7atzdqjhoKRXok11S9mmxyBEPQGISVez7/+auH vds56kFJndCr70GOQEDC8QzYvMwncVCrXjqE4fsjqTGZ+EEZsdnGcKRADKPZRlt/c0Vu zviWC9QlcEx3vWzZWaL13PpCJ+GhNY6WvY0SKwFAakGnEGn8eO3hOBwiCKBzplPcbEzL nSdW+3u3hP+JkXhvcOtpGnAmtcBBuS2laA1h2krJ6VPO+wmLe23Rp6QexkC8HT5a6tv0 fAIw== X-Gm-Message-State: AFqh2kpU1rFSB8rvVaUrRgbdn3Y8soHH2uw1V8bn65n2FvkZeM0yA3gJ rwDJEy1S1ICw4xVJHrkTZuIOsgqlc8z7TIwb X-Received: by 2002:a5d:4842:0:b0:2bd:eccd:7ea4 with SMTP id n2-20020a5d4842000000b002bdeccd7ea4mr12256356wrs.47.1674203038501; Fri, 20 Jan 2023 00:23:58 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id w5-20020adfcd05000000b002bdc914a139sm26774409wrm.108.2023.01.20.00.23.57 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jan 2023 00:23:58 -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 03/11] tests/qtest/boot-serial-test: Build command line using GString API Date: Fri, 20 Jan 2023 09:23:33 +0100 Message-Id: <20230120082341.59913-4-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::42a; envelope-from=philmd@linaro.org; helo=mail-wr1-x42a.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 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- tests/qtest/boot-serial-test.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index 3a854b0174..92890b409d 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -226,14 +226,17 @@ static void test_machine(const void *data) const testdef_t *test = data; g_autofree char *serialtmp = NULL; g_autofree char *codetmp = NULL; - const char *codeparam = ""; QTestState *qts; int ser_fd; + g_autoptr(GString) cmd = g_string_new(""); ser_fd = g_file_open_tmp("qtest-boot-serial-sXXXXXX", &serialtmp, NULL); g_assert(ser_fd != -1); close(ser_fd); + g_string_append_printf(cmd, "-M %s ", test->machine); + g_string_append(cmd, "-no-shutdown "); + if (test->kernel || test->bios) { ssize_t wlen; int code_fd; @@ -243,19 +246,23 @@ static void test_machine(const void *data) wlen = write(code_fd, test->kernel ? : test->bios, test->codesize); g_assert(wlen == test->codesize); close(code_fd); + g_string_append_printf(cmd, "%s %s ", + test->kernel ? "-kernel " : "-bios ", codetmp); } + g_string_append_printf(cmd, "-chardev file,id=serial0,path=%s " + "-serial chardev:serial0 ", serialtmp); + /* * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - 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, - test->kernel ? "-kernel " : test->bios ? "-bios " : "", - codetmp ? : "", test->machine, - serialtmp, test->extra); + g_string_append(cmd, "-accel tcg "); + g_string_append(cmd, "-accel kvm "); + g_string_append(cmd, test->extra); + + qts = qtest_init(cmd->str); + if (codetmp) { unlink(codetmp); }