[LTP] [PATCH 3/6] mtest06/mmap3: Convert to tst_remaining_runtime()
Cyril Hrubis
chrubis@suse.cz
Mon Oct 25 18:01:31 CEST 2021
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
runtest/mm | 2 +-
testcases/kernel/mem/mtest06/mmap3.c | 12 ++----------
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/runtest/mm b/runtest/mm
index 6537666a9..4ecb61f24 100644
--- a/runtest/mm
+++ b/runtest/mm
@@ -16,7 +16,7 @@ mtest01w mtest01 -p80 -w
mtest05 mmstress
mtest06 mmap1
mtest06_2 mmap2 -x 0.002 -a -p
-mtest06_3 mmap3 -x 0.002 -p
+mtest06_3 mmap3 -p
# Remains diabled till the infinite loop problem is solved
#mtest-6_4 shmat1 -x 0.00005
diff --git a/testcases/kernel/mem/mtest06/mmap3.c b/testcases/kernel/mem/mtest06/mmap3.c
index c18bd2f56..c6d853f98 100644
--- a/testcases/kernel/mem/mtest06/mmap3.c
+++ b/testcases/kernel/mem/mtest06/mmap3.c
@@ -23,11 +23,9 @@
static char *str_loops;
static char *str_threads;
static char *map_private;
-static char *str_exec_time;
static int loops = 1000;
static int threads = 40;
-static float exec_time = 24;
static volatile int sig_caught;
static int threads_running;
@@ -109,7 +107,7 @@ static void test_mmap(void)
long i;
pthread_t thids[threads];
- alarm(exec_time * 3600);
+ alarm(tst_remaining_runtime());
while (!sig_caught) {
for (i = 0; i < threads; i++) {
@@ -138,11 +136,6 @@ static void setup(void)
if (tst_parse_int(str_threads, &threads, 1, INT_MAX))
tst_brk(TBROK, "Invalid number of threads '%s'", str_threads);
- if (tst_parse_float(str_exec_time, &exec_time, 0.0005, 9000))
- tst_brk(TBROK, "Invalid execution time '%s'", str_exec_time);
-
- tst_set_timeout(exec_time * 3600 + 300);
-
SAFE_SIGNAL(SIGALRM, sig_handler);
SAFE_SIGNAL(SIGBUS, sig_handler);
SAFE_SIGNAL(SIGSEGV, sig_handler);
@@ -155,7 +148,6 @@ static void setup(void)
tst_res(TINFO, "Number of loops %i", loops);
tst_res(TINFO, "Number of threads %i", threads);
tst_res(TINFO, "MAP_PRIVATE = %i", map_private ? 1 : 0);
- tst_res(TINFO, "Execution time %fH", exec_time);
}
static void cleanup(void)
@@ -184,10 +176,10 @@ static struct tst_test test = {
{"l:", &str_loops, "-l uint Number of map-write-unmap loops"},
{"n:", &str_threads, "-n uint Number of worker threads"},
{"p", &map_private, "-p Turns on MAP_PRIVATE (default MAP_SHARED)"},
- {"x:", &str_exec_time, "-x float Execution time in hours (default 24H)"},
{}
},
.needs_tmpdir = 1,
+ .max_runtime = 10,
.setup = setup,
.cleanup = cleanup,
.test_all = test_mmap,
--
2.32.0
More information about the ltp
mailing list