From patchwork Thu Sep 15 08:57:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12977070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BF88C6FA86 for ; Thu, 15 Sep 2022 09:02:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4186C8D0002; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 38B8E6B007D; Thu, 15 Sep 2022 05:02:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D634D8D0002; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id BBA0B8D0003 for ; Thu, 15 Sep 2022 05:02:18 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8BE4C40CBE for ; Thu, 15 Sep 2022 09:02:18 +0000 (UTC) X-FDA: 79913728356.26.36D7706 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 6F67FC00C2 for ; Thu, 15 Sep 2022 09:02:17 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrgj56NbzNmG4; Thu, 15 Sep 2022 16:57:37 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.63) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 15 Sep 2022 17:01:49 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 3/5] selftests/memory-hotplug: Add checking after online or offline Date: Thu, 15 Sep 2022 16:57:55 +0800 Message-ID: <20220915085757.258608-4-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-1-zhaogongyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.63] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663232538; a=rsa-sha256; cv=none; b=FdIeozLf4AzMuenoWE2uxLyUzo1VEGtQ9R7ZeTE1YlBK0yYp7FIf/ms6XZkp1/OQFoHBcr P4KIa8Kc6hEwLU9tcVGXP5i6Q2+HLDgeiY8ndeqHm0wsLkKisd8vrzGFi2KxXfsYJjsyq9 fuZ3MdPJvJzXocD1gbC52BgPZ1zsZCU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663232538; h=from:from:sender: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: in-reply-to:in-reply-to:references:references; bh=t+aBi1A5LSDvxYRGukK2kg48jOMsk6Nfsc768Mj5Aio=; b=ZecRRB0pWUX0kA9jOILHiJs0lLuOWrk5lFF/8tauzDwTD1I0lO1Bmr3JXrHmRgt9UeALUW cYTXvuGQUuFiEgt5M3ocK48Ys2MoCmCVBcco/TS9/Ta05V+0ie8NifeEl9csiYMftC12BI 5+pr4iAlZd8VjgcqvPewJD/02aoqEmE= Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com X-Rspam-User: X-Rspamd-Queue-Id: 6F67FC00C2 X-Rspamd-Server: rspam01 X-Stat-Signature: wqhns15oi6qgjcpyg6xgiqa7y1k6wgix X-HE-Tag: 1663232537-795136 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add checking for online_memory_expect_success()/ offline_memory_expect_success()/offline_memory_expect_fail(), or the test would exit 0 although the functions return 1. Signed-off-by: Zhao Gongyi --- .../memory-hotplug/mem-on-off-test.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh index f1a9d81b934c..3bdf3c4d6d06 100755 --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh @@ -267,7 +267,11 @@ done printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/erro for memory in `hotpluggable_offline_memory`; do - online_memory_expect_fail $memory + online_memory_expect_fail $memory || { + echo "online memory $memory: unexpected success" + retval=1 + } + done # @@ -275,7 +279,11 @@ done # echo 0 > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error for memory in `hotpluggable_offline_memory`; do - online_memory_expect_success $memory + online_memory_expect_success $memory || { + echo "online memory $memory: unexpected fail" + retval=1 + } + done # @@ -284,7 +292,11 @@ done printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error for memory in `hotpluggable_online_memory`; do if [ $((RANDOM % 100)) -lt $ratio ]; then - offline_memory_expect_fail $memory + offline_memory_expect_fail $memory || { + echo "offline memory $memory: unexpected success" + retval=1 + } + fi done