From patchwork Thu Jan 26 09:24:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 647082 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp143758pvb; Thu, 26 Jan 2023 01:25:01 -0800 (PST) X-Google-Smtp-Source: AK7set/jxbxtJHvnHuFIerOuzWcIl5b8RptpcInJ9Ja0tRGsI9ecHld3ySDuWJETq9N6L7wQ9rGb X-Received: by 2002:a05:6870:5606:b0:15f:8e58:f000 with SMTP id m6-20020a056870560600b0015f8e58f000mr1009926oao.15.1674725101250; Thu, 26 Jan 2023 01:25:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674725101; cv=none; d=google.com; s=arc-20160816; b=ShNAe8+tqwDGoMURnrHaBjxwbN3t5V2OxfvLcWL0bH22VrJNTQsLiWv9qAEXTReBqS mOoX5lE99UdnPJZjMxnXvVw9T3siEMKWwglRg6j0KfOOh3adTAc9U2JCQl0BhB7o9x1r H8oqa1p+MmzyTW7pmKtpIJBYR9l9tnQ63rVe8EQNfOgYrGkJ+nZqeCpJ2FI0UzopKq7S uaogrNLRqghR+UZRMkNs3hsUz67SQVkzom7mjc6iGJwLP+XDyUMuYjUFahCVnJ8oqsh9 v23jFvVuzg6DZrdRi5mo4zmSskEbex7nfURvrIGHJ3meRhPwjnz2P6b0urGsd8T5Sy28 rqtw== 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=ZvA0pG790coGtk2tNKGToQlVaYz8Lm59UmsFAaerlto=; b=rdKhE0B0bJLzUc3GgnGw9WfmlRNe8pPJRbTcVt/DzuM5OCViF11NL6vnts4+2dP7Y/ 3UMu+Y49SvBEASWKrVVlICEgY6gAKC6fVQx0BIgmAc99gv2MEXffWIMSL7vd3klgHxBF dvaDK+ecMJlwJ4n2No03QTOtEB2X81FmPdPsmAm89IjbzbE/T1u3w7ni4RksGEV6zKku WCaZjd9b6xVUOgPKbJAlS5jISS8JrVlfBxp/K1t8hMcHR19B3HmyXffGNO7MGvz2zwsA nT7UahIkNTiMv9oEcAjelipb3ZW8MGDTdrSvZ7ynEpRoABeTF4fDjZG+r69Pag7uOEWJ SU6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kSn1B7IU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id nl26-20020a056871459a00b0015edf025626si936411oab.153.2023.01.26.01.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 01:25:01 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kSn1B7IU; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2A1AA856DD; Thu, 26 Jan 2023 10:24:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="kSn1B7IU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 32E0B84DDE; Thu, 26 Jan 2023 10:24:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFC7B854F1 for ; Thu, 26 Jan 2023 10:24:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=loic.poulain@linaro.org Received: by mail-wm1-x32a.google.com with SMTP id e19-20020a05600c439300b003db1cac0c1fso2840975wmn.5 for ; Thu, 26 Jan 2023 01:24:30 -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=ZvA0pG790coGtk2tNKGToQlVaYz8Lm59UmsFAaerlto=; b=kSn1B7IUexvMyZA8UEdmW3qL/yVZ/5DN8k/MFqH1E2qovuyOfxI+ukluP7w4M3n089 lX4UcgVYIHp60ixyjUIRpeeDfafbjSoM8uOF0q+GMAyaR0DKUOL/GNSxrtNEe8bALYrD mQUBwW5tQ/85ODol2/yZW7elbVpPgtgsjftZy+argD5TdyPUer+Ygw4r4vJXfmXgO8D4 Ry0pD8jTVjVK+u8CMAbQX1loceprggRZE2WF2K+r4RfrUUzC8Knv0LvwgU8ODImnjjix gW3vlP4QY8ssBNcgzA4edNPsKOVxwO6yi5OEcCaeGgoABtUy7vT+30ss16BMOISmaj7O MmOw== 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=ZvA0pG790coGtk2tNKGToQlVaYz8Lm59UmsFAaerlto=; b=0xx48H0+KIBsLRa7v24uQDnO+qxT0lqcD7bqFerDmG5t5pZMHEGERPxCl13lUxqEWD BVm18zjnehPtOPN4dI3FFdldsp7CfbGGew71au0XaTOYB9y4drVnxAd1EMHlQs3Gm9xs Ysld1AFx2kk0nePew/AAjtRa8LNIIgZ/dScSLdL9GnO3JAmsQFzkhnXuGv+mk4XUz4LK cl6tzg7aO0PcFPV1FDkWA9a3jRgU0XHe+iWP6Y34nimmQvvZyqzsTmtZFtZM71bedSqH FBb8D29QeNvGqrh1jZKvrsQ4XvFW0kYUTw7yiIggv1nWdr3wo01n//jKL0Hrgma3blOM L5Bg== X-Gm-Message-State: AFqh2ko15LzscJB7eEll9gVIMLAkYeQplZudkJdGIG2VNh6APGLuTKvZ 6eVwybJLhidqdOhiQZWW2kvkHsQbgd9dlBEu X-Received: by 2002:a05:600c:1d92:b0:3da:1145:2196 with SMTP id p18-20020a05600c1d9200b003da11452196mr42019110wms.39.1674725070222; Thu, 26 Jan 2023 01:24:30 -0800 (PST) Received: from loic-ThinkPad-T470p.. ([2a01:e0a:82c:5f0:352b:2cb1:8983:9f55]) by smtp.gmail.com with ESMTPSA id y34-20020a05600c342200b003dc16dee9b1sm920026wmp.15.2023.01.26.01.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 01:24:29 -0800 (PST) From: Loic Poulain To: sjg@chromium.org, peng.fan@nxp.com, jh80.chung@samsung.com Cc: u-boot@lists.denx.de, Loic Poulain Subject: [PATCH v2 3/3] test: dm: mmc: Check block erasing boundaries Date: Thu, 26 Jan 2023 10:24:19 +0100 Message-Id: <20230126092419.534514-3-loic.poulain@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230126092419.534514-1-loic.poulain@linaro.org> References: <20230126092419.534514-1-loic.poulain@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Verify that erasing blocks does not impact adjacent ones. - Write four blocks [0 1 2 3] - Erase two blocks [ 1 2 ] - Verify [0 1 2 3 ] Signed-off-by: Loic Poulain --- v2: Add this change to the series test/dm/mmc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/dm/mmc.c b/test/dm/mmc.c index f744452ff2..b1eb8bee2f 100644 --- a/test/dm/mmc.c +++ b/test/dm/mmc.c @@ -30,7 +30,7 @@ static int dm_test_mmc_blk(struct unit_test_state *uts) struct udevice *dev; struct blk_desc *dev_desc; int i; - char write[1024], read[1024]; + char write[4 * 512], read[4 * 512]; ut_assertok(uclass_get_device(UCLASS_MMC, 0, &dev)); ut_assertok(blk_get_device_by_str("mmc", "0", &dev_desc)); @@ -39,14 +39,14 @@ static int dm_test_mmc_blk(struct unit_test_state *uts) ut_asserteq(512, dev_desc->blksz); for (i = 0; i < sizeof(write); i++) write[i] = i; - ut_asserteq(2, blk_dwrite(dev_desc, 0, 2, write)); - ut_asserteq(2, blk_dread(dev_desc, 0, 2, read)); + ut_asserteq(4, blk_dwrite(dev_desc, 0, 4, write)); + ut_asserteq(4, blk_dread(dev_desc, 0, 4, read)); ut_asserteq_mem(write, read, sizeof(write)); - /* Now erase them */ - memset(write, '\0', sizeof(write)); - ut_asserteq(2, blk_derase(dev_desc, 0, 2)); - ut_asserteq(2, blk_dread(dev_desc, 0, 2, read)); + /* Now erase two of them [1 - 2] and verify all blocks */ + memset(&write[512], '\0', 2 * 512); + ut_asserteq(2, blk_derase(dev_desc, 1, 2)); + ut_asserteq(4, blk_dread(dev_desc, 0, 4, read)); ut_asserteq_mem(write, read, sizeof(write)); return 0;