[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220915085757.258608-3-zhaogongyi@huawei.com>
Date: Thu, 15 Sep 2022 16:57:54 +0800
From: Zhao Gongyi <zhaogongyi@...wei.com>
To: <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <linux-kselftest@...r.kernel.org>
CC: <akinobu.mita@...il.com>, <corbet@....net>, <david@...hat.com>,
<osalvador@...e.de>, <shuah@...nel.org>,
Zhao Gongyi <zhaogongyi@...wei.com>
Subject: [PATCH -next v2 2/5] selftests/memory-hotplug: Use 'printf' instead of 'echo'
Fault injection uses debugfs in a way that the provided values via
sysfs are interpreted as u64. Providing negative numbers results
in errors:
# sh mem-on-off-test.sh
...
mem-on-off-test.sh: line 267: echo: write error: Invalid argument
...
mem-on-off-test.sh: line 283: echo: write error: Invalid argument
...
#
Signed-off-by: Zhao Gongyi <zhaogongyi@...wei.com>
---
tools/testing/selftests/memory-hotplug/mem-on-off-test.sh | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 46a97f318f58..f1a9d81b934c 100755
--- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
+++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh
@@ -264,7 +264,8 @@ done
#
# Test memory hot-add error handling (offline => online)
#
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/error
+printf %#x $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_ONLINE/erro
+
for memory in `hotpluggable_offline_memory`; do
online_memory_expect_fail $memory
done
@@ -280,7 +281,7 @@ done
#
# Test memory hot-remove error handling (online => offline)
#
-echo $error > $NOTIFIER_ERR_INJECT_DIR/actions/MEM_GOING_OFFLINE/error
+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
--
2.17.1
Powered by blists - more mailing lists