diff mbox

Updating cerberus test suite module to use CTCS2

Message ID 1254234931-12790-1-git-send-email-lmr@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lucas Meneghel Rodrigues Sept. 29, 2009, 2:35 p.m. UTC
Instead of using the unmaintained original CTCS suite,
use the CTCS2 project. Since it's not necessary to keep
the old version around, just bump the source version and
add patches to fix the build under 64 bit architectures

New features of the test:

 * Using a newer version compared to the existed cerberus test.
 * User can specifiy cerberus testcases by providing command line options in
 control file.
 * Added a patch to fix the makefile to make cerberus run on
 x86_64 system.

Notes from Lucas

 * I removed the binary diffs for brevity, this is just for the sake of
 documentation
 * I was thinking about a good default time to let this test run, and I am
 tentatively setting the test to run for 1 hour and setting the timeout to
 1 hour and 5 minutes, which seems long enough to get meaningful results out
 of it. If we come to the conclusion that this is too long I am going to change
 it at a later time. Obviously that's configurable on the test config file.

Signed-off-by: Cao, Chen <kcao@redhat.com>
---
 client/tests/cerberus/0001-fix-ctcs2-build.patch   |  174 +++++++++++++++++++
 client/tests/cerberus/0002-compile-on-64bit.patch  |  175 ++++++++++++++++++++
 client/tests/cerberus/cerberus.py                  |   57 ++++---
 client/tests/cerberus/control                      |   14 +-
 client/tests/cerberus/ctcs-1.3.1pre1.tar.bz2       |  Bin 115392 -> 0 bytes
 client/tests/cerberus/ctcs2.tar.bz2                |  Bin 0 -> 2131977 bytes
 client/tests/cerberus/fix-ctcs-build.patch         |   87 ----------
 client/tests/kvm/autotest_control/cerberus.control |   20 +++
 client/tests/kvm/kvm_tests.cfg.sample              |    3 +
 9 files changed, 415 insertions(+), 115 deletions(-)
 create mode 100644 client/tests/cerberus/0001-fix-ctcs2-build.patch
 create mode 100644 client/tests/cerberus/0002-compile-on-64bit.patch
 delete mode 100644 client/tests/cerberus/ctcs-1.3.1pre1.tar.bz2
 create mode 100644 client/tests/cerberus/ctcs2.tar.bz2
 delete mode 100644 client/tests/cerberus/fix-ctcs-build.patch
 create mode 100644 client/tests/kvm/autotest_control/cerberus.control
diff mbox

Patch

diff --git a/client/tests/cerberus/0001-fix-ctcs2-build.patch b/client/tests/cerberus/0001-fix-ctcs2-build.patch
new file mode 100644
index 0000000..acf1566
--- /dev/null
+++ b/client/tests/cerberus/0001-fix-ctcs2-build.patch
@@ -0,0 +1,174 @@ 
+diff --git a/runin/src/chartst.c b/runin/src/chartst.c
+index 4a20b38..63b1a5a 100644
+--- a/runin/src/chartst.c
++++ b/runin/src/chartst.c
+@@ -9,6 +9,7 @@
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <signal.h>
++#include <string.h>
+ 
+ void handler(int i) {
+ 	exit (0);
+diff --git a/runin/src/memtst.src/maxalloc.c b/runin/src/memtst.src/maxalloc.c
+index 5c48356..4863791 100755
+--- a/runin/src/memtst.src/maxalloc.c
++++ b/runin/src/memtst.src/maxalloc.c
+@@ -10,9 +10,6 @@
+ 
+ #if defined(__BSD__)
+ 	static const size_t PAGE_SIZE = 4096;
+-#else
+-/* this is horribly architecture specific */
+-	#include <asm/page.h>
+ #endif
+ 
+ 
+diff --git a/runin/src/memtst.src/memtst.c b/runin/src/memtst.src/memtst.c
+index f086f28..538f770 100755
+--- a/runin/src/memtst.src/memtst.c
++++ b/runin/src/memtst.src/memtst.c
+@@ -10,8 +10,6 @@
+ 
+ #if defined(__BSD__)
+ 	static const size_t PAGE_SIZE = 4096;
+-#else
+-	#include <asm/page.h>
+ #endif
+ 
+ /* The verbose global from memtst_main.c */
+@@ -331,6 +329,12 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 	int kmem_file;
+ 	int d;
+ 
++	/* Newer linux distributions don't have asm/page.h therefore
++	 * we are going to get the page size using the value of
++	 * _SC_PAGESIZE instead.
++	 */
++	u_long page_size = sysconf(_SC_PAGESIZE);
++
+ 	/* window manipulation, iterator, read retval, etc */
+ 	int low, high, foo;
+       	int rd;
+@@ -353,7 +357,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 
+ 	/* Now compute the offset (in chars) of the error from the page
+ 	   boundary. */
+-	fail_page_offset = ((int) (&nbuf[offset])) % PAGE_SIZE;
++	fail_page_offset = ((int) (&nbuf[offset])) % page_size;
+ 
+ 	kmem_file = open("/proc/kcore",0);
+ 	if (kmem_file < 0) {
+@@ -370,7 +374,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 	 * window.
+ 	 */
+ 	fail_page_offset -= ((offset - low) * sizeof(int));
+-	if (fail_page_offset < 0) fail_page_offset+=PAGE_SIZE;
++	if (fail_page_offset < 0) fail_page_offset+=page_size;
+ 
+ 	printf("%d %x fail_page_offset\n",fail_page_offset,fail_page_offset);
+ 
+@@ -382,8 +386,8 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 	 */     #include <sys/types.h>
+      #include <sys/sysctl.h>
+ 
+-	lseek(kmem_file,pages*PAGE_SIZE+fail_page_offset,SEEK_SET);
+-	phys_addr=pages*PAGE_SIZE+fail_page_offset;
++	lseek(kmem_file,pages*page_size+fail_page_offset,SEEK_SET);
++	phys_addr=pages*page_size+fail_page_offset;
+ 
+ 	/* We now use lseeks to (hugely) improve the performance of this
+ 	   thing.  Large memory systems were extremely painful before. 
+@@ -396,8 +400,8 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 			foo = low;	
+ 			/* Every time we miss, skip to the next page. */
+ 			++pages;
+-			lseek(kmem_file,pages*PAGE_SIZE+fail_page_offset,SEEK_SET);
+-			phys_addr=pages*PAGE_SIZE+fail_page_offset;
++			lseek(kmem_file,pages*page_size+fail_page_offset,SEEK_SET);
++			phys_addr=pages*page_size+fail_page_offset;
+ 			continue;
+ 		}
+ 		/* If foo made it to high, we've found it. */
+@@ -410,7 +414,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
+ 			fprintf(stderr, "Possible location of memory failure: %p (%dM) on page %d\n",
+ 				(void *) failure,
+ 				(int) (failure/1024/1024),
+-				(int) (failure/PAGE_SIZE));
++				(int) (failure/page_size));
+ 			close(kmem_file);
+ 			return;
+ 		} 
+diff --git a/runin/src/memtst.src/sizeofint.c b/runin/src/memtst.src/sizeofint.c
+index d1f9cfe..8d0404f 100755
+--- a/runin/src/memtst.src/sizeofint.c
++++ b/runin/src/memtst.src/sizeofint.c
+@@ -1,6 +1,7 @@
+ /* Jason continues to not use autoconf despite the fact he should. */
+ 
+ #include <stdio.h>
++#include <stdlib.h>
+ 
+ main ()
+ {
+diff --git a/runin/src/pi_fftc6/Makefile_64bit b/runin/src/pi_fftc6/Makefile_64bit
+index de06626..57fe30c 100644
+--- a/runin/src/pi_fftc6/Makefile_64bit
++++ b/runin/src/pi_fftc6/Makefile_64bit
+@@ -1,7 +1,7 @@
+ # ---- for GNU gcc ----
+-#CC = gcc
+-#OFLAGS_FFT = -O6 -ffast-math
+-#OFLAGS_PI = -O6 -ffast-math
++CC = gcc
++OFLAGS_FFT = -O6 -ffast-math
++OFLAGS_PI = -O6 -ffast-math
+ 
+ # ---- for SUN WS cc ----
+ #CC = cc
+@@ -9,9 +9,9 @@
+ #OFLAGS_PI = -fast -xO5
+ 
+ # ---- for DEC cc ----
+-CC = cc
+-OFLAGS_FFT = -fast -O6
+-OFLAGS_PI = -fast -O6
++#CC = cc
++#OFLAGS_FFT = -fast -O6
++#OFLAGS_PI = -fast -O6
+ 
+ 
+ # ---- use POSIX Thread ----
+diff --git a/runin/src/pi_fftc6/config.h b/runin/src/pi_fftc6/config.h
+index ecdf0cb..5b4cb3c 100644
+--- a/runin/src/pi_fftc6/config.h
++++ b/runin/src/pi_fftc6/config.h
+@@ -16,7 +16,7 @@
+ #ifndef dgt_int
+ #ifdef USE_DGT_LONG_INT
+ #define dgt_int long long int /* 64 bit int */
+-#define DGT_INT_MAX LLONG_MAX /* 64 bit int max */
++#define DGT_INT_MAX LONG_MAX /* 64 bit int max */
+ #else
+ #ifdef USE_DGT_NORMAL_INT
+ #define dgt_int int           /* 32 bit int */
+@@ -31,7 +31,7 @@
+ #ifndef fft_int
+ #ifdef USE_FFT_LONG_INT
+ #define fft_int long long int /* 64 bit int */
+-#define FFT_INT_MAX LLONG_MAX /* 64 bit int max */
++#define FFT_INT_MAX LONG_MAX /* 64 bit int max */
+ #else
+ #define fft_int int           /* 32 bit int */
+ #define FFT_INT_MAX INT_MAX   /* 32 bit int max */
+diff --git a/runin/src/sort.src/error.c b/runin/src/sort.src/error.c
+index 9e23046..141e05d 100644
+--- a/runin/src/sort.src/error.c
++++ b/runin/src/sort.src/error.c
+@@ -1,5 +1,6 @@
+ /* Fatal error unrelated to system call
+  * Print message and terminate */
++#include <string.h>
+ #include "sort.h"
+ #define MAXLINE	120
+ #define LOG_ERR	120
diff --git a/client/tests/cerberus/0002-compile-on-64bit.patch b/client/tests/cerberus/0002-compile-on-64bit.patch
new file mode 100644
index 0000000..690ee57
--- /dev/null
+++ b/client/tests/cerberus/0002-compile-on-64bit.patch
@@ -0,0 +1,175 @@ 
+diff --git a/runin/src/pi_fftc6/Makefile b/runin/src/pi_fftc6/Makefile
+index e1166bd..57fe30c 100644
+--- a/runin/src/pi_fftc6/Makefile
++++ b/runin/src/pi_fftc6/Makefile
+@@ -1,7 +1,7 @@
+ # ---- for GNU gcc ----
+ CC = gcc
+-OFLAGS_FFT = -O6 -ffast-math 
+-OFLAGS_PI = -O6 -ffast-math -mtune=pentium4 -mfpmath=sse,387 -msse3
++OFLAGS_FFT = -O6 -ffast-math
++OFLAGS_PI = -O6 -ffast-math
+ 
+ # ---- for SUN WS cc ----
+ #CC = cc
+@@ -19,10 +19,10 @@ OFLAGS_PI = -O6 -ffast-math -mtune=pentium4 -mfpmath=sse,387 -msse3
+ #LFLAGS_TH = -lpthread
+ 
+ # ---- use 64-bit size FFT ----
+-#CFLAGS_FI = -DUSE_FFT_LONG_INT
++CFLAGS_FI = -DUSE_FFT_LONG_INT
+ 
+ 
+-CFLAGS = $(CFLAGS_TH) $(CFLAGS_FI)
++CFLAGS = $(CFLAGS_TH) $(CFLAGS_FI) -DPI_OUT_LOGFILE
+ LFLAGS = -lm $(LFLAGS_TH)
+ 
+ 
+diff --git a/runin/src/pi_fftc6/Makefile_32bit b/runin/src/pi_fftc6/Makefile_32bit
+new file mode 100644
+index 0000000..e1166bd
+--- /dev/null
++++ b/runin/src/pi_fftc6/Makefile_32bit
+@@ -0,0 +1,68 @@
++# ---- for GNU gcc ----
++CC = gcc
++OFLAGS_FFT = -O6 -ffast-math 
++OFLAGS_PI = -O6 -ffast-math -mtune=pentium4 -mfpmath=sse,387 -msse3
++
++# ---- for SUN WS cc ----
++#CC = cc
++#OFLAGS_FFT = -fast -xO5
++#OFLAGS_PI = -fast -xO5
++
++# ---- for DEC cc ----
++#CC = cc
++#OFLAGS_FFT = -fast -O6
++#OFLAGS_PI = -fast -O6
++
++
++# ---- use POSIX Thread ----
++#CFLAGS_TH = -DUSE_CDFT_PTHREADS
++#LFLAGS_TH = -lpthread
++
++# ---- use 64-bit size FFT ----
++#CFLAGS_FI = -DUSE_FFT_LONG_INT
++
++
++CFLAGS = $(CFLAGS_TH) $(CFLAGS_FI)
++LFLAGS = -lm $(LFLAGS_TH)
++
++
++all: pi_ca pi_cs pi_cw dgt_div
++
++
++pi_ca : pi_fftca.o fftsgx.o
++	$(CC) pi_fftca.o fftsgx.o $(LFLAGS) -o $@
++
++pi_cs : pi_fftcs.o fftsg_hx.o
++	$(CC) pi_fftcs.o fftsg_hx.o $(LFLAGS) -o $@
++
++pi_cw : pi_fftcw.o fftsg_hx.o
++	$(CC) pi_fftcw.o fftsg_hx.o $(LFLAGS) -o $@
++
++dgt_div : dgt_div.o
++	$(CC) dgt_div.o -o $@
++
++
++pi_fftca.o : pi_fftca.c
++	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
++
++pi_fftcs.o : pi_fftcs.c
++	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
++
++pi_fftcw.o : pi_fftcw.c
++	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
++
++
++fftsgx.o : fftsgx.c
++	$(CC) $(CFLAGS) $(OFLAGS_FFT) -c $*.c -o $@
++
++fftsg_hx.o : fftsg_hx.c
++	$(CC) $(CFLAGS) $(OFLAGS_FFT) -c $*.c -o $@
++
++
++dgt_div.o : dgt_div.c
++	$(CC) $(CFLAGS) -O -c $*.c -o $@
++
++
++clean:
++	rm -f *.o
++
+diff --git a/runin/src/pi_fftc6/Makefile_64bit b/runin/src/pi_fftc6/Makefile_64bit
+deleted file mode 100644
+index 57fe30c..0000000
+--- a/runin/src/pi_fftc6/Makefile_64bit
++++ /dev/null
+@@ -1,68 +0,0 @@
+-# ---- for GNU gcc ----
+-CC = gcc
+-OFLAGS_FFT = -O6 -ffast-math
+-OFLAGS_PI = -O6 -ffast-math
+-
+-# ---- for SUN WS cc ----
+-#CC = cc
+-#OFLAGS_FFT = -fast -xO5
+-#OFLAGS_PI = -fast -xO5
+-
+-# ---- for DEC cc ----
+-#CC = cc
+-#OFLAGS_FFT = -fast -O6
+-#OFLAGS_PI = -fast -O6
+-
+-
+-# ---- use POSIX Thread ----
+-#CFLAGS_TH = -DUSE_CDFT_PTHREADS
+-#LFLAGS_TH = -lpthread
+-
+-# ---- use 64-bit size FFT ----
+-CFLAGS_FI = -DUSE_FFT_LONG_INT
+-
+-
+-CFLAGS = $(CFLAGS_TH) $(CFLAGS_FI) -DPI_OUT_LOGFILE
+-LFLAGS = -lm $(LFLAGS_TH)
+-
+-
+-all: pi_ca pi_cs pi_cw dgt_div
+-
+-
+-pi_ca : pi_fftca.o fftsgx.o
+-	$(CC) pi_fftca.o fftsgx.o $(LFLAGS) -o $@
+-
+-pi_cs : pi_fftcs.o fftsg_hx.o
+-	$(CC) pi_fftcs.o fftsg_hx.o $(LFLAGS) -o $@
+-
+-pi_cw : pi_fftcw.o fftsg_hx.o
+-	$(CC) pi_fftcw.o fftsg_hx.o $(LFLAGS) -o $@
+-
+-dgt_div : dgt_div.o
+-	$(CC) dgt_div.o -o $@
+-
+-
+-pi_fftca.o : pi_fftca.c
+-	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
+-
+-pi_fftcs.o : pi_fftcs.c
+-	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
+-
+-pi_fftcw.o : pi_fftcw.c
+-	$(CC) $(CFLAGS) $(OFLAGS_PI) -c $*.c -o $@
+-
+-
+-fftsgx.o : fftsgx.c
+-	$(CC) $(CFLAGS) $(OFLAGS_FFT) -c $*.c -o $@
+-
+-fftsg_hx.o : fftsg_hx.c
+-	$(CC) $(CFLAGS) $(OFLAGS_FFT) -c $*.c -o $@
+-
+-
+-dgt_div.o : dgt_div.c
+-	$(CC) $(CFLAGS) -O -c $*.c -o $@
+-
+-
+-clean:
+-	rm -f *.o
+-
diff --git a/client/tests/cerberus/cerberus.py b/client/tests/cerberus/cerberus.py
index 828bcea..2761d90 100644
--- a/client/tests/cerberus/cerberus.py
+++ b/client/tests/cerberus/cerberus.py
@@ -2,21 +2,26 @@  import os, shutil, glob, logging
 from autotest_lib.client.bin import test, utils
 from autotest_lib.client.common_lib import error
 
-
 class cerberus(test.test):
     """
-    This autotest module runs CTCS (Cerberus Test Control System). This test
-    suite was developed for the now extinct VA Linux's manufacturing system
-    it has several hardware and software stress tests that can be run in
-    parallel. It does have a control file system that allows testers to specify
-    the sorts of tests that they want to see executed. It's an excelent stress
-    test for hardware and kernel.
-
-        @author Manas Kumar Nayak (maknayak@in.ibm.com) (original code)
-        @author Lucas Meneghel Rodrigues (lucasmr@br.ibm.com) (rewrite)
+    This autotest module runs CTCS2 (Cerberus Test Control System 2), which
+    intents to revive the original CTCS project.
+
+    The original test suite (Cerberus Test Control System) was developed for
+    the now extinct VA Linux's manufacturing system it has several hardware
+    and software stress tests that can be run in parallel. It does have a
+    control file system that allows testers to specify the sorts of tests that
+    they want to see executed. It's an excelent stress test for hardware and
+    kernel.
+
+    @author Manas Kumar Nayak (maknayak@in.ibm.com) (original code)
+    @author Lucas Meneghel Rodrigues (lucasmr@br.ibm.com) (rewrite - ctcs)
+    @author Cao, Chen (kcao@redhat.com) (use ctcs2 and port it to 64)
+    @see: http://sourceforge.net/projects/ctcs2
+    @see: http://sourceforge.net/projects/va-ctcs
     """
 
-    version = 1
+    version = 2
     def initialize(self):
         """
         Sets the overall failure counter for the test.
@@ -24,24 +29,29 @@  class cerberus(test.test):
         self.nfail = 0
 
 
-    def setup(self, tarball='ctcs-1.3.1pre1.tar.bz2', length = '4h',
+    def setup(self, tarball='ctcs2.tar.bz2', length='4h', tc_opt='-k',
               tcf_contents=None):
         """
         Builds the test suite, and sets up the control file that is going to
-        be processed by the ctcs engine.
-            @param tarball: CTCS tarball
-            @param length: The amount of time we'll run the test suite
-            @param tcf_contents: If the user wants to specify the contents of
-            the CTCS control file, he could do so trough this parameter. If
-            this parameter is provided, length is ignored.
+        be processed by the ctcs2 engine.
+        @param tarball: CTCS2 tarball
+        @param length: The amount of time we'll run the test suite
+        @param tcf_contents: If the user wants to specify the contents of
+                the CTCS2 control file, he could do so trough this parameter. If
+                this parameter is provided, length is ignored.
         """
-        cerberus_tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
-        utils.extract_tarball_to_dir(cerberus_tarball, self.srcdir)
+        cerberus2_tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
+        utils.extract_tarball_to_dir(cerberus2_tarball, self.srcdir)
 
         os.chdir(self.srcdir)
         # Apply patch to fix build problems on newer distros (absence of
-        # asm/page.h include.
-        utils.system('patch -p1 < ../fix-ctcs-build.patch')
+        # asm/page.h include, and platform(32/64bit) related issues.
+        utils.system('patch -p1 < ../0001-fix-ctcs2-build.patch')
+
+        output = os.popen('uname -i').read()
+        if output.find('x86_64') != -1:
+            utils.system('patch -p1 < ../0002-compile-on-64bit.patch')
+
         utils.system('make')
 
         # Here we define the cerberus suite control file that will be used.
@@ -53,7 +63,8 @@  class cerberus(test.test):
             # Note about the control file generation command - we are creating
             # a control file with the default tests, except for the kernel
             # compilation test (flag -k).
-            g_cmd = './newburn-generator -k %s> %s' % (length, self.tcf_path)
+            g_cmd = './newburn-generator %s %s> %s' % \
+                                            (tc_opt, length, self.tcf_path)
             utils.system(g_cmd)
         else:
             logging.debug('TCF file contents supplied, ignoring test length'
@@ -62,7 +73,7 @@  class cerberus(test.test):
             tcf.write(tcf_contents)
 
         logging.debug('Contents of the control file that will be passed to'
-                      ' ctcs:')
+                      ' CTCS 2:')
         tcf = open(self.tcf_path, 'r')
         buf = tcf.read()
         logging.debug(buf)
diff --git a/client/tests/cerberus/control b/client/tests/cerberus/control
index bb88154..507375f 100644
--- a/client/tests/cerberus/control
+++ b/client/tests/cerberus/control
@@ -1,16 +1,20 @@ 
 AUTHOR = """
 Manas Kumar Nayak (maknayak@in.ibm.com) (original code)
 Lucas Meneghel Rodrigues (lucasmr@br.ibm.com) (rewrite)
+Cao, Chen <kcao@redhat.com> (use ctcs2 and port it to 64)
 """
 NAME = "Cerberus test suite"
-TEST_TYPE = "client"
-TEST_CLASS = "Hardware"
-TEST_CATEGORY = "Functional"
+TEST_TYPE = "CLIENT"
+TEST_CLASS = "HARDWARE"
+TEST_CATEGORY = "BENCHMARK"
 TIME = "MEDIUM"
 DOC = """\
-Executes the cerberus VA manufacturing test for a period of time specified. You
+Executes the cerberus2 test for a period of time specified. You
 can also provide a cerberus test control file of your own, trough the parameter
 tcf_contents.
+
+see http://sourceforge.net/projects/ctcs2
+    and http://sourceforge.net/projects/va-ctcs
 """
 
-job.run_test(url='cerberus', length='4h')
+job.run_test(url='cerberus', length='1h', tc_opt='-k -C -a')
diff --git a/client/tests/cerberus/fix-ctcs-build.patch b/client/tests/cerberus/fix-ctcs-build.patch
deleted file mode 100644
index 7390698..0000000
--- a/client/tests/cerberus/fix-ctcs-build.patch
+++ /dev/null
@@ -1,87 +0,0 @@ 
-diff --git a/runin/src/memtst.src/maxalloc.c b/runin/src/memtst.src/maxalloc.c
-index 9189193..f784055 100644
---- a/runin/src/memtst.src/maxalloc.c
-+++ b/runin/src/memtst.src/maxalloc.c
-@@ -8,9 +8,6 @@
- #include <malloc.h>
- #include "memory.h"
- 
--/* this is horribly architecture specific */
--#include <asm/page.h>
--
- void maxalloc(int ceiling, int attempts) {
- 	unsigned nint;
- 	int *buf;
-diff --git a/runin/src/memtst.src/memtst.c b/runin/src/memtst.src/memtst.c
-index cb79bea..4bce4a2 100644
---- a/runin/src/memtst.src/memtst.c
-+++ b/runin/src/memtst.src/memtst.c
-@@ -8,8 +8,6 @@
- #include "memtst.h"
- #include "memory.h"
- 
--#include <asm/page.h>
--
- /* The verbose global from memtst_main.c */
- extern int verbose;
- 
-@@ -324,6 +322,10 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 	int kmem_file;
- 	int d;
- 
-+	/* Newer linux distributions don't have asm/page.h therefore we are going
-+	.  to get the page size using the value of _SC_PAGESIZE instead */
-+	u_long page_size = sysconf(_SC_PAGESIZE);
-+
- 	/* window manipulation, iterator, read retval, etc */
- 	int low, high, foo;
-       	int rd;
-@@ -346,7 +348,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 
- 	/* Now compute the offset (in chars) of the error from the page
- 	   boundary. */
--	fail_page_offset = ((int) (&nbuf[offset])) % PAGE_SIZE;
-+	fail_page_offset = ((int) (&nbuf[offset])) % page_size;
- 
- 	kmem_file = open("/proc/kcore",0);
- 	if (kmem_file < 0) {
-@@ -363,7 +365,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 	 * window.
- 	 */
- 	fail_page_offset -= ((offset - low) * sizeof(int));
--	if (fail_page_offset < 0) fail_page_offset+=PAGE_SIZE;
-+	if (fail_page_offset < 0) fail_page_offset+=page_size;
- 
- 	printf("%d %x fail_page_offset\n",fail_page_offset,fail_page_offset);
- 
-@@ -373,8 +375,8 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 	/* Start by seeking to the start of the area on the page where
- 	 * we'st be lookin'
- 	 */
--	lseek(kmem_file,pages*PAGE_SIZE+fail_page_offset,SEEK_SET);
--	phys_addr=pages*PAGE_SIZE+fail_page_offset;
-+	lseek(kmem_file,pages*page_size+fail_page_offset,SEEK_SET);
-+	phys_addr=pages*page_size+fail_page_offset;
- 
- 	/* We now use lseeks to (hugely) improve the performance of this
- 	   thing.  Large memory systems were extremely painful before. 
-@@ -387,8 +389,8 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 			foo = low;	
- 			/* Every time we miss, skip to the next page. */
- 			++pages;
--			lseek(kmem_file,pages*PAGE_SIZE+fail_page_offset,SEEK_SET);
--			phys_addr=pages*PAGE_SIZE+fail_page_offset;
-+			lseek(kmem_file,pages*page_size+fail_page_offset,SEEK_SET);
-+			phys_addr=pages*page_size+fail_page_offset;
- 			continue;
- 		}
- 		/* If foo made it to high, we've found it. */
-@@ -401,7 +403,7 @@ void kmemscan (int *nbuf, int block_size, int offset) {
- 			fprintf(stderr, "Possible location of memory failure: %p (%dM) on page %d\n",
- 				(void *) failure,
- 				(int) (failure/1024/1024),
--				(int) (failure/PAGE_SIZE));
-+				(int) (failure/page_size));
- 			close(kmem_file);
- 			return;
- 		} 
diff --git a/client/tests/kvm/autotest_control/cerberus.control b/client/tests/kvm/autotest_control/cerberus.control
new file mode 100644
index 0000000..507375f
--- /dev/null
+++ b/client/tests/kvm/autotest_control/cerberus.control
@@ -0,0 +1,20 @@ 
+AUTHOR = """
+Manas Kumar Nayak (maknayak@in.ibm.com) (original code)
+Lucas Meneghel Rodrigues (lucasmr@br.ibm.com) (rewrite)
+Cao, Chen <kcao@redhat.com> (use ctcs2 and port it to 64)
+"""
+NAME = "Cerberus test suite"
+TEST_TYPE = "CLIENT"
+TEST_CLASS = "HARDWARE"
+TEST_CATEGORY = "BENCHMARK"
+TIME = "MEDIUM"
+DOC = """\
+Executes the cerberus test for a period of time specified. You
+can also provide a cerberus test control file of your own, trough the parameter
+tcf_contents.
+
+see http://sourceforge.net/projects/ctcs2
+    and http://sourceforge.net/projects/va-ctcs
+"""
+
+job.run_test(url='cerberus', length='1h', tc_opt='-k -C -a')
diff --git a/client/tests/kvm/kvm_tests.cfg.sample b/client/tests/kvm/kvm_tests.cfg.sample
index 1ee4b7c..8100642 100644
--- a/client/tests/kvm/kvm_tests.cfg.sample
+++ b/client/tests/kvm/kvm_tests.cfg.sample
@@ -90,6 +90,9 @@  variants:
             - disktest:
                 test_name = disktest
                 test_control_file = disktest.control
+            - ctcs2:
+                test_name = cerberus
+                # If you think this is too lengthy, please change the cerberus
+                # control file and set this timeout appropriately.
+                test_timeout = 3900
+                test_control_file = cerberus.control
 
     - linux_s3:     install setup
         type = linux_s3