- 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. NOTE: this test may need a longer autotest timeout than the default one. Signed-off-by: Cao, Chen <kcao@xxxxxxxxxx> --- client/tests/cerberus2/0001-fix-ctcs2-build.patch | 174 +++++++++++++++++++ client/tests/cerberus2/0002-compile-on-64bit.patch | 175 ++++++++++++++++++++ client/tests/cerberus2/cerberus2.py | 107 ++++++++++++ client/tests/cerberus2/control | 21 +++ client/tests/kvm/kvm_tests.cfg.sample | 3 + 5 files changed, 480 insertions(+), 0 deletions(-) create mode 100644 client/tests/cerberus2/0001-fix-ctcs2-build.patch create mode 100644 client/tests/cerberus2/0002-compile-on-64bit.patch create mode 100644 client/tests/cerberus2/cerberus2.py create mode 100644 client/tests/cerberus2/control diff --git a/client/tests/cerberus2/0001-fix-ctcs2-build.patch b/client/tests/cerberus2/0001-fix-ctcs2-build.patch new file mode 100644 index 0000000..acf1566 --- /dev/null +++ b/client/tests/cerberus2/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/cerberus2/0002-compile-on-64bit.patch b/client/tests/cerberus2/0002-compile-on-64bit.patch new file mode 100644 index 0000000..690ee57 --- /dev/null +++ b/client/tests/cerberus2/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/cerberus2/cerberus2.py b/client/tests/cerberus2/cerberus2.py new file mode 100644 index 0000000..e2bd6c9 --- /dev/null +++ b/client/tests/cerberus2/cerberus2.py @@ -0,0 +1,107 @@ +import os, shutil, glob, logging +from autotest_lib.client.bin import test, utils +from autotest_lib.client.common_lib import error + +class cerberus2(test.test): + """ + This autotest module runs CTCS2 (Cerberus Test Control System 2), which + intents to revive the origin 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@xxxxxxxxxx) (original code) + @author Lucas Meneghel Rodrigues (lucasmr@xxxxxxxxxx) (rewrite - ctcs) + @author Cao, Chen (kcao@xxxxxxxxxx) (use ctcs2 and port it to 64) + """ + + version = 1 + def initialize(self): + """ + Sets the overall failure counter for the test. + """ + self.nfail = 0 + + + 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 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. + """ + 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, 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. + # It will be kept on the debug directory for further analysis. + self.tcf_path = os.path.join(self.debugdir, 'autotest.tcf') + + if not tcf_contents: + logging.info('Generating cerberus control file') + # 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 %s %s> %s' % \ + (tc_opt, length, self.tcf_path) + utils.system(g_cmd) + else: + logging.debug('TCF file contents supplied, ignoring test length' + ' altogether') + tcf = open(self.tcf_path, 'w') + tcf.write(tcf_contents) + + logging.debug('Contents of the control file that will be passed to' + ' ctcs:') + tcf = open(self.tcf_path, 'r') + buf = tcf.read() + logging.debug(buf) + + + def run_once(self): + """ + Runs the test, with the appropriate control file. + """ + os.chdir(self.srcdir) + try: + utils.system('./run %s' % self.tcf_path) + except: + self.nfail += 1 + # After we are done with this iterations, we move the log files to + # the results dir + log_base_path = os.path.join(self.srcdir, 'log') + log_dir = glob.glob(os.path.join(log_base_path, + 'autotest.tcf.log.*'))[0] + logging.debug('Copying %s log directory to results dir', log_dir) + dst = os.path.join(self.resultsdir, os.path.basename(log_dir)) + shutil.move(log_dir, dst) + + + def cleanup(self): + """ + Cleans up source directory and raises on failure. + """ + if os.path.isdir(self.srcdir): + shutil.rmtree(self.srcdir) + if self.nfail != 0: + raise error.TestFail('Cerberus test suite failed.') + diff --git a/client/tests/cerberus2/control b/client/tests/cerberus2/control new file mode 100644 index 0000000..fce4ba3 --- /dev/null +++ b/client/tests/cerberus2/control @@ -0,0 +1,21 @@ +AUTHOR = """ +Manas Kumar Nayak (maknayak@xxxxxxxxxx) (original code) +Lucas Meneghel Rodrigues (lucasmr@xxxxxxxxxx) (rewrite) +Cao, Chen <kcao@xxxxxxxxxx> (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 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='cerberus2', 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 285a38f..1a2b21c 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 = cerberus2 + test_control_file = cerberus2.control - linux_s3: install setup type = linux_s3 -- 1.5.5.6 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html