From patchwork Tue Sep 24 21:00:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 174307 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp4667296ill; Tue, 24 Sep 2019 14:10:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEeJaTtZCQT8DoIjpmKKftwL1jJKPiVs8k6cPHZ4HMCw+cCqQYcZ/sZun9RYgGgPHmm67L X-Received: by 2002:ac8:74c4:: with SMTP id j4mr5203656qtr.360.1569359423232; Tue, 24 Sep 2019 14:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569359423; cv=none; d=google.com; s=arc-20160816; b=LjGwR+Bl4YY4+1+9sOCqFJepbqx9OF+Pm685IDgioebFe/dWhHO1AnnnM0/KEXloD2 LAUIRY93csZsSlh3sHMpY0deGcTCwmCI48dTru+AtsL0IikqQk/naA9va5ixKTNqW6e4 FOg1unE0Zkbqkk3oAbcHzKwNONT8Bg3zTvjmgGV6aEI0GQgmL8Mpf9wh/pLb1xumOaNq n95mGF9Ie+si6/ofIZ57M6+JtSUGTxiB5OvYBMK+HSBuC1cuoxymLpUP/6Vlnbk0fvM1 NagRST0JF8uSCf1tQBKenBuT3gd9A1j+04EQLvu+IhxHDqjk4ifMMyjbCPuYtQPVqMfS xokg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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:to:from :dkim-signature; bh=qpjzxuCVbEO2kl81iU00jC8CtR9OdcVESI3+fE5EiS0=; b=qfVUr0vvuR/CgHATgQrmIaQRcYa/c5nOLKZph7J+jHQiaRkAVLnpC6ha6nCk7Omh2u bu9O16fak36EZFxIm/JwojLkDnQLgVYlpAufG6FAdmya7xZLouaI+CY777FHy9KU02pH o19RDoKU4BKDk+lRKhULbicKCR3Mbiz77u/6S2St+qlEf+HKqSYzu9ZwYZFAwBw/kJJ/ jUOO4ONJ5l/cvMqPsGJkfBxpxcYv9TgE0DoZGTAGE7MoVwFI1fuxJEuvhkx1F7XB2SD6 2YroCYA/CX2a+Q6Vo0sBqqIVCtMw17f3MpJ4KCIneWTokJQrYSNJWK2zm1+clnrbs2K5 rXAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="pKPeRsF/"; 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=fail (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 a20si2155861qtb.403.2019.09.24.14.10.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Sep 2019 14:10:23 -0700 (PDT) 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=fail header.i=@linaro.org header.s=google header.b="pKPeRsF/"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCs4k-0002Fy-8T for patch@linaro.org; Tue, 24 Sep 2019 17:10:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55600) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCrw3-0002Zv-K1 for qemu-devel@nongnu.org; Tue, 24 Sep 2019 17:01:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCrw0-0004Ux-Nb for qemu-devel@nongnu.org; Tue, 24 Sep 2019 17:01:23 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:42829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCrvy-0004Sx-Nk for qemu-devel@nongnu.org; Tue, 24 Sep 2019 17:01:20 -0400 Received: by mail-wr1-x444.google.com with SMTP id n14so3613631wrw.9 for ; Tue, 24 Sep 2019 14:01:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qpjzxuCVbEO2kl81iU00jC8CtR9OdcVESI3+fE5EiS0=; b=pKPeRsF/oGKSNDTR34gOEPv2+ulkAyGB0bnajyyGqYscVH+DrRsMorWiOrR3ZfnQ7h LC+RCn3sXVaqzmUcImoWYFqs2UVYcusj9Sf9e60bVipgIYSWFzsTbf2sS8h2WhieTx46 K/X0N+s1kHb1X+Aq4BdpnuV3W3hrM2U+pewTuLrafZzKZTXaT/t2nFQDJ/nRW8fi7PR4 T+QJhooXdb1GzRDTF6hR7UXZf4srjw9kexP+L0KK4gatIL/6g2P/ZtLlRc2puk6/efNV VCLHm8lgtnTvFxUqrLExW3VkH6g9P4U6iOSMONiJ8A5y+po5Rde8c3JXYG6FjeK4KapS NVNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qpjzxuCVbEO2kl81iU00jC8CtR9OdcVESI3+fE5EiS0=; b=Eq5xM6FWt3PjqTKpb/l5hFwVM31XPymiNpP8QruVz956IKxTqO79TlF3+hPCRInnB4 GTVRICe49ch9rtJz3UnTaWiKLVZOScVaiZSncYgH6HhiL1Ea7m43dVfv0ahyIU/o8Yf9 nOappNwjJH8MhbdAP1tUXjhuwu/DlMTo1yxm42+3XJ8If3tpcRG0PV+f3fAniULSQ+rt MGu6W4YxYx3548jjpPqjXS4nEaLjc+N99nZZPGUUwA1bDzIxaBgmlnjMrE0M6HAJuZsx gfVPI0lWh/XtGiIxtn72RFz+TMHg6unbAYFNTSEDfTy+XgbuNqbGRZe1Rt+zjFArsGlU eGmw== X-Gm-Message-State: APjAAAUzDKY2AqDaEWQD+92wgH8halgXrDNLCh9bTE7+pFvmS5qieGXc oycY2ssEEjDg/oXk+TWQT6mnEw== X-Received: by 2002:adf:a50d:: with SMTP id i13mr4561123wrb.152.1569358874310; Tue, 24 Sep 2019 14:01:14 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l10sm4654530wrh.20.2019.09.24.14.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 14:01:10 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 892C01FF98; Tue, 24 Sep 2019 22:01:07 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 08/33] tests/migration: Fail on unexpected migration states Date: Tue, 24 Sep 2019 22:00:41 +0100 Message-Id: <20190924210106.27117-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190924210106.27117-1-alex.bennee@linaro.org> References: <20190924210106.27117-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Juan Quintela , jsnow@redhat.com, f4bug@amsat.org, "Dr. David Alan Gilbert" , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" We've got various places where we wait for a migration to enter a given state; but if we enter an unexpected state we tend to fail in odd ways; add a mechanism for explicitly testing for any state which we shouldn't be in. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Alex Bennée Message-Id: <20190923131022.15498-2-dgilbert@redhat.com> --- tests/migration-test.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.20.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/tests/migration-test.c b/tests/migration-test.c index 258aa064d48..9c62ee5331b 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -255,15 +255,19 @@ static void read_blocktime(QTestState *who) } static void wait_for_migration_status(QTestState *who, - const char *goal) + const char *goal, + const char **ungoals) { while (true) { bool completed; char *status; + const char **ungoal; status = migrate_query_status(who); completed = strcmp(status, goal) == 0; - g_assert_cmpstr(status, !=, "failed"); + for (ungoal = ungoals; *ungoal; ungoal++) { + g_assert_cmpstr(status, !=, *ungoal); + } g_free(status); if (completed) { return; @@ -274,7 +278,8 @@ static void wait_for_migration_status(QTestState *who, static void wait_for_migration_complete(QTestState *who) { - wait_for_migration_status(who, "completed"); + wait_for_migration_status(who, "completed", + (const char * []) { "failed", NULL }); } static void wait_for_migration_pass(QTestState *who) @@ -809,7 +814,9 @@ static void test_postcopy_recovery(void) * Wait until postcopy is really started; we can only run the * migrate-pause command during a postcopy */ - wait_for_migration_status(from, "postcopy-active"); + wait_for_migration_status(from, "postcopy-active", + (const char * []) { "failed", + "completed", NULL }); /* * Manually stop the postcopy migration. This emulates a network @@ -822,7 +829,9 @@ static void test_postcopy_recovery(void) * migrate-recover command can only succeed if destination machine * is in the paused state */ - wait_for_migration_status(to, "postcopy-paused"); + wait_for_migration_status(to, "postcopy-paused", + (const char * []) { "failed", "active", + "completed", NULL }); /* * Create a new socket to emulate a new channel that is different @@ -836,7 +845,9 @@ static void test_postcopy_recovery(void) * Try to rebuild the migration channel using the resume flag and * the newly created channel */ - wait_for_migration_status(from, "postcopy-paused"); + wait_for_migration_status(from, "postcopy-paused", + (const char * []) { "failed", "active", + "completed", NULL }); migrate(from, uri, "{'resume': true}"); g_free(uri);