From patchwork Thu Jan 19 14:58:30 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: 644093 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp258280pvb; Thu, 19 Jan 2023 07:01:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXslbZGiNq5wFSbgJ8EYnw8EX38IEAfQmZsg5rKTx0luRtWa3iJHJL3e82hls9fEzHW/DDAB X-Received: by 2002:a05:6870:ab14:b0:15f:6a0f:7fd4 with SMTP id gu20-20020a056870ab1400b0015f6a0f7fd4mr5396976oab.24.1674140500054; Thu, 19 Jan 2023 07:01:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674140500; cv=none; d=google.com; s=arc-20160816; b=y9uKs7dO5u8pvA9acjb//sgCxuTafzYQuaFkua5HRG1/2ZfeWp9jnOSehWS8icLNnF NiHnyGk+NZL1PSFfPbQZ1kXXdHTwgdu/6+y4rm97ELlq9KkvI4oYy9EtcXSc6X5XvsuW SUstbZA9Q1psg/VlA1XTu9dqu/YdAgMiIKO+RxLXt7ps5sxJ294YiB/pI7CtKEdvpL+3 6hSZHHTkvb/cpB3fRO4lGFT6zhdLtMDgXK9Oqy5/uQgvo+gYCYRqb6BQhbcAx6tLaJXm c7+SLfa96n0ecHi2e53n6Plft1syoh1EDVnCU3Cc13MaN/Z+t/3JP92cVikkEsIUeKcK Irmg== 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=es3Dw8MLiqLXATzoVsMpPJx/0iri3aBMV7qIVLaAL/4=; b=wUhaRoJNlQcRJaxLJxlnOLL/oJkEkfUaKWW5zYQ7HjDEPVOeCvmHbjwTu/x2LXvG6r Vx3f0ZuIAQL+Jpfvozq4879F9PA+gxcZeizqlmR5fqCKrFYCzm7KcU/4cZQypVxW9C0C Mr9OqLOYWrre4EeSs+sud9HKgKAR1Uh4v685dQ5ZaKRqctpLtuhhgzw8iIsfAodTKPp6 KCthuxr6e6qqIhy4xMFmPyXakd0Ce4RzK+PZK14MRYY8YTyDCDYUoYPhMGs9Nqli2Lis eZtXYzoDakTNBXe4tmrelVuUBmzk9OALlWEiRVup71CPc/l6wt9vMEZuNLSZ7IrqWJK4 X8zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s0S64k3Y; 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 x13-20020a05620a448d00b007067c891977si7532428qkp.235.2023.01.19.07.01.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 07:01:40 -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=s0S64k3Y; 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 1pIWNX-0006CE-Aq; Thu, 19 Jan 2023 09:58: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 1pIWNW-0006BK-Kx for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:58:58 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIWNV-0003Y7-1x for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:58:58 -0500 Received: by mail-wm1-x32e.google.com with SMTP id iv8-20020a05600c548800b003db04a0a46bso3152905wmb.0 for ; Thu, 19 Jan 2023 06:58:56 -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=es3Dw8MLiqLXATzoVsMpPJx/0iri3aBMV7qIVLaAL/4=; b=s0S64k3YCGevc0R0oTZIH8fIMdDLMa6BHjCYopC0QoEYw3dMbRGT2SJkPn2oxAS29S 5pgEK/hzdaM3N0gsH93FntPpHWRMX82EeqE0lCxAI2SPdHDeNVc58iPG0ZJGtvYelZop 1BEuzraGBDQXNsM7Sw8QBMHAt/Edu+h1OKQ+0opkndkrNh9FEhRhJxq0zG9GZ0i9bJN0 aXrxlghJiCzsjgRBeHAsDkyaGL7kHdiOmxUeVcENUvBEi78eTe4mo2Auw2gRm/0YBuqN M3G8d4NO7r6PG8vZU8QU8TGcGc52y0AlU/Ttjm4Xf92iyeI/wYYMlHcDYNTtlf1aEBRs jFow== 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=es3Dw8MLiqLXATzoVsMpPJx/0iri3aBMV7qIVLaAL/4=; b=5rtbWy6sVNNRNMjhFiOePv/Tns3D1xjDaVVxA8wTIycC4h3H5Ve+uncRB2D2AY0Dp6 qM0bnX3PGXqg2qOs5uTswMqSqam/fscxDYqlc6FQHZMRvZ6wAxSVV73/qqVxZ5Wb3mft wlDyTeKZY0DBCvwAlJEU2rWkG4PVRAhOGEt81b9HxpKFA6wx3PRipehPN0LA7izCHTIH /7PnVkY9r1GuAqI9g/hbUY1RNzGEXhcpjzjpGOkWZarb6x9LUJQUryhB1n2ZAmD6+WFc MbQyVeWmhZkGZ1dWVf8VOuyePGLEK2oot6jpBTBTQ1cqEbAJUHCK0DTo+vpHMVpMmfmM sj6w== X-Gm-Message-State: AFqh2krmgHqb9T44hi5k+TmrpoXooX63DTqOXoddY5mU/5tju1QANIqW 8ibRWQYp3qq+bkdmS0BfJBKaA/u5V+kufL3I X-Received: by 2002:a05:600c:198e:b0:3db:1d7e:c429 with SMTP id t14-20020a05600c198e00b003db1d7ec429mr3422988wmq.40.1674140335259; Thu, 19 Jan 2023 06:58:55 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id r1-20020a05600c35c100b003db06493ee7sm5425204wmq.47.2023.01.19.06.58.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Jan 2023 06:58:54 -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 03/11] tests/qtest/boot-serial-test: Build command line using GString API Date: Thu, 19 Jan 2023 15:58:30 +0100 Message-Id: <20230119145838.41835-4-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::32e; envelope-from=philmd@linaro.org; helo=mail-wm1-x32e.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); }