public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH]Fix building error.
@ 2010-12-15  6:15 Bian Naimeng
  2010-12-21  6:20 ` Bian Naimeng
  0 siblings, 1 reply; 12+ messages in thread
From: Bian Naimeng @ 2010-12-15  6:15 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list

When i build the LTP at RHEL5.5GA, the following error was caught.

make[4]: Entering directory `/home/biannm/gitsrc/ltp-dev/testcases/kernel/syscalls/mmap'
gcc -g -O2 -g -O2 -fno-strict-aliasing -pipe -Wall  -I/home/biannm/gitsrc/ltp-dev/testcases/kernel/include -I../../../../include -I../../../../include   -L../../../../lib  mmap10.c   -lltp -lpthread -o mmap10
mmap10.c: In function ‘mmapzero’:
mmap10.c:120: error: ‘MADV_MERGEABLE’ undeclared (first use in this function)
mmap10.c:120: error: (Each undeclared identifier is reported only once
mmap10.c:120: error: for each function it appears in.)
make[4]: *** [mmap10] Error 1

So, what about this patch?
---------------------------------------------------------------------

KSM is unsupported before 2.6.32. So if MADV_MERGEABLE is undefine,
we should not test the following cases.

1. mmap10 with the option "-s".
2. ksm01.

Signed-off-by: Bian Naimeng <biannm@cn.fujitsu.com>

---
 testcases/kernel/mem/ksm/ksm01.c        |   15 ++++++++++++---
 testcases/kernel/syscalls/mmap/mmap10.c |    4 ++++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/mem/ksm/ksm01.c b/testcases/kernel/mem/ksm/ksm01.c
index 1143791..9b575ff 100644
--- a/testcases/kernel/mem/ksm/ksm01.c
+++ b/testcases/kernel/mem/ksm/ksm01.c
@@ -70,12 +70,14 @@
 #include "test.h"
 #include "usctest.h"
 
-#define _PATH_KSM	"/sys/kernel/mm/ksm/"
-#define MB		(1024 * 1024)
-
 char *TCID = "ksm01";
 int TST_TOTAL = 1;
 extern int Tst_count;
+
+#ifdef	MADV_MERGEABLE
+
+#define _PATH_KSM	"/sys/kernel/mm/ksm/"
+#define MB		(1024 * 1024)
 static int opt_num, opt_size;
 static char *opt_numstr, *opt_sizestr;
 /* memory pointer to identify per process, MB, and byte like
@@ -538,3 +540,10 @@ void group_check(int run, int pages_shared, int pages_sharing,
 	check("sleep_millisecs", NULL, sleep_millisecs);
 	check("pages_to_scan", NULL, pages_to_scan);
 }
+
+#else
+int main(int argc, char *argv[])
+{
+	tst_brkm(TRETR, tst_exit, "KSM is unsupported");
+}
+#endif
diff --git a/testcases/kernel/syscalls/mmap/mmap10.c b/testcases/kernel/syscalls/mmap/mmap10.c
index fe9d622..be988cf 100644
--- a/testcases/kernel/syscalls/mmap/mmap10.c
+++ b/testcases/kernel/syscalls/mmap/mmap10.c
@@ -116,9 +116,13 @@ void mmapzero(void)
 	if (x == MAP_FAILED)
 		tst_brkm(TBROK|TERRNO, cleanup, "mmap");
 	if (opt_ksm) {
+#ifdef	MADV_MERGEABLE
 		tst_resm(TINFO, "add to KSM regions.");
 		if (madvise(x, SIZE+SIZE-4096, MADV_MERGEABLE) == -1)
 			tst_brkm(TBROK|TERRNO, cleanup, "madvise");
+#else
+		tst_brkm(TRETR, cleanup, "KSM is unsupported.");
+#endif
 	}
 	x[SIZE] = 0;
 
-- 
1.7.0.4




-- 
Regards
Bian Naimeng


------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-12-27  5:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15  6:15 [LTP] [PATCH]Fix building error Bian Naimeng
2010-12-21  6:20 ` Bian Naimeng
2010-12-21  6:39   ` CAI Qian
2010-12-21  7:02     ` Bian Naimeng
2010-12-21  7:11       ` CAI Qian
2010-12-21  7:31         ` Bian Naimeng
2010-12-21  8:05           ` Garrett Cooper
2010-12-23  6:45             ` Bian Naimeng
2010-12-23  7:02               ` CAI Qian
2010-12-23  7:13                 ` Bian Naimeng
2010-12-23 19:25                 ` Garrett Cooper
2010-12-27  5:27                   ` CAI Qian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox