From patchwork Fri Feb 15 06:57:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 1042658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4414DR6Xncz9s4Z for ; Fri, 15 Feb 2019 18:11:03 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="nSskuLEJ"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="MBbrICky"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4414DR5JC5zDr0p for ; Fri, 15 Feb 2019 18:11:03 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=aj.id.au (client-ip=66.111.4.26; helo=out2-smtp.messagingengine.com; envelope-from=andrew@aj.id.au; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="nSskuLEJ"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="MBbrICky"; dkim-atps=neutral Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4413zF6HcJzDqW3 for ; Fri, 15 Feb 2019 17:59:37 +1100 (AEDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 7F9F42225D; Fri, 15 Feb 2019 01:59:34 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 15 Feb 2019 01:59:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=Oqt1GUycHMVsN K3rCE0rUdhaKGI1KlABFBPTX2EsAIw=; b=nSskuLEJr5cphJvDtLB/o82jqWVIm wsEvIgoqoMyv10OoELQ2QALJBIl0sKC+BUGvn4S/zvAZrS/P+9k1jvlezWp04UaE l/YJl2BG+9fh/Nry4XusTWT9H1e92A4EEzF4zyzvJFHgqF0wEAyYuM9jOzbY9hCk ycx3wKy+uPJUbhq+wDlvNwkuR15f5JZ6PMgPvj1yJmZU+UABNFPaJIsoVE3YA5V7 UyHPezR6Ls3FGB4tKogR81vE6PLwuJuzhXMfZNaOxaogHz24o8FgmKwVkioUBQP9 zIV8Sr0imUz7FNgZgWWonqz5RDOUcBp6tJHkfW5grNWvP52v51iwh37tA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=Oqt1GUycHMVsNK3rCE0rUdhaKGI1KlABFBPTX2EsAIw=; b=MBbrICky /pWNo+XPNs3QcJhPywHdRJ4Ys8Yu44dlv+EpCi74m256KUkNNVUJjWPxHd5qMbu1 27VqgEt9fk6Xj6lQBZ8S0f+89rG3JCmEHI/fKLyToLkdMM4oJzxfhXIJEsPvzE6j Cn5oR43d0mH5CgU72WgORJQCw+q1HwBeF8kPsPnGwwACBOEyZYtZ3F0Bt4kGy4Qn beCbfk7BKS8yOk6xiaZNccDFW4BmeVFj/m85Eu37wZiCmxwfQk1fnExd6ZdHlUB9 TbdzGxiu6SjANsBzlCJyoHka63JslTthUz2xugfxALGfno+M5J17P3wuntjhUoIb WuTm7O2EtoJY1g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddtiedgleelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecunecujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpe etnhgurhgvficulfgvfhhfvghrhicuoegrnhgurhgvfiesrghjrdhiugdrrghuqeenucfk phepudegrddvrdekledrjeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvfi esrghjrdhiugdrrghunecuvehluhhsthgvrhfuihiivgepje X-ME-Proxy: Received: from localhost.localdomain (unknown [14.2.89.75]) by mail.messagingengine.com (Postfix) with ESMTPA id 3F511E409D; Fri, 15 Feb 2019 01:59:31 -0500 (EST) From: Andrew Jeffery To: skiboot@lists.ozlabs.org Date: Fri, 15 Feb 2019 17:27:07 +1030 Message-Id: <20190215065708.6086-51-andrew@aj.id.au> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215065708.6086-1-andrew@aj.id.au> References: <20190215065708.6086-1-andrew@aj.id.au> MIME-Version: 1.0 Subject: [Skiboot] [PATCH 50/51] test-ipmi-hiomap: Add window-recovery-failure-restore-read test X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Andrew Jeffery --- libflash/test/test-ipmi-hiomap.c | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c index 394355092613..234c30bd76b5 100644 --- a/libflash/test/test-ipmi-hiomap.c +++ b/libflash/test/test-ipmi-hiomap.c @@ -3299,6 +3299,124 @@ static void test_hiomap_protocol_recovery_failure_restore_read(void) scenario_exit(); } +static const struct scenario_event +scenario_hiomap_window_recovery_failure_restore_read[] = { + { .type = scenario_event_p, .p = &hiomap_ack_call, }, + { .type = scenario_event_p, .p = &hiomap_get_info_call, }, + { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, }, + { + .type = scenario_event_p, + .p = &hiomap_create_read_window_qs0l1_rs0l1_call, + }, + { .type = scenario_delay }, + { + .type = scenario_sel, + .s = { + .bmc_state = HIOMAP_E_DAEMON_READY | + HIOMAP_E_WINDOW_RESET + } + }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_ACK, + .seq = 5, + .args = { + [0] = HIOMAP_E_WINDOW_RESET, + }, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_ACK, + .seq = 5, + }, + }, + }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_CREATE_READ_WINDOW, + .seq = 6, + .args = { + [0] = 0x00, [1] = 0x00, + [2] = 0x01, [3] = 0x00, + }, + }, + .cc = IPMI_ERR_UNSPECIFIED, + }, + }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_ACK, + .seq = 7, + .args = { + [0] = HIOMAP_E_WINDOW_RESET, + }, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_ACK, + .seq = 7, + }, + }, + }, + { + .type = scenario_cmd, + .c = { + .req = { + .cmd = HIOMAP_C_CREATE_READ_WINDOW, + .seq = 8, + .args = { + [0] = 0x00, [1] = 0x00, + [2] = 0x01, [3] = 0x00, + }, + }, + .cc = IPMI_CC_NO_ERROR, + .resp = { + .cmd = HIOMAP_C_CREATE_READ_WINDOW, + .seq = 8, + .args = { + [0] = 0xff, [1] = 0x0f, + [2] = 0x01, [3] = 0x00, + [4] = 0x00, [5] = 0x00, + }, + }, + }, + }, + SCENARIO_SENTINEL, + +}; + +static void test_hiomap_window_recovery_restore_read(void) +{ + struct blocklevel_device *bl; + struct ipmi_hiomap *ctx; + size_t len; + void *buf; + + scenario_enter(scenario_hiomap_window_recovery_failure_restore_read); + assert(!ipmi_hiomap_init(&bl)); + ctx = container_of(bl, struct ipmi_hiomap, bl); + len = 1 << ctx->block_size_shift; + /* + * We're reading the same block 3 times - it's irrelevant, we're just + * trying to manipulate window state + */ + buf = calloc(1, len); + assert(buf); + assert(!bl->read(bl, 0, buf, len)); + scenario_advance(); + assert(bl->read(bl, 0, buf, len) > 0); + assert(!bl->read(bl, 0, buf, len)); + free(buf); + ipmi_hiomap_exit(bl); + scenario_exit(); +} + struct test_case { const char *name; void (*fn)(void); @@ -3359,6 +3477,7 @@ struct test_case test_cases[] = { TEST_CASE(test_hiomap_protocol_recovery_failure_get_flash_info), TEST_CASE(test_hiomap_protocol_recovery_failure_restore_write), TEST_CASE(test_hiomap_protocol_recovery_failure_restore_read), + TEST_CASE(test_hiomap_window_recovery_restore_read), { NULL, NULL }, };