Slightly modify hackbench and fsx tests to achieve cross compiling goal.

The existing users for these tests should not be affected at all.

Signed-off-by: Eric Li <[email protected]>
---
 .../0001-Minor-fixes-to-PAGE_SIZE-handling.patch   |   69 ++++++++++++++++++++
 .../fsx/0002-Enable-cross-compiling-for-fsx.patch  |   24 +++++++
 client/tests/fsx/fsx-linux.diff                    |   54 ---------------
 client/tests/fsx/fsx.py                            |    5 +-
 client/tests/hackbench/hackbench.py                |    6 ++-
 5 files changed, 102 insertions(+), 56 deletions(-)
 create mode 100644 
client/tests/fsx/0001-Minor-fixes-to-PAGE_SIZE-handling.patch
 create mode 100644 client/tests/fsx/0002-Enable-cross-compiling-for-fsx.patch
 delete mode 100644 client/tests/fsx/fsx-linux.diff

diff --git a/client/tests/fsx/0001-Minor-fixes-to-PAGE_SIZE-handling.patch 
b/client/tests/fsx/0001-Minor-fixes-to-PAGE_SIZE-handling.patch
new file mode 100644
index 0000000..58d4c2c
--- /dev/null
+++ b/client/tests/fsx/0001-Minor-fixes-to-PAGE_SIZE-handling.patch
@@ -0,0 +1,69 @@
+From 34e3152b64368d4a3672084ebae565d55f320f5d Mon Sep 17 00:00:00 2001
+From: Lucas Meneghel Rodrigues <[email protected]>
+Date: Tue, 18 May 2010 10:40:15 -0300
+Subject: [PATCH 1/2] Minor fixes to PAGE_SIZE handling
+
+Signed-off-by: Suzuki <[email protected]>
+---
+ fsx-linux.c |   10 +++++++---
+ 1 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/fsx-linux.c b/fsx-linux.c
+index a1642d2..33eb770 100644
+--- a/fsx-linux.c
++++ b/fsx-linux.c
+@@ -10,6 +10,8 @@
+  *
+  *    Small changes to work under Linux -- [email protected]
+  *
++ *    Minor fixes to PAGE_SIZE handling -- Suzuki <[email protected]>.
++ *
+  */
+ 
+ #undef _XOPEN_SOURCE
+@@ -74,7 +76,7 @@ int                  logcount = 0;   /* total ops */
+ #define OP_SKIPPED    7
+ 
+ #ifndef PAGE_SIZE
+-#define PAGE_SIZE       4096
++#define PAGE_SIZE       pagesize
+ #endif
+ #define PAGE_MASK       (PAGE_SIZE - 1)
+ 
+@@ -129,6 +131,7 @@ int aio_rw(int rw, int fd, char *buf, unsigned len, 
unsigned offset);
+ FILE *        fsxlogf = NULL;
+ int badoff = -1;
+ int closeopen = 0;
++int pagesize = 0;
+ 
+ static void *round_up(void *ptr, unsigned long align, unsigned long offset)
+ {
+@@ -493,7 +496,7 @@ domapread(unsigned offset, unsigned size)
+                   offset, offset + size - 1, size);
+ 
+       pg_offset = offset & PAGE_MASK;
+-      map_size  = pg_offset + size;
++      map_size  = (pg_offset + size + PAGE_MASK) & ~PAGE_MASK;
+ 
+ #ifdef linux
+       if ((p = (char *)mmap(0, map_size, PROT_READ, MAP_SHARED, fd,
+@@ -638,7 +641,7 @@ domapwrite(unsigned offset, unsigned size)
+               }
+       }
+       pg_offset = offset & PAGE_MASK;
+-      map_size  = pg_offset + size;
++      map_size  = (pg_offset + size + PAGE_MASK) & ~PAGE_MASK;
+ 
+       if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE,
+                             MAP_FILE | MAP_SHARED, fd,
+@@ -1106,6 +1109,7 @@ main(int argc, char **argv)
+       if (argc != 1)
+               usage();
+       fname = argv[0];
++      pagesize = getpagesize();
+ 
+       signal(SIGHUP,  cleanup);
+       signal(SIGINT,  cleanup);
+-- 
+1.7.0.1
+
diff --git a/client/tests/fsx/0002-Enable-cross-compiling-for-fsx.patch 
b/client/tests/fsx/0002-Enable-cross-compiling-for-fsx.patch
new file mode 100644
index 0000000..5988c3c
--- /dev/null
+++ b/client/tests/fsx/0002-Enable-cross-compiling-for-fsx.patch
@@ -0,0 +1,24 @@
+From ee9798e2d40e56427e99f40640b6158926ec2a99 Mon Sep 17 00:00:00 2001
+From: Lucas Meneghel Rodrigues <[email protected]>
+Date: Tue, 18 May 2010 10:41:01 -0300
+Subject: [PATCH 2/2] Enable cross compiling for fsx
+
+Signed-off-by: Eric Li <[email protected]>
+---
+ Makefile |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 337c023..0ebfec2 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ 
+-CC    =       gcc
++CC    ?=      gcc
+ CFLAGS        +=      -O -Wall -g -DAIO
+ CXXFLAGS+=    -O -Wall -g
+ 
+-- 
+1.7.0.1
+
diff --git a/client/tests/fsx/fsx-linux.diff b/client/tests/fsx/fsx-linux.diff
deleted file mode 100644
index ab708f3..0000000
--- a/client/tests/fsx/fsx-linux.diff
+++ /dev/null
@@ -1,54 +0,0 @@
---- src/fsx-linux.c    2006-10-18 04:18:14.000000000 -0400
-+++ src.new/fsx-linux.c        2006-10-18 04:16:05.000000000 -0400
-@@ -10,6 +10,8 @@
-  *
-  *    Small changes to work under Linux -- [email protected]
-  *
-+ *    Minor fixes to PAGE_SIZE handling -- Suzuki <[email protected]>.
-+ *
-  */
- 
- #undef _XOPEN_SOURCE
-@@ -74,7 +76,7 @@ int                  logcount = 0;   /* total ops */
- #define OP_SKIPPED    7
- 
- #ifndef PAGE_SIZE
--#define PAGE_SIZE       4096
-+#define PAGE_SIZE       pagesize
- #endif
- #define PAGE_MASK       (PAGE_SIZE - 1)
- 
-@@ -129,6 +131,7 @@ int aio_rw(int rw, int fd, char *buf, un
- FILE *        fsxlogf = NULL;
- int badoff = -1;
- int closeopen = 0;
-+int pagesize = 0;
- 
- static void *round_up(void *ptr, unsigned long align, unsigned long offset)
- {
-@@ -493,7 +496,7 @@ domapread(unsigned offset, unsigned size
-                   offset, offset + size - 1, size);
- 
-       pg_offset = offset & PAGE_MASK;
--      map_size  = pg_offset + size;
-+      map_size  = (pg_offset + size + PAGE_MASK) & ~PAGE_MASK;
- 
- #ifdef linux
-       if ((p = (char *)mmap(0, map_size, PROT_READ, MAP_SHARED, fd,
-@@ -638,7 +641,7 @@ domapwrite(unsigned offset, unsigned siz
-               }
-       }
-       pg_offset = offset & PAGE_MASK;
--      map_size  = pg_offset + size;
-+      map_size  = (pg_offset + size + PAGE_MASK) & ~PAGE_MASK;
- 
-       if ((p = (char *)mmap(0, map_size, PROT_READ | PROT_WRITE,
-                             MAP_FILE | MAP_SHARED, fd,
-@@ -1106,6 +1109,7 @@ main(int argc, char **argv)
-       if (argc != 1)
-               usage();
-       fname = argv[0];
-+      pagesize = getpagesize();
- 
-       signal(SIGHUP,  cleanup);
-       signal(SIGINT,  cleanup);
diff --git a/client/tests/fsx/fsx.py b/client/tests/fsx/fsx.py
index 38a3e26..fcdb738 100644
--- a/client/tests/fsx/fsx.py
+++ b/client/tests/fsx/fsx.py
@@ -27,7 +27,10 @@ class fsx(test.test):
         self.make_flags = var_ldflags + ' ' + var_cflags
 
         os.chdir(self.srcdir)
-        utils.system('patch -p1 < ../fsx-linux.diff')
+        p1 = '0001-Minor-fixes-to-PAGE_SIZE-handling.patch'
+        p2 = '0002-Enable-cross-compiling-for-fsx.patch'
+        utils.system('patch -p1 < ../%s' % p1)
+        utils.system('patch -p1 < ../%s' % p2)
         utils.system(self.make_flags + ' make fsx-linux')
 
 
diff --git a/client/tests/hackbench/hackbench.py 
b/client/tests/hackbench/hackbench.py
index b2375ac..910b7d0 100644
--- a/client/tests/hackbench/hackbench.py
+++ b/client/tests/hackbench/hackbench.py
@@ -17,7 +17,11 @@ class hackbench(test.test):
 
     def setup(self):
         os.chdir(self.srcdir)
-        utils.system('cc -lpthread hackbench.c -o hackbench')
+        if 'CC' in os.environ:
+          cc = '$CC'
+        else:
+          cc = 'cc'
+        utils.system('%s -lpthread hackbench.c -o hackbench' % cc)
 
 
     def initialize(self):
-- 
1.7.0.1

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to