<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>hugeshmat04 tests are broken when the number of hugepages are
less that expected.</p>
<p>The check in set_sys_tune is causing the test execution to
break,by removing this check in set_sys_tune function the test
works fine.<br>
</p>
<pre class="bz_comment_text" id="comment_text_0">hugeshmat04 0 TINFO : set nr_hugepages to 1024
hugeshmat04 1 TBROK : mem.c:1053: nr_hugepages = 1003, but expect 1024
hugeshmat04 2 TBROK : mem.c:1053: Remaining cases broken
hugeshmat04 0 TINFO : set nr_hugepages to 0
Signed-off-by: Aneesh kumar <a class="moz-txt-link-rfc2396E" href="mailto:aneesh.kumar@in.ibm.com"><aneesh.kumar@in.ibm.com></a>
Tested-by: Charishma M <a class="moz-txt-link-rfc2396E" href="mailto:charism2@in.ibm.com"><charism2@in.ibm.com></a>
Patch :
diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
index 7a717476f4c8..cbb18a25a4f4 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat04.c
@@ -143,7 +143,7 @@ void setup(void)
hpage_size = read_meminfo("Hugepagesize:") * 1024;
hugepages = (orig_hugepages * hpage_size + SIZE) / hpage_size;
- set_sys_tune("nr_hugepages", hugepages, 1);
+ hugepages = set_sys_tune("nr_hugepages", hugepages, 0);
TEST_PAUSE;
}
diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index f9522a52ba16..2f6eb7d7beca 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -87,7 +87,7 @@ void umount_mem(char *path, char *path_new);
unsigned int get_a_numa_node(void (*cleanup_fn)(void));
int path_exist(const char *path, ...);
long read_meminfo(char *item);
-void set_sys_tune(char *sys_file, long tune, int check);
+long set_sys_tune(char *sys_file, long tune, int check);
long get_sys_tune(char *sys_file);
void cleanup(void);
void setup(void);
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 7e403b545228..6a9af0f2ea8c 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -927,7 +927,7 @@ long read_meminfo(char *item)
item, PATH_MEMINFO);
}
-void set_sys_tune(char *sys_file, long tune, int check)
+long set_sys_tune(char *sys_file, long tune, int check)
{
long val;
char path[BUFSIZ];
@@ -936,13 +936,14 @@ void set_sys_tune(char *sys_file, long tune, int check)
snprintf(path, BUFSIZ, PATH_SYSVM "%s", sys_file);
SAFE_FILE_PRINTF(NULL, path, "%ld", tune);
+ val = get_sys_tune(sys_file);
if (check) {
- val = get_sys_tune(sys_file);
if (val != tune)
tst_brkm(TBROK, cleanup, "%s = %ld, but expect %ld",
sys_file, val, tune);
}
+ return val;
}
long get_sys_tune(char *sys_file)
Thanks,
Charishma M.
</pre>
</body>
</html>