aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jordan <daniel.m.jordan@oracle.com>2018-10-09 09:42:36 +0800
committerFengguang Wu <fengguang.wu@intel.com>2018-10-09 09:42:48 +0800
commit203658fb11d324e83c93550970fc6365a2ccc9d6 (patch)
treef5b344c56b00efaf1c79fae1f4c5670bcad1edba
parent40e59e99ebe2d169de27bd8e45363c39b0c8752c (diff)
downloadvm-scalability-203658fb11d324e83c93550970fc6365a2ccc9d6.tar.gz
case-swap-w-seq: fix ignored --random in case-swap-w-rand-mt
case-swap-w-seq tests for the string -rand in the testcase name to enable usemem's --random option, but the test breaks when -rand doesn't appear last, so case-swap-w-rand-mt isn't actually random. We could search for -rand inside the string, but let's just duplicate testcase code to avoid similar breakage in the future as more test cases are added. Fixes: f35dd1388bfb ("case-swap: add multithreaded test case for case-swap-w-seq/rand") Acked-by: Aaron Lu <aaron.lu@intel.com> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
-rwxr-xr-x[l---------]case-swap-w-rand13
-rwxr-xr-x[l---------]case-swap-w-rand-mt13
-rwxr-xr-xcase-swap-w-seq15
-rwxr-xr-x[l---------]case-swap-w-seq-mt13
4 files changed, 37 insertions, 17 deletions
diff --git a/case-swap-w-rand b/case-swap-w-rand
index 4fbca07..c32687f 120000..100755
--- a/case-swap-w-rand
+++ b/case-swap-w-rand
@@ -1 +1,12 @@
-case-swap-w-seq \ No newline at end of file
+#!/bin/sh
+
+. ./hw_vars
+
+if [ "$SwapTotal" -eq 0 ]; then
+ echo "No swap space. Please setup swap before running $0" >&2
+ exit 1
+fi
+
+[ -n "$unit_size" ] || unit_size=$(( ((MemAvailable + SwapTotal) << 10) * 3 / 4))
+
+$USEMEM -n $nr_task --random $((unit_size / nr_task))
diff --git a/case-swap-w-rand-mt b/case-swap-w-rand-mt
index 4fbca07..f38b559 120000..100755
--- a/case-swap-w-rand-mt
+++ b/case-swap-w-rand-mt
@@ -1 +1,12 @@
-case-swap-w-seq \ No newline at end of file
+#!/bin/sh
+
+. ./hw_vars
+
+if [ "$SwapTotal" -eq 0 ]; then
+ echo "No swap space. Please setup swap before running $0" >&2
+ exit 1
+fi
+
+[ -n "$unit_size" ] || unit_size=$(( ((MemAvailable + SwapTotal) << 10) * 3 / 4))
+
+$USEMEM -t $nr_task --random $((unit_size / nr_task))
diff --git a/case-swap-w-seq b/case-swap-w-seq
index 6e9f206..9f5760d 100755
--- a/case-swap-w-seq
+++ b/case-swap-w-seq
@@ -9,17 +9,4 @@ fi
[ -n "$unit_size" ] || unit_size=$(( ((MemAvailable + SwapTotal) << 10) * 3 / 4))
-testcase=$(basename $0)
-if [ "${testcase%-mt}" != "$testcase" ]; then
- multi_task_option="-t"
-else
- multi_task_option="-n"
-fi
-
-if [ "${testcase%-rand}" != "$testcase" ]; then
- rand_seq_option="--random"
-else
- rand_seq_option=""
-fi
-
-$USEMEM $multi_task_option $nr_task $rand_seq_option $((unit_size / nr_task))
+$USEMEM -n $nr_task $((unit_size / nr_task))
diff --git a/case-swap-w-seq-mt b/case-swap-w-seq-mt
index 4fbca07..475e386 120000..100755
--- a/case-swap-w-seq-mt
+++ b/case-swap-w-seq-mt
@@ -1 +1,12 @@
-case-swap-w-seq \ No newline at end of file
+#!/bin/sh
+
+. ./hw_vars
+
+if [ "$SwapTotal" -eq 0 ]; then
+ echo "No swap space. Please setup swap before running $0" >&2
+ exit 1
+fi
+
+[ -n "$unit_size" ] || unit_size=$(( ((MemAvailable + SwapTotal) << 10) * 3 / 4))
+
+$USEMEM -t $nr_task $((unit_size / nr_task))