From nobody Mon Feb 9 01:30:40 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=1657017931; cv=none; d=zohomail.com; s=zohoarc; b=IS+EN378nZyZ2U/k8CHx/orX+WTz3S3EG0PG3Y2wF+adrr3fmdw4+wn0M5XZ9OO/D5dy9BGaQ6dSFkxS2sUoTZvakHsWRrXhw6lIP/1w29KXZ7/70iz0y/lUE7z0vLVUH5AAi6l5UtpK4mX1H2EAoujeha+T1+vDKF7lD5OEPLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657017931; 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=DzXTaa+S/Tz0rpf24ziPITkSB+RlupAHfjNEw/9caaE=; b=GDE5sKHhtdIvsYWlz2k9pmpgZ0BGhGYhf8saEfjCjaqvsrD73sAkA7Ua/1YpKzegQapu5hqIUeDxT1xYVqXE5Ga7ypX9C+sgb76H8xSTnxXkDHmx0cEqlLy79mFvb45lTfJ5TAvBHMZ76VqxYGsLlDk1RERL6bu3l3FdzDOIdVo= 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 165701793193540.39824492568539; Tue, 5 Jul 2022 03:45:31 -0700 (PDT) Received: from localhost ([::1]:35842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8g3e-0003T6-S2 for importer@patchew.org; Tue, 05 Jul 2022 06:45:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8fwv-0006Kf-I4 for qemu-devel@nongnu.org; Tue, 05 Jul 2022 06:38:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23506) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8fwt-0005z3-WC for qemu-devel@nongnu.org; Tue, 05 Jul 2022 06:38:33 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-447-3afyXwI3Mr2yQCw2BYkMZg-1; Tue, 05 Jul 2022 06:38:29 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 877BB1019C8A; Tue, 5 Jul 2022 10:38:29 +0000 (UTC) Received: from thuth.com (unknown [10.39.193.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id 711F4492C3B; Tue, 5 Jul 2022 10:38:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657017511; 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=DzXTaa+S/Tz0rpf24ziPITkSB+RlupAHfjNEw/9caaE=; b=eGp80KvewZetee4ZIuEG97LqqAEthROkB3D6KrrInb7n0zKFsIAW3JAEe3cVF6RHPtRysa TYPVE9pR6UW0Yz9NPNOLfupEyPu7/9dmlgHYGFz0IeHdszOpdCuAb307eINdt0fbaASJX4 snwYPMHxZCL/E/Zk1x8n4SyBgJP5Tik= X-MC-Unique: 3afyXwI3Mr2yQCw2BYkMZg-1 From: Thomas Huth To: qemu-devel@nongnu.org, Richard Henderson Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Laurent Vivier Subject: [PULL 07/14] tests: wait max 120 seconds for migration test status changes Date: Tue, 5 Jul 2022 12:38:09 +0200 Message-Id: <20220705103816.608166-8-thuth@redhat.com> In-Reply-To: <20220705103816.608166-1-thuth@redhat.com> References: <20220705103816.608166-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 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=thuth@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: 1657017934352100001 From: Daniel P. Berrang=C3=A9 Currently the wait_for_migration_fail and wait_for_migration_complete functions will spin in an infinite loop checking query-migrate status to detect a specific change/goal. This is fine when everything goes to plan, but when the unusual happens, these will hang the test suite forever. Any normally executing migration test case normally takes < 1 second for a state change, with exception of the autoconverge test which takes about 5 seconds. Taking into account possibility of people running tests inside TCG, allowing a factor of x20 slowdown gives a reasonable worst case of 120 seconds. Anything taking longer than this is a strong sign that the test has hung, or the test should be rewritten to be faster. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth Reviewed-by: Laurent Vivier Message-Id: <20220628105434.295905-2-berrange@redhat.com> Signed-off-by: Thomas Huth --- tests/qtest/migration-helpers.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/migration-helpers.c b/tests/qtest/migration-helper= s.c index a6aa59e4e6..e81e831c85 100644 --- a/tests/qtest/migration-helpers.c +++ b/tests/qtest/migration-helpers.c @@ -15,6 +15,14 @@ =20 #include "migration-helpers.h" =20 +/* + * Number of seconds we wait when looking for migration + * status changes, to avoid test suite hanging forever + * when things go wrong. Needs to be higher enough to + * avoid false positives on loaded hosts. + */ +#define MIGRATION_STATUS_WAIT_TIMEOUT 120 + bool got_stop; =20 static void check_stop_event(QTestState *who) @@ -166,8 +174,11 @@ static bool check_migration_status(QTestState *who, co= nst char *goal, void wait_for_migration_status(QTestState *who, const char *goal, const char **ungoals) { + g_test_timer_start(); while (!check_migration_status(who, goal, ungoals)) { usleep(1000); + + g_assert(g_test_timer_elapsed() < MIGRATION_STATUS_WAIT_TIMEOUT); } } =20 @@ -178,6 +189,7 @@ void wait_for_migration_complete(QTestState *who) =20 void wait_for_migration_fail(QTestState *from, bool allow_active) { + g_test_timer_start(); QDict *rsp_return; char *status; bool failed; @@ -193,6 +205,8 @@ void wait_for_migration_fail(QTestState *from, bool all= ow_active) g_assert(result); failed =3D !strcmp(status, "failed"); g_free(status); + + g_assert(g_test_timer_elapsed() < MIGRATION_STATUS_WAIT_TIMEOUT); } while (!failed); =20 /* Is the machine currently running? */ --=20 2.31.1