From 4813d2e7361468f06b400dea6706786d8e55dba6 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Wed, 25 Jun 2014 15:31:37 -0600 Subject: tools: memory-hotplug fix unexpected operator error on-off-test is a bash script and invoked from /bin/sh This results in the following error: ./on-off-test.sh: 9: [: !=: unexpected operator Changed Makefile to use bash instead. Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/memory-hotplug/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 350bfeda3aa8..058c76f5d102 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile @@ -1,6 +1,6 @@ all: run_tests: - @/bin/sh ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" + @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" clean: -- cgit v1.2.3-59-g8ed1b From 5e4ff6950352ab2f4b6f18c66c235bfa95c39a2a Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Wed, 25 Jun 2014 11:43:44 -0600 Subject: tools: cpu-hotplug fix unexpected operator error on-off-test is a bash script and invoked from /bin/sh This results in the following error: ./on-off-test.sh: 9: [: !=: unexpected operator Changed Makefile to use bash instead. Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/cpu-hotplug/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index ae5faf9aade2..790c23a9db44 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile @@ -1,6 +1,6 @@ all: run_tests: - @/bin/sh ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" + @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" clean: -- cgit v1.2.3-59-g8ed1b From f15fed3da83212da8fa939ec70e38033ea35f8aa Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Wed, 25 Jun 2014 10:05:17 -0600 Subject: tools: fix mq_perf_tests compile warnings Fix numerous compile warnings in mq_perf_tests.c. All of these are wrong format in printfs when printing nvsec. Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/mqueue/mq_perf_tests.c | 40 ++++++++++++++------------ 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/mqueue/mq_perf_tests.c b/tools/testing/selftests/mqueue/mq_perf_tests.c index 2fadd4b97045..94dae65eea41 100644 --- a/tools/testing/selftests/mqueue/mq_perf_tests.c +++ b/tools/testing/selftests/mqueue/mq_perf_tests.c @@ -296,9 +296,9 @@ static inline void open_queue(struct mq_attr *attr) printf("\n\tQueue %s created:\n", queue_path); printf("\t\tmq_flags:\t\t\t%s\n", result.mq_flags & O_NONBLOCK ? "O_NONBLOCK" : "(null)"); - printf("\t\tmq_maxmsg:\t\t\t%d\n", result.mq_maxmsg); - printf("\t\tmq_msgsize:\t\t\t%d\n", result.mq_msgsize); - printf("\t\tmq_curmsgs:\t\t\t%d\n", result.mq_curmsgs); + printf("\t\tmq_maxmsg:\t\t\t%lu\n", result.mq_maxmsg); + printf("\t\tmq_msgsize:\t\t\t%lu\n", result.mq_msgsize); + printf("\t\tmq_curmsgs:\t\t\t%lu\n", result.mq_curmsgs); } void *fake_cont_thread(void *arg) @@ -440,7 +440,7 @@ void *perf_test_thread(void *arg) shutdown(2, "clock_getres()", __LINE__); printf("\t\tMax priorities:\t\t\t%d\n", mq_prio_max); - printf("\t\tClock resolution:\t\t%d nsec%s\n", res.tv_nsec, + printf("\t\tClock resolution:\t\t%lu nsec%s\n", res.tv_nsec, res.tv_nsec > 1 ? "s" : ""); @@ -454,20 +454,20 @@ void *perf_test_thread(void *arg) recv_total.tv_nsec = 0; for (i = 0; i < TEST1_LOOPS; i++) do_send_recv(); - printf("\t\tSend msg:\t\t\t%d.%ds total time\n", + printf("\t\tSend msg:\t\t\t%ld.%lus total time\n", send_total.tv_sec, send_total.tv_nsec); nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + send_total.tv_nsec) / TEST1_LOOPS; - printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); - printf("\t\tRecv msg:\t\t\t%d.%ds total time\n", + printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); + printf("\t\tRecv msg:\t\t\t%ld.%lus total time\n", recv_total.tv_sec, recv_total.tv_nsec); nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + recv_total.tv_nsec) / TEST1_LOOPS; - printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); + printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); for (cur_test = test2; cur_test->desc != NULL; cur_test++) { - printf(cur_test->desc); + printf("%s:\n", cur_test->desc); printf("\t\t(%d iterations)\n", TEST2_LOOPS); prio_out = 0; send_total.tv_sec = 0; @@ -493,16 +493,16 @@ void *perf_test_thread(void *arg) cur_test->func(&prio_out); } printf("done.\n"); - printf("\t\tSend msg:\t\t\t%d.%ds total time\n", + printf("\t\tSend msg:\t\t\t%ld.%lus total time\n", send_total.tv_sec, send_total.tv_nsec); nsec = ((unsigned long long)send_total.tv_sec * 1000000000 + send_total.tv_nsec) / TEST2_LOOPS; - printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); - printf("\t\tRecv msg:\t\t\t%d.%ds total time\n", + printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); + printf("\t\tRecv msg:\t\t\t%ld.%lus total time\n", recv_total.tv_sec, recv_total.tv_nsec); nsec = ((unsigned long long)recv_total.tv_sec * 1000000000 + recv_total.tv_nsec) / TEST2_LOOPS; - printf("\t\t\t\t\t\t%d nsec/msg\n", nsec); + printf("\t\t\t\t\t\t%lld nsec/msg\n", nsec); printf("\t\tDraining queue..."); fflush(stdout); clock_gettime(clock, &start); @@ -653,8 +653,10 @@ int main(int argc, char *argv[]) /* Tell the user our initial state */ printf("\nInitial system state:\n"); printf("\tUsing queue path:\t\t\t%s\n", queue_path); - printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%d\n", saved_limits.rlim_cur); - printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%d\n", saved_limits.rlim_max); + printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%ld\n", + (long) saved_limits.rlim_cur); + printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%ld\n", + (long) saved_limits.rlim_max); printf("\tMaximum Message Size:\t\t\t%d\n", saved_max_msgsize); printf("\tMaximum Queue Size:\t\t\t%d\n", saved_max_msgs); printf("\tNice value:\t\t\t\t%d\n", cur_nice); @@ -667,10 +669,10 @@ int main(int argc, char *argv[]) printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t(unlimited)\n"); printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t(unlimited)\n"); } else { - printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%d\n", - cur_limits.rlim_cur); - printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%d\n", - cur_limits.rlim_max); + printf("\tRLIMIT_MSGQUEUE(soft):\t\t\t%ld\n", + (long) cur_limits.rlim_cur); + printf("\tRLIMIT_MSGQUEUE(hard):\t\t\t%ld\n", + (long) cur_limits.rlim_max); } printf("\tMaximum Message Size:\t\t\t%d\n", cur_max_msgsize); printf("\tMaximum Queue Size:\t\t\t%d\n", cur_max_msgs); -- cgit v1.2.3-59-g8ed1b From ef9feb682dea988f731a2e5a2e8e498aba6a9da7 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Wed, 25 Jun 2014 10:03:33 -0600 Subject: tools: fix mq_open_tests compile warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix several compile warnings - these are repeats like the ones below: gcc -O2 -lrt mq_open_tests.c -o mq_open_tests mq_open_tests.c: In function ‘main’: mq_open_tests.c:295:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘rlim_t’ [-Wformat=] printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur); ^ mq_open_tests.c: In function ‘shutdown’: mq_open_tests.c:83:9: warning: ignoring return value of ‘seteuid’, declared with attribute warn_unused_result [-Wunused-result] seteuid(0); Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/mqueue/mq_open_tests.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/mqueue/mq_open_tests.c b/tools/testing/selftests/mqueue/mq_open_tests.c index 711cc2923047..9c1a5d359055 100644 --- a/tools/testing/selftests/mqueue/mq_open_tests.c +++ b/tools/testing/selftests/mqueue/mq_open_tests.c @@ -80,7 +80,8 @@ void shutdown(int exit_val, char *err_cause, int line_no) if (in_shutdown++) return; - seteuid(0); + if (seteuid(0) == -1) + perror("seteuid() failed"); if (queue != -1) if (mq_close(queue)) @@ -292,8 +293,10 @@ int main(int argc, char *argv[]) /* Tell the user our initial state */ printf("\nInitial system state:\n"); printf("\tUsing queue path:\t\t%s\n", queue_path); - printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", saved_limits.rlim_cur); - printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", saved_limits.rlim_max); + printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", + (long) saved_limits.rlim_cur); + printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", + (long) saved_limits.rlim_max); printf("\tMaximum Message Size:\t\t%d\n", saved_max_msgsize); printf("\tMaximum Queue Size:\t\t%d\n", saved_max_msgs); if (default_settings) { @@ -308,8 +311,8 @@ int main(int argc, char *argv[]) validate_current_settings(); printf("Adjusted system state for testing:\n"); - printf("\tRLIMIT_MSGQUEUE(soft):\t\t%d\n", cur_limits.rlim_cur); - printf("\tRLIMIT_MSGQUEUE(hard):\t\t%d\n", cur_limits.rlim_max); + printf("\tRLIMIT_MSGQUEUE(soft):\t\t%ld\n", (long) cur_limits.rlim_cur); + printf("\tRLIMIT_MSGQUEUE(hard):\t\t%ld\n", (long) cur_limits.rlim_max); printf("\tMaximum Message Size:\t\t%d\n", cur_max_msgsize); printf("\tMaximum Queue Size:\t\t%d\n", cur_max_msgs); if (default_settings) { @@ -454,7 +457,12 @@ int main(int argc, char *argv[]) else printf("Queue open with total size > 2GB when euid = 0 " "failed:\t\t\tPASS\n"); - seteuid(99); + + if (seteuid(99) == -1) { + perror("seteuid() failed"); + exit(1); + } + attr.mq_maxmsg = cur_max_msgs; attr.mq_msgsize = cur_max_msgsize; if (test_queue_fail(&attr, &result)) -- cgit v1.2.3-59-g8ed1b From b80f557042d4742b8c0ed69467d6b87a83186c8d Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Tue, 24 Jun 2014 19:53:36 -0600 Subject: tools: Fix mqueue Makefile compile linking order Makefile compile linking order is incorrect causing the compile to fail not finding librt symbols. /tmp/cceTqwFh.o: In function `test_queue_fail': mq_open_tests.c:(.text+0x6b): undefined reference to `mq_open' mq_open_tests.c:(.text+0x80): undefined reference to `mq_getattr' mq_open_tests.c:(.text+0xa2): undefined reference to `mq_close' mq_open_tests.c:(.text+0xcf): undefined reference to `mq_unlink' /tmp/cceTqwFh.o: In function `test_queue.constprop.6': mq_open_tests.c:(.text+0x15a): undefined reference to `mq_open' mq_open_tests.c:(.text+0x16f): undefined reference to `mq_getattr' mq_open_tests.c:(.text+0x195): undefined reference to `mq_close' mq_open_tests.c:(.text+0x1c2): undefined reference to `mq_unlink' /tmp/cceTqwFh.o: In function `shutdown.part.0': mq_open_tests.c:(.text.unlikely+0x5b): undefined reference to `mq_close' mq_open_tests.c:(.text.unlikely+0x7a): undefined reference to `mq_unlink' collect2: error: ld returned 1 exit status make: *** [all] Error 1 Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/mqueue/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/mqueue/Makefile b/tools/testing/selftests/mqueue/Makefile index 218a122c7951..8056e2e68fa4 100644 --- a/tools/testing/selftests/mqueue/Makefile +++ b/tools/testing/selftests/mqueue/Makefile @@ -1,6 +1,6 @@ all: - gcc -O2 -lrt mq_open_tests.c -o mq_open_tests - gcc -O2 -lrt -lpthread -lpopt -o mq_perf_tests mq_perf_tests.c + gcc -O2 mq_open_tests.c -o mq_open_tests -lrt + gcc -O2 -o mq_perf_tests mq_perf_tests.c -lrt -lpthread -lpopt run_tests: @./mq_open_tests /test1 || echo "mq_open_tests: [FAIL]" -- cgit v1.2.3-59-g8ed1b From 6e7e6c348492cb7e0a8a36a9d74d098de6f93208 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Tue, 24 Jun 2014 18:11:26 -0600 Subject: tools: fix kcmp_test compile warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit kcmp_test.c: In function ‘main’: kcmp_test.c:85:5: warning: format ‘%li’ expects argument of type ‘long int’, but argument 2 has type ‘int’ [-Wformat=] ret, strerror(errno)); ^ Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/kcmp/kcmp_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c index fa4f1b37e045..dbba4084869c 100644 --- a/tools/testing/selftests/kcmp/kcmp_test.c +++ b/tools/testing/selftests/kcmp/kcmp_test.c @@ -81,7 +81,7 @@ int main(int argc, char **argv) /* Compare with self */ ret = sys_kcmp(pid1, pid1, KCMP_VM, 0, 0); if (ret) { - printf("FAIL: 0 expected but %li returned (%s)\n", + printf("FAIL: 0 expected but %d returned (%s)\n", ret, strerror(errno)); ret = -1; } else -- cgit v1.2.3-59-g8ed1b From ddddda9bc41c9214731def8665ad92414356d685 Mon Sep 17 00:00:00 2001 From: Shuah Khan Date: Wed, 2 Jul 2014 09:51:38 -0600 Subject: tools: selftests - create a separate hotplug target for full range test On some systems, hot-plug tests could hang forever waiting for cpu and memory to be ready to be offlined. A special hot-plug target is created to run full range of hot-plug tests. In default mode, hot-plug tests run in safe mode with a limited scope. In limited mode, cpu-hotplug test is run on a single cpu as opposed to all hotplug capable cpus, and memory hotplug test is run on 2% of hotplug capable memory instead of 10%. In addition to the above change, cpu-hotplug is chnged to change processor affinity to cpu 0 so it doesn't impact itself while the test runs. Signed-off-by: Shuah Khan Cc: Kees Cook Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Frederic Weisbecker Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/Makefile | 18 ++++++++ tools/testing/selftests/README.txt | 27 +++++++++-- tools/testing/selftests/cpu-hotplug/Makefile | 3 ++ tools/testing/selftests/cpu-hotplug/on-off-test.sh | 52 +++++++++++++++++++++- tools/testing/selftests/memory-hotplug/Makefile | 3 ++ .../selftests/memory-hotplug/on-off-test.sh | 8 ++++ 6 files changed, 105 insertions(+), 6 deletions(-) (limited to 'tools/testing/selftests') diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index e66e710cc595..4c2aa357e12f 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -12,6 +12,9 @@ TARGETS += powerpc TARGETS += user TARGETS += sysctl +TARGETS_HOTPLUG = cpu-hotplug +TARGETS_HOTPLUG += memory-hotplug + all: for TARGET in $(TARGETS); do \ make -C $$TARGET; \ @@ -22,6 +25,21 @@ run_tests: all make -C $$TARGET run_tests; \ done; +hotplug: + for TARGET in $(TARGETS_HOTPLUG); do \ + make -C $$TARGET; \ + done; + +run_hotplug: hotplug + for TARGET in $(TARGETS_HOTPLUG); do \ + make -C $$TARGET run_full_test; \ + done; + +clean_hotplug: + for TARGET in $(TARGETS_HOTPLUG); do \ + make -C $$TARGET clean; \ + done; + clean: for TARGET in $(TARGETS); do \ make -C $$TARGET clean; \ diff --git a/tools/testing/selftests/README.txt b/tools/testing/selftests/README.txt index 5e2faf9c55d3..2660d5ff9179 100644 --- a/tools/testing/selftests/README.txt +++ b/tools/testing/selftests/README.txt @@ -4,8 +4,15 @@ The kernel contains a set of "self tests" under the tools/testing/selftests/ directory. These are intended to be small unit tests to exercise individual code paths in the kernel. -Running the selftests -===================== +On some systems, hot-plug tests could hang forever waiting for cpu and +memory to be ready to be offlined. A special hot-plug target is created +to run full range of hot-plug tests. In default mode, hot-plug tests run +in safe mode with a limited scope. In limited mode, cpu-hotplug test is +run on a single cpu as opposed to all hotplug capable cpus, and memory +hotplug test is run on 2% of hotplug capable memory instead of 10%. + +Running the selftests (hotplug tests are run in limited mode) +============================================================= To build the tests: @@ -18,14 +25,26 @@ To run the tests: - note that some tests will require root privileges. - -To run only tests targetted for a single subsystem: +To run only tests targeted for a single subsystem: (including +hotplug targets in limited mode) $ make -C tools/testing/selftests TARGETS=cpu-hotplug run_tests See the top-level tools/testing/selftests/Makefile for the list of all possible targets. +Running the full range hotplug selftests +======================================== + +To build the tests: + + $ make -C tools/testing/selftests hotplug + +To run the tests: + + $ make -C tools/testing/selftests run_hotplug + +- note that some tests will require root privileges. Contributing new tests ====================== diff --git a/tools/testing/selftests/cpu-hotplug/Makefile b/tools/testing/selftests/cpu-hotplug/Makefile index 790c23a9db44..e9c28d8dc84b 100644 --- a/tools/testing/selftests/cpu-hotplug/Makefile +++ b/tools/testing/selftests/cpu-hotplug/Makefile @@ -3,4 +3,7 @@ all: run_tests: @/bin/bash ./on-off-test.sh || echo "cpu-hotplug selftests: [FAIL]" +run_full_test: + @/bin/bash ./on-off-test.sh -a || echo "cpu-hotplug selftests: [FAIL]" + clean: diff --git a/tools/testing/selftests/cpu-hotplug/on-off-test.sh b/tools/testing/selftests/cpu-hotplug/on-off-test.sh index bdde7cf428bb..98b1d6565f2c 100644 --- a/tools/testing/selftests/cpu-hotplug/on-off-test.sh +++ b/tools/testing/selftests/cpu-hotplug/on-off-test.sh @@ -11,6 +11,8 @@ prerequisite() exit 0 fi + taskset -p 01 $$ + SYSFS=`mount -t sysfs | head -1 | awk '{ print $3 }'` if [ ! -d "$SYSFS" ]; then @@ -22,6 +24,19 @@ prerequisite() echo $msg cpu hotplug is not supported >&2 exit 0 fi + + echo "CPU online/offline summary:" + online_cpus=`cat $SYSFS/devices/system/cpu/online` + online_max=${online_cpus##*-} + echo -e "\t Cpus in online state: $online_cpus" + + offline_cpus=`cat $SYSFS/devices/system/cpu/offline` + if [[ "a$offline_cpus" = "a" ]]; then + offline_cpus=0 + else + offline_max=${offline_cpus##*-} + fi + echo -e "\t Cpus in offline state: $offline_cpus" } # @@ -113,15 +128,25 @@ offline_cpu_expect_fail() } error=-12 +allcpus=0 priority=0 +online_cpus=0 +online_max=0 +offline_cpus=0 +offline_max=0 -while getopts e:hp: opt; do +while getopts e:ahp: opt; do case $opt in e) error=$OPTARG ;; + a) + allcpus=1 + ;; h) - echo "Usage $0 [ -e errno ] [ -p notifier-priority ]" + echo "Usage $0 [ -a ] [ -e errno ] [ -p notifier-priority ]" + echo -e "\t default offline one cpu" + echo -e "\t run with -a option to offline all cpus" exit ;; p) @@ -137,6 +162,29 @@ fi prerequisite +# +# Safe test (default) - offline and online one cpu +# +if [ $allcpus -eq 0 ]; then + echo "Limited scope test: one hotplug cpu" + echo -e "\t (leaves cpu in the original state):" + echo -e "\t online to offline to online: cpu $online_max" + offline_cpu_expect_success $online_max + online_cpu_expect_success $online_max + + if [[ $offline_cpus -gt 0 ]]; then + echo -e "\t offline to online to offline: cpu $offline_max" + online_cpu_expect_success $offline_max + offline_cpu_expect_success $offline_max + fi + exit 0 +else + echo "Full scope test: all hotplug cpus" + echo -e "\t online all offline cpus" + echo -e "\t offline all online cpus" + echo -e "\t online all offline cpus" +fi + # # Online all hot-pluggable CPUs # diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/testing/selftests/memory-hotplug/Makefile index 058c76f5d102..d46b8d489cd2 100644 --- a/tools/testing/selftests/memory-hotplug/Makefile +++ b/tools/testing/selftests/memory-hotplug/Makefile @@ -1,6 +1,9 @@ all: run_tests: + @/bin/bash ./on-off-test.sh -r 2 || echo "memory-hotplug selftests: [FAIL]" + +run_full_test: @/bin/bash ./on-off-test.sh || echo "memory-hotplug selftests: [FAIL]" clean: diff --git a/tools/testing/selftests/memory-hotplug/on-off-test.sh b/tools/testing/selftests/memory-hotplug/on-off-test.sh index a2816f631542..6cddde0b96f8 100644 --- a/tools/testing/selftests/memory-hotplug/on-off-test.sh +++ b/tools/testing/selftests/memory-hotplug/on-off-test.sh @@ -142,10 +142,16 @@ fi prerequisite +echo "Test scope: $ratio% hotplug memory" +echo -e "\t online all hotplug memory in offline state" +echo -e "\t offline $ratio% hotplug memory in online state" +echo -e "\t online all hotplug memory in offline state" + # # Online all hot-pluggable memory # for memory in `hotplaggable_offline_memory`; do + echo offline-online $memory online_memory_expect_success $memory done @@ -154,6 +160,7 @@ done # for memory in `hotpluggable_online_memory`; do if [ $((RANDOM % 100)) -lt $ratio ]; then + echo online-offline $memory offline_memory_expect_success $memory fi done @@ -162,6 +169,7 @@ done # Online all hot-pluggable memory again # for memory in `hotplaggable_offline_memory`; do + echo offline-online $memory online_memory_expect_success $memory done -- cgit v1.2.3-59-g8ed1b