From nobody Mon Feb 9 21:37:25 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1657221286; cv=none; d=zohomail.com; s=zohoarc; b=SWp9muZD+tqC2Q7YpIrMpTlbbDbrLEEDKm+5kwtJtYlkfpP5cFN/IjLHdDVHrk9Lv3VT6k9CN44yL65hCryhNm3shBlwsdCnbeMOJYLrwjWYeYGnK1uYTkFedrwFIDhgf+Lc84P6opzmm+yrTagLv8ZnviAzKsfsRth2OZpre0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657221286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EZHwydJ2m8+ohqd7YcwCClpdlE51rkDoeWPaLNmT3Kw=; b=l5vMfluKGc+GhMtl01PIq7uQGoUtGKxaOPqVj6xNK1h7Vfcm9Gg0htgSkvmjLEirCCQlHj/jPQ31abUe2HukIJCLpadCvA5GVNo6Suz/1wtalhYajLAueyxQZyTjSR0smnv9jXnA8CckgwDpIZy1ZdYlhOqeYuOyIDE5b0ovj/Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1657221286475259.0015667206618; Thu, 7 Jul 2022 12:14:46 -0700 (PDT) Received: from localhost ([::1]:59424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9WxZ-000823-4f for importer@patchew.org; Thu, 07 Jul 2022 15:14:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9Wf6-00060t-N0 for qemu-devel@nongnu.org; Thu, 07 Jul 2022 14:55:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:50479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9Wf3-0001nj-SC for qemu-devel@nongnu.org; Thu, 07 Jul 2022 14:55:39 -0400 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-FEoKrY6mOhOY5cLBRQ0_xw-1; Thu, 07 Jul 2022 14:55:28 -0400 Received: by mail-qk1-f199.google.com with SMTP id e128-20020a376986000000b006af6adf035cso18554026qkc.8 for ; Thu, 07 Jul 2022 11:55:28 -0700 (PDT) Received: from localhost.localdomain (bras-base-aurron9127w-grc-37-74-12-30-85.dsl.bell.ca. [74.12.30.85]) by smtp.gmail.com with ESMTPSA id s12-20020a05620a16ac00b006a70f581243sm30481126qkj.93.2022.07.07.11.55.26 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 07 Jul 2022 11:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657220137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EZHwydJ2m8+ohqd7YcwCClpdlE51rkDoeWPaLNmT3Kw=; b=JNHg6QY3Lo40DkfeVpdxGbxftyvoxBTatLjJSjdSG/7varXEXxFNzkAvqTwsYAnRP1fmvn TgeZ+tvjFKkWQactB5P3whMQD2ogjP1/8lf8zKDnSxb9ZNMH7cTTP9AC3RwtFWOuQXARIf nd0oSCnVcjlXaYX1vuWiAt0wtxaHKWU= X-MC-Unique: FEoKrY6mOhOY5cLBRQ0_xw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EZHwydJ2m8+ohqd7YcwCClpdlE51rkDoeWPaLNmT3Kw=; b=qNDLhwIrLu3uXO2Q0XVnbYPEcp2dBOQvRSVdakxM8gp1ypab/wIvlYi3sxck8ZWz4R YcscY3FlVJpOjki9qEnDiUst6HSGAed07rv4uC2QaBYOOGAISw7f4+q3MdB4r6iTPO49 kulgQFR498GF4411pMtjHH23kPPQqtDazxfjVU3t8+zOfvmOSC2hlFrSeWj8jUmW+uAE zdKHsYjp+oxtYZq8Zuawa3BnZba6cqKJD1tMTHnphA8UWYeY5wjaYz/Hsu2JWbuyH2pK qHkIwR3aziHGNnJLAKAduQ9kDg1sk9in7ptkn+oPT1bhPw/82kSs6nr3CrU8UkNih6TK uCtQ== X-Gm-Message-State: AJIora+OPuRsfFVneAzu6sDs3lCzfLJ7K8+cS/UxYNS5zaUKt7Veb4GD gq1Sca8dwbI7uGw1RIK4deoHWw+e5DWnH5b3vmv0Ue7mTNUixnT1msthXzdFiym+vPWG82bJyFn CL4be8uoEWGiF4P8LTKKY09eVSUdNVP2Fl6UpQbY/FRZ9X2hg+eCRo2ySJMHSHsro X-Received: by 2002:a05:622a:209:b0:31e:8253:b3c5 with SMTP id b9-20020a05622a020900b0031e8253b3c5mr14030121qtx.436.1657220127994; Thu, 07 Jul 2022 11:55:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uc6jhvZz1N3/XXnOpOMxhqEXr/sab4cf6WGtFC78wMHndfJTKL6f+jqqHZO+25p57a7idytw== X-Received: by 2002:a05:622a:209:b0:31e:8253:b3c5 with SMTP id b9-20020a05622a020900b0031e8253b3c5mr14030097qtx.436.1657220127636; Thu, 07 Jul 2022 11:55:27 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Juan Quintela , peterx@redhat.com, "Dr . David Alan Gilbert" , Leonardo Bras Soares Passos , Manish Mishra , "Daniel P . Berrange" Subject: [PATCH v9 12/14] tests: Add postcopy tls migration test Date: Thu, 7 Jul 2022 14:55:25 -0400 Message-Id: <20220707185525.27692-1-peterx@redhat.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220707185342.26794-1-peterx@redhat.com> References: <20220707185342.26794-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1657221287310100001 Content-Type: text/plain; charset="utf-8" We just added TLS tests for precopy but not postcopy. Add the corresponding test for vanilla postcopy. Rename the vanilla postcopy to "postcopy/plain" because all postcopy tests will only use unix sockets as channel. Signed-off-by: Peter Xu Reviewed-by: Dr. David Alan Gilbert --- tests/qtest/migration-test.c | 61 ++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index f15a7517b1..ee37ad6631 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -566,6 +566,9 @@ typedef struct { =20 /* Optional: set number of migration passes to wait for */ unsigned int iterations; + + /* Postcopy specific fields */ + void *postcopy_data; } MigrateCommon; =20 static int test_migrate_start(QTestState **from, QTestState **to, @@ -1054,15 +1057,19 @@ test_migrate_tls_x509_finish(QTestState *from, =20 static int migrate_postcopy_prepare(QTestState **from_ptr, QTestState **to_ptr, - MigrateStart *args) + MigrateCommon *args) { g_autofree char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, args)) { + if (test_migrate_start(&from, &to, uri, &args->start)) { return -1; } =20 + if (args->start_hook) { + args->postcopy_data =3D args->start_hook(from, to); + } + migrate_set_capability(from, "postcopy-ram", true); migrate_set_capability(to, "postcopy-ram", true); migrate_set_capability(to, "postcopy-blocktime", true); @@ -1082,7 +1089,8 @@ static int migrate_postcopy_prepare(QTestState **from= _ptr, return 0; } =20 -static void migrate_postcopy_complete(QTestState *from, QTestState *to) +static void migrate_postcopy_complete(QTestState *from, QTestState *to, + MigrateCommon *args) { wait_for_migration_complete(from); =20 @@ -1093,25 +1101,48 @@ static void migrate_postcopy_complete(QTestState *f= rom, QTestState *to) read_blocktime(to); } =20 + if (args->finish_hook) { + args->finish_hook(from, to, args->postcopy_data); + args->postcopy_data =3D NULL; + } + test_migrate_end(from, to, true); } =20 -static void test_postcopy(void) +static void test_postcopy_common(MigrateCommon *args) { - MigrateStart args =3D {}; QTestState *from, *to; =20 - if (migrate_postcopy_prepare(&from, &to, &args)) { + if (migrate_postcopy_prepare(&from, &to, args)) { return; } migrate_postcopy_start(from, to); - migrate_postcopy_complete(from, to); + migrate_postcopy_complete(from, to, args); +} + +static void test_postcopy(void) +{ + MigrateCommon args =3D { }; + + test_postcopy_common(&args); +} + +static void test_postcopy_tls_psk(void) +{ + MigrateCommon args =3D { + .start_hook =3D test_migrate_tls_psk_start_match, + .finish_hook =3D test_migrate_tls_psk_finish, + }; + + test_postcopy_common(&args); } =20 static void test_postcopy_recovery(void) { - MigrateStart args =3D { - .hide_stderr =3D true, + MigrateCommon args =3D { + .start =3D { + .hide_stderr =3D true, + }, }; QTestState *from, *to; g_autofree char *uri =3D NULL; @@ -1167,7 +1198,7 @@ static void test_postcopy_recovery(void) /* Restore the postcopy bandwidth to unlimited */ migrate_set_parameter_int(from, "max-postcopy-bandwidth", 0); =20 - migrate_postcopy_complete(from, to); + migrate_postcopy_complete(from, to, &args); } =20 static void test_baddest(void) @@ -2122,6 +2153,16 @@ int main(int argc, char **argv) if (has_uffd) { qtest_add_func("/migration/postcopy/unix", test_postcopy); qtest_add_func("/migration/postcopy/recovery", test_postcopy_recov= ery); + qtest_add_func("/migration/postcopy/plain", test_postcopy); +#ifdef CONFIG_GNUTLS + /* + * NOTE: psk test is enough for postcopy, as other types of TLS + * channels are tested under precopy. Here what we want to test i= s the + * general postcopy path that has TLS channel enabled. + */ + qtest_add_func("/migration/postcopy/tls/psk", test_postcopy_tls_ps= k); +#endif /* CONFIG_GNUTLS */ + qtest_add_func("/migration/postcopy/recovery", test_postcopy_recov= ery); } qtest_add_func("/migration/bad_dest", test_baddest); qtest_add_func("/migration/precopy/unix/plain", test_precopy_unix_plai= n); --=20 2.32.0