From patchwork Thu Jan 19 14:58:34 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: 644087 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp257012pvb; Thu, 19 Jan 2023 07:00:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuRO51kMeDTJrTVJZ1RujmnFjQlvOkOT9mVnr97oMsYB3LLVUPAAQteEEIKy7kATBlctD27 X-Received: by 2002:ac5:c2d8:0:b0:3da:9f52:96ae with SMTP id i24-20020ac5c2d8000000b003da9f5296aemr7174864vkk.16.1674140404155; Thu, 19 Jan 2023 07:00:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674140404; cv=none; d=google.com; s=arc-20160816; b=C/PJppl1bPyv/pBSpcALAHj/84z9J4Xh6mHiwy82Kip+DsCk56OAJBQEY/edAunHQD tvChlS5jCPxyLIzv9EW4D8/VdQdjj63ijFqfSza4DbgqRk0gMYAW2NTkN3jv3cPcnsO6 IA8CzzBh4lU28TgBcSWIkI1V1GNvtOXBy2T9SG3GX3fEn8AYDtMDBCYPSBKAVXd5XXG5 hNclelx0lK/Ym02SSq5DZgjTRn5Fp/0xrryx99z04hpgP5dwnX/Tez1NgDDCbF86PkNU +PxGBZ9JiB4uJeU1EVtFUWapyDEl1jiPnMd6LtfDL4U8ix8L1+vog1873y5haOqXFFAr Z8cg== 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=isWU99zMSOEnAE1RSfFCfmsXaFaInKvayEoBiTZj20E=; b=JobYNaMR3uqy3LIPf0igWCvRFV3J+hAeG1AjCaGfVcuWGSsJpHe+m8CfEHkNuSB7wt CQs4qSJXD23oXFEC7xHg1U0apaKIgUng4PiLoJ80mVRdtCYC+wQgsC0vdAwOZaslunBc mm2Yb0EhDx9uO6kayCsM/a8aRodAZ5kG6IxhSjOIqJmw3xbDfe+kO0MEK26Us1uxMcW/ S3k89r29RnQaDKRxrjFWEd+jmBC/Z7Oov5Ab9kgsHngo5Gq7iGxwxNm6ofH6tcVsaL0E WG7HmLE38vc7Ohl7TlhAFUNEn5gapVVc2tC+DJzVydvIiEJGhTCLIJbDWzQ8CdCgnLGx juRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fosVB18T; 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 x190-20020a37aec7000000b006fa49f3a642si21071237qke.159.2023.01.19.07.00.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 07:00:04 -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=fosVB18T; 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 1pIWNz-0006jX-B1; Thu, 19 Jan 2023 09:59:27 -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 1pIWNp-0006UX-Nl for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:59:19 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIWNo-0003Z1-6w for qemu-devel@nongnu.org; Thu, 19 Jan 2023 09:59:17 -0500 Received: by mail-wr1-x42e.google.com with SMTP id r9so2141233wrw.4 for ; Thu, 19 Jan 2023 06:59:15 -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=isWU99zMSOEnAE1RSfFCfmsXaFaInKvayEoBiTZj20E=; b=fosVB18TI+mAnXjLHz/fhtdfKY4YsG0SmPU5QXIdFxotLYfXM3HcPD/fhbFo+9ptHF JIqmgnTMsbrWyppROk0Ff+Ud3binXAj7VVnmfPrFvbNG0RUimTAbkgn7xqA9jFPzFhps +6fRoQcKU5K4nmGU6rvdyS/HatAAeVLmgfjdTrffV8BrbRj2UFOFegGQpuXdumSREyUa aYW98a0SdZ4pzU/FOK1ucAGgegKt6nvhiwJTF7BjSqU7hkoMoiZE7LfPH6qXFCOWhJdp rhWAYGj724QQcw56CzP57Pz5BUIGd1ozWb2G23IkQEDDZJWy9YiIVd2xNZ5MTHC47wL+ 27pw== 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=isWU99zMSOEnAE1RSfFCfmsXaFaInKvayEoBiTZj20E=; b=qNa4kIQ6USjaHeC5akXJJlbSpqWeNQ7VtfdtstLSSMY0yd7kXmOIfMbmBM75h9nmiY P8aUIwvvnICDGaqD7Fdo0B6IxL46lzhZ/n26SP1Tvw5GfFNjqUSX+Z+R8bfPWv2oNshk u3IF5GnR0c8exhquAs8kgX/jNumDJiKsqvhDHSa4dc3wLL3+C9ENy+eFO0eYAfA0ow1W 60EL7dkPKTP56L0JOQVihaWde70dPHDCTc3355KrTdPraryggRZzN08ccD6MvbllRj2u bW29p7UldG2MNkulxFHPcHJKkxrXSKm1ARFbww8erGsDaW6jXN+IfIjN5dK+EikGnQlX pvpQ== X-Gm-Message-State: AFqh2krZkBTx5J4HVJW81FIuJHL+f1/H+nvy8TybwruYGQBW8mLchDjr xjmsnutSIIOxziFMyb68VLuVAJAGULtayRN5 X-Received: by 2002:a5d:688b:0:b0:2b3:b393:181f with SMTP id h11-20020a5d688b000000b002b3b393181fmr9793185wru.56.1674140355207; Thu, 19 Jan 2023 06:59:15 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l1-20020adfe9c1000000b00289bdda07b7sm33113573wrn.92.2023.01.19.06.59.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 19 Jan 2023 06:59:14 -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 07/11] tests/qtest/migration-test: Build command line using GString API (1/4) Date: Thu, 19 Jan 2023 15:58:34 +0100 Message-Id: <20230119145838.41835-8-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::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.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 Part 1/4: Convert memory & machine options. Signed-off-by: Philippe Mathieu-Daudé --- tests/qtest/migration-test.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 6c3db95113..7aa323a7a7 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -582,6 +582,7 @@ typedef struct { static int test_migrate_start(QTestState **from, QTestState **to, const char *uri, MigrateStart *args) { + g_autoptr(GString) cmd_common = NULL; g_autofree gchar *arch_source = NULL; g_autofree gchar *arch_target = NULL; g_autofree gchar *cmd_target = NULL; @@ -601,6 +602,9 @@ static int test_migrate_start(QTestState **from, QTestState **to, } got_stop = false; + + cmd_common = g_string_new(""); + bootpath = g_strdup_printf("%s/bootsect", tmpfs); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { /* the assembled x86 boot sector should be exactly one sector large */ @@ -644,6 +648,10 @@ static int test_migrate_start(QTestState **from, QTestState **to, } else { g_assert_not_reached(); } + if (machine_opts) { + g_string_append_printf(cmd_common, " -machine %s ", machine_opts); + } + g_string_append_printf(cmd_common, "-m %s ", memory_size); if (!getenv("QTEST_LOG") && args->hide_stderr) { #ifdef _WIN32 @@ -674,33 +682,27 @@ static int test_migrate_start(QTestState **from, QTestState **to, if (!args->only_target) { g_autofree gchar *cmd_source = NULL; - cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_source = g_strdup_printf("-accel kvm%s -accel tcg%s " "-name source,debug-threads=on " - "-m %s " "-serial file:%s/src_serial " "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=4096" : "", - machine_opts ? " -machine " : "", - machine_opts ? machine_opts : "", - memory_size, tmpfs, + cmd_common->str, tmpfs, arch_source, shmem_opts, args->opts_source ? args->opts_source : "", ignore_stderr); *from = qtest_init(cmd_source); } - cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s%s " + cmd_target = g_strdup_printf("-accel kvm%s -accel tcg%s " "-name target,debug-threads=on " - "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s", args->use_dirty_ring ? ",dirty-ring-size=4096" : "", - machine_opts ? " -machine " : "", - machine_opts ? machine_opts : "", - memory_size, tmpfs, uri, + cmd_common->str, tmpfs, uri, arch_target, shmem_opts, args->opts_target ? args->opts_target : "", ignore_stderr);