Revert "Merge autotest upstream from @5337 ~ @5360"

This reverts commit ce1b0620fddfb6efa33cc9441d9c91ce06b30de3.

Change-Id: Iab10c235ce76bfd45e7a2036ea2413729e34ae15
Reviewed-on: http://gerrit.chromium.org/gerrit/1033
Reviewed-by: Eric Li <ericli@chromium.org>
Tested-by: Eric Li <ericli@chromium.org>
diff --git a/README b/README
deleted file mode 100644
index 42eb73d..0000000
--- a/README
+++ /dev/null
@@ -1,73 +0,0 @@
-= Autotest: Fully automated tests under the linux platform =
-
-Autotest is a framework for fully automated testing. It is designed primarily to
-test the Linux kernel, though it is useful for many other functions such as
-qualifying new hardware. It's an open-source project under the GPL and is used
-and developed by a number of organizations, including Google, IBM, Red Hat, and
-many others.
-
-Autotest is composed of a number of modules that will help you to do stand alone
-tests or setup a fully automated test grid, depending on what you are up to.
-A non extensive list of modules is:
-
-* Autotest client: The engine that executes the tests (dir client). Each
-autotest test is a a directory inside (client/tests) and it is represented
-by a python class that implements a minimum number of methods. The client
-is what you need if you are a single developer trying out autotest and executing
-some tests. Autotest client executes ''client side control files'', which are
-regular python programs, and leverage the API of the client.
-
-* Autotest server: A program that copies the client to remote machines and
-controls their execution. Autotest server executes ''server side control files'',
-which are also regular python programs, but leverage a higher level API, since
-the autotest server can control test execution in multiple machines. If you
-want to perform tests slightly more complex involving more than one machine you
-might want the autotest server
-
-* Autotest database: For test grids, we need a way to store test results, and
-that is the purpose of the database component. This DB is used by the autotest
-scheduler and the frontends to store and visualize test results.
-
-* Autotest scheduler: For test grids, we need an utility that can schedule and
-trigger job execution in test machines, the autotest scheduler is that utility.
-
-* Autotest web frontend: For test grids, A web app, whose backend is written in
-django (http://www.djangoproject.com/) and UI written in gwt
-(http://code.google.com/webtoolkit/), lets users to trigger jobs and visualize
-test results
-
-* Autotest command line interface: Alternatively, users also can use the
-autotest CLI, written in python
-
-== Getting started with autotest client ==
-
-For the impatient:
-
-http://autotest.kernel.org/wiki/QuickStart
-
-== Check out the main project documentation source ==
-
-You can find plenty of information on the autotest wiki
-
-http://autotest.kernel.org/
-
-That also contains references to the project activity
-
-http://autotest.kernel.org/timeline
-
-Links to an online view of the version control system
-
-http://autotest.kernel.org/browser
-
-== Grabbing the latest source ==
-
-http://autotest.kernel.org/wiki/DownloadSource
-
-== Hacking and submitting patches ==
-
-http://autotest.kernel.org/wiki/SubmissionChecklist
-
-== Downloading stable versions ==
-
-http://autotest.kernel.org/wiki/Download
-
diff --git a/client/bin/job.py b/client/bin/job.py
index 09f26f8..9effcdb 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -17,7 +17,6 @@
 from autotest_lib.client.common_lib import error, barrier, log, logging_manager
 from autotest_lib.client.common_lib import base_packages, packages
 from autotest_lib.client.common_lib import global_config
-from autotest_lib.client.tools import html_report
 
 
 LAST_BOOT_TAG = object()
@@ -951,12 +950,6 @@
             self._tap.write()
             self._tap._write_tap_archive()
 
-        # write out a job HTML report
-        try:
-            html_report.create_report(self.resultdir)
-        except Exception, e:
-            logging.error("Error writing job HTML report: %s", e)
-
         # We are about to exit 'complete' so clean up the control file.
         dest = os.path.join(self.resultdir, os.path.basename(self._state_file))
         shutil.move(self._state_file, dest)
diff --git a/client/common_lib/base_utils.py b/client/common_lib/base_utils.py
index db7b869..c8f2f1a 100644
--- a/client/common_lib/base_utils.py
+++ b/client/common_lib/base_utils.py
@@ -1715,17 +1715,3 @@
         # Check if this port is unused on the other protocol.
         if port and try_bind(port, socket.SOCK_DGRAM, socket.IPPROTO_UDP):
             return port
-
-
-def ask(question, auto=False):
-    """
-    Raw input with a prompt that emulates logging.
-
-    @param question: Question to be asked
-    @param auto: Whether to return "y" instead of asking the question
-    """
-    if auto:
-        logging.info("%s (y/n) y" % question)
-        return "y"
-    return raw_input("%s INFO | %s (y/n) " %
-                     (time.strftime("%H:%M:%S", time.localtime()), question))
diff --git a/client/profilers/ftrace/ftrace.py b/client/profilers/ftrace/ftrace.py
index 03c9d84..dd13fff 100644
--- a/client/profilers/ftrace/ftrace.py
+++ b/client/profilers/ftrace/ftrace.py
@@ -5,7 +5,6 @@
 """
 import logging, os, signal, time
 from autotest_lib.client.bin import profiler, utils
-from autotest_lib.client.common_lib import error
 
 
 class ftrace(profiler.profiler):
diff --git a/client/profilers/perf/perf.py b/client/profilers/perf/perf.py
index 69c74a2..b9ad34f 100644
--- a/client/profilers/perf/perf.py
+++ b/client/profilers/perf/perf.py
@@ -65,7 +65,7 @@
 
         if self.trace:
             tracefile = os.path.join(test.profdir, 'trace')
-            cmd = ("%s script -i %s" % (self.perf_bin, self.logfile,))
+            cmd = ("%s trace -i %s" % (self.perf_bin, self.logfile,))
 
             outfile = open(tracefile, 'w')
             p = subprocess.Popen(cmd, shell=True, stdout=outfile,
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..e5ec037
--- /dev/null
+++ b/client/tests/cerberus/0001-Fix-CTCS2-Build.patch
@@ -0,0 +1,212 @@
+From df9ce2db84fca3902d3688d227a749618304611a Mon Sep 17 00:00:00 2001
+From: Lucas Meneghel Rodrigues <lmr@redhat.com>
+Date: Sat, 17 Apr 2010 15:58:41 -0300
+Subject: [PATCH 1/2] Fix CTCS2 Build
+
+* 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
+* Enable gcc specific makefile options
+* Fixing some 64 bits types
+* Getting rid of static compilation of objects in sort.src
+
+Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
+---
+ runin/src/chartst.c               |    1 +
+ runin/src/memtst.src/maxalloc.c   |    3 ---
+ runin/src/memtst.src/memtst.c     |   22 +++++++++++++---------
+ runin/src/memtst.src/sizeofint.c  |    1 +
+ runin/src/pi_fftc6/Makefile_64bit |   12 ++++++------
+ runin/src/pi_fftc6/config.h       |    4 ++--
+ runin/src/sort.src/Makefile       |    2 +-
+ runin/src/sort.src/error.c        |    1 +
+ 8 files changed, 25 insertions(+), 21 deletions(-)
+
+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/Makefile b/runin/src/sort.src/Makefile
+index 68b5731..cfdfadf 100644
+--- a/runin/src/sort.src/Makefile
++++ b/runin/src/sort.src/Makefile
+@@ -1,5 +1,5 @@
+ 
+-COPTIMIZE = -O3 --combine-fwhole-prgram -ffunction-sections -static -msse2
++COPTIMIZE = -O3 --combine-fwhole-prgram -ffunction-sections -msse2
+ CFLAGS2 = $(CFLAGS) -g ${COPTIMIZE}
+ CC = @gcc
+ OBJS = main.o error.o heap.o quick.o merge.o shell.o
+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
+-- 
+1.6.6.1
+
diff --git a/client/tests/cerberus/0002-Fix-CTCS2-build-in-64-bit-boxes.patch b/client/tests/cerberus/0002-Fix-CTCS2-build-in-64-bit-boxes.patch
new file mode 100644
index 0000000..c4035cf
--- /dev/null
+++ b/client/tests/cerberus/0002-Fix-CTCS2-build-in-64-bit-boxes.patch
@@ -0,0 +1,192 @@
+From ad38da9928b2c46c3be9ffa508cdc273583ed44f Mon Sep 17 00:00:00 2001
+From: Lucas Meneghel Rodrigues <lmr@redhat.com>
+Date: Sat, 17 Apr 2010 16:08:09 -0300
+Subject: [PATCH 2/2] Fix CTCS2 build in 64 bit boxes
+
+Signed-off-by: Chen Cao <kcao@redhat.com>
+---
+ runin/src/pi_fftc6/Makefile       |    8 ++--
+ runin/src/pi_fftc6/Makefile_32bit |   68 +++++++++++++++++++++++++++++++++++++
+ runin/src/pi_fftc6/Makefile_64bit |   68 -------------------------------------
+ 3 files changed, 72 insertions(+), 72 deletions(-)
+ create mode 100644 runin/src/pi_fftc6/Makefile_32bit
+ delete mode 100644 runin/src/pi_fftc6/Makefile_64bit
+
+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
+-
+-- 
+1.6.6.1
+
diff --git a/client/tests/ctcs/ctcs.py b/client/tests/cerberus/cerberus.py
similarity index 65%
rename from client/tests/ctcs/ctcs.py
rename to client/tests/cerberus/cerberus.py
index 273c157..64ad916 100644
--- a/client/tests/ctcs/ctcs.py
+++ b/client/tests/cerberus/cerberus.py
@@ -2,12 +2,10 @@
 from autotest_lib.client.bin import test, utils
 from autotest_lib.client.common_lib import error
 
-
-class ctcs(test.test):
+class cerberus(test.test):
     """
-    This autotest module runs CTCS (Cerberus Test Control System), that is being
-    maintained on a new location, since both CTCS and CTCS2 on sourceforge
-    were abandoned.
+    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
@@ -19,11 +17,11 @@
     @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)
-    @author Lucas Meneghel Rodrigues (lmr@redhat.com) (use ctcs new source repo)
-    @see: https://github.com/autotest/ctcs
+    @see: http://sourceforge.net/projects/ctcs2
+    @see: http://sourceforge.net/projects/va-ctcs
     """
-    version = 3
 
+    version = 2
     def initialize(self):
         """
         Sets the overall failure counter for the test.
@@ -31,21 +29,30 @@
         self.nfail = 0
 
 
-    def setup(self, tarball='ctcs.tar.bz2', length='4h', tc_opt='-k',
+    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
+        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 CTCS control file, he could do so trough this parameter.
-                If this parameter is provided, length is ignored.
+                the CTCS2 control file, he could do so trough this parameter. If
+                this parameter is provided, length is ignored.
         """
-        ctcs_tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir)
-        utils.extract_tarball_to_dir(ctcs_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, and platform(32/64bit) related issues.
+        p1 = 'patch -p1 < ../0001-Fix-CTCS2-Build.patch'
+        utils.system(p1)
+
+        if utils.get_cpu_arch() == 'x86_64':
+            p2 = 'patch -p1 < ../0002-Fix-CTCS2-build-in-64-bit-boxes.patch'
+            utils.system(p2)
+
         utils.make()
 
         # Here we define the cerberus suite control file that will be used.
@@ -53,12 +60,12 @@
         self.tcf_path = os.path.join(self.debugdir, 'autotest.tcf')
 
         if not tcf_contents:
-            logging.info('Generating CTCS control file')
+            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))
+            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'
@@ -66,8 +73,8 @@
             tcf = open(self.tcf_path, 'w')
             tcf.write(tcf_contents)
 
-        logging.debug('Contents of the control file that will be passed to '
-                      'CTCS:')
+        logging.debug('Contents of the control file that will be passed to'
+                      ' CTCS 2:')
         tcf = open(self.tcf_path, 'r')
         buf = tcf.read()
         logging.debug(buf)
@@ -82,6 +89,8 @@
             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]
@@ -97,4 +106,4 @@
         if os.path.isdir(self.srcdir):
             shutil.rmtree(self.srcdir)
         if self.nfail != 0:
-            raise error.TestFail('CTCS execution failed')
+            raise error.TestFail('Cerberus test suite failed.')
diff --git a/client/tests/cerberus/control b/client/tests/cerberus/control
new file mode 100644
index 0000000..507375f
--- /dev/null
+++ b/client/tests/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 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='1h', tc_opt='-k -C -a')
diff --git a/client/tests/ctcs/control b/client/tests/ctcs/control
deleted file mode 100644
index c105344..0000000
--- a/client/tests/ctcs/control
+++ /dev/null
@@ -1,19 +0,0 @@
-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)
-Lucas Meneghel Rodrigues (lmr@redhat.com) (use ctcs new source repo)
-"""
-NAME = "CTCS"
-TEST_TYPE = "CLIENT"
-TEST_CLASS = "HARDWARE"
-TEST_CATEGORY = "BENCHMARK"
-TIME = "MEDIUM"
-DOC = """
-Executes CTCS for a period of time specified. You can also provide a cerberus
-test control file of your own, trough the parameter tcf_contents.
-
-see https://github.com/autotest/ctcs
-"""
-
-job.run_test(url='ctcs', length='1h', tc_opt='-k -C -a')
diff --git a/client/tests/kvm/autotest_control/cerberus.control b/client/tests/kvm/autotest_control/cerberus.control
new file mode 100644
index 0000000..5a828f0
--- /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/autotest_control/ctcs.control b/client/tests/kvm/autotest_control/ctcs.control
deleted file mode 100644
index c105344..0000000
--- a/client/tests/kvm/autotest_control/ctcs.control
+++ /dev/null
@@ -1,19 +0,0 @@
-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)
-Lucas Meneghel Rodrigues (lmr@redhat.com) (use ctcs new source repo)
-"""
-NAME = "CTCS"
-TEST_TYPE = "CLIENT"
-TEST_CLASS = "HARDWARE"
-TEST_CATEGORY = "BENCHMARK"
-TIME = "MEDIUM"
-DOC = """
-Executes CTCS for a period of time specified. You can also provide a cerberus
-test control file of your own, trough the parameter tcf_contents.
-
-see https://github.com/autotest/ctcs
-"""
-
-job.run_test(url='ctcs', length='1h', tc_opt='-k -C -a')
diff --git a/client/tests/kvm/control b/client/tests/kvm/control
index c887a3e..6437d88 100644
--- a/client/tests/kvm/control
+++ b/client/tests/kvm/control
@@ -67,3 +67,6 @@
 parser.parse_string(str)
 
 virt_utils.run_tests(parser, job)
+
+# Generate a nice HTML report inside the job's results dir
+virt_utils.create_report(kvm_test_dir, job.resultdir)
diff --git a/client/tests/kvm/get_started.py b/client/tests/kvm/get_started.py
index c986f5e..c0cbdb7 100755
--- a/client/tests/kvm/get_started.py
+++ b/client/tests/kvm/get_started.py
@@ -23,43 +23,21 @@
     @param destination: Directory in local disk where we'd like the iso to be.
     @param hash: SHA1 hash for the ISO image.
     """
-    file_ok = False
+    logging.info("Verifying iso %s", os.path.basename(url))
     if not destination:
         os.makedirs(destination)
     iso_path = os.path.join(destination, os.path.basename(url))
-    if not os.path.isfile(iso_path):
-        logging.warning("File %s not found", iso_path)
-        logging.warning("Expected SHA1 sum: %s", hash)
-        answer = utils.ask("Would you like to download it from %s?" % url)
-        if answer == 'y':
-            try:
-                utils.unmap_url_cache(destination, url, hash, method="sha1")
-                file_ok = True
-            except EnvironmentError, e:
-                logging.error(e)
+    if not os.path.isfile(iso_path) or (
+                            utils.hash_file(iso_path, method="sha1") != hash):
+        logging.warning("%s not found or corrupted", iso_path)
+        logging.warning("Would you like to download it? (y/n)")
+        iso_download = raw_input()
+        if iso_download == 'y':
+            utils.unmap_url_cache(destination, url, hash, method="sha1")
         else:
-            logging.warning("Missing file %s", iso_path)
-            logging.warning("Please download it or put an exsiting copy on the "
-                            "appropriate location")
-            return
+            logging.warning("Missing file %s. Please download it", iso_path)
     else:
-        logging.info("Found %s", iso_path)
-        logging.info("Expected SHA1 sum: %s", hash)
-        answer = utils.ask("Would you like to check %s? It might take a while" %
-                           iso_path)
-        if answer == 'y':
-            try:
-                utils.unmap_url_cache(destination, url, hash, method="sha1")
-                file_ok = True
-            except EnvironmentError, e:
-                logging.error(e)
-        else:
-            logging.info("File %s present, but chose to not verify it",
-                         iso_path)
-            return
-
-    if file_ok:
-        logging.info("%s present, with proper checksum", iso_path)
+        logging.debug("%s present, with proper checksum", iso_path)
 
 
 if __name__ == "__main__":
@@ -67,7 +45,6 @@
                                       verbose=True)
     logging.info("KVM test config helper")
 
-    logging.info("")
     logging.info("1 - Verifying directories (check if the directory structure "
                  "expected by the default test config is there)")
     base_dir = "/tmp/kvm_autotest_root"
@@ -80,14 +57,14 @@
         else:
             logging.debug("Dir %s exists, not creating" %
                           sub_dir_path)
-    answer = utils.ask("Do you want to setup NFS mounts for some of those "
-                       "dirs?")
-    if answer == 'y':
+    logging.info("Do you want to setup NFS mounts for some of those "
+                 "dirs? (y/n)")
+    setup_nfs = raw_input()
+    if setup_nfs == 'y':
         logging.info("Exiting the script so you can setup the NFS mounts. "
                      "When you are done, re-run this script.")
         sys.exit(0)
 
-    logging.info("")
     logging.info("2 - Creating config files from samples (copy the default "
                  "config samples to actual config files)")
     kvm_test_dir = os.path.dirname(sys.modules[__name__].__file__)
@@ -103,7 +80,6 @@
         else:
             logging.debug("Config file %s exists, not touching" % dst_file)
 
-    logging.info("")
     logging.info("3 - Verifying iso (make sure we have the OS ISO needed for "
                  "the default test set)")
 
@@ -113,10 +89,8 @@
                        iso_name)
     hash = "38a4078011bac74493db7ecc53c9d9fbc96dbbd5"
     destination = os.path.join(base_dir, 'isos', 'linux')
-    path = os.path.join(destination, iso_name)
     check_iso(url, destination, hash)
 
-    logging.info("")
     logging.info("4 - Verifying winutils.iso (make sure we have the utility "
                  "ISO needed for Windows testing)")
 
@@ -126,10 +100,8 @@
     url = "http://people.redhat.com/mrodrigu/kvm/winutils.iso"
     hash = "02930224756510e383c44c49bffb760e35d6f892"
     destination = os.path.join(base_dir, 'isos', 'windows')
-    path = os.path.join(destination, iso_name)
     check_iso(url, destination, hash)
 
-    logging.info("")
     logging.info("5 - Checking if qemu is installed (certify qemu and qemu-kvm "
                  "are in the place the default config expects)")
     qemu_default_paths = ['/usr/bin/qemu-kvm', '/usr/bin/qemu-img']
@@ -139,10 +111,7 @@
                             qemu_path)
         else:
             logging.debug("%s present", qemu_path)
-    logging.info("If you wish to change qemu-kvm to qemu or other binary path, "
-                 "you will have to modify tests.cfg")
 
-    logging.info("")
     logging.info("6 - Checking for the KVM module (make sure kvm is loaded "
                  "to accelerate qemu-kvm)")
     if not utils.module_is_loaded("kvm"):
@@ -150,7 +119,6 @@
     else:
         logging.debug("KVM module loaded")
 
-    logging.info("")
     logging.info("7 - Verify needed packages to get started")
     logging.info("Please take a look at the online documentation "
                  "http://www.linux-kvm.org/page/KVM-Autotest/Client_Install "
@@ -159,8 +127,6 @@
     client_dir = os.path.abspath(os.path.join(kvm_test_dir, "..", ".."))
     autotest_bin = os.path.join(client_dir, 'bin', 'autotest')
     control_file = os.path.join(kvm_test_dir, 'control')
-
-    logging.info("")
     logging.info("When you are done fixing eventual warnings found, "
                  "you can run the kvm test using the command line AS ROOT:")
     logging.info("%s --verbose %s", autotest_bin, control_file)
diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample
index 78c84c6..810a4bd 100644
--- a/client/tests/kvm/tests_base.cfg.sample
+++ b/client/tests/kvm/tests_base.cfg.sample
@@ -233,11 +233,11 @@
                 test_control_file = stress.control
             - disktest:
                 test_control_file = disktest.control
-            - ctcs:
+            - ctcs2:
                 # If you think this is too lengthy, please change the cerberus
                 # control file and set this timeout appropriately.
                 test_timeout = 3900
-                test_control_file = ctcs.control
+                test_control_file = cerberus.control
             - npb:
                 test_control_file = npb.control
             - hackbench:
diff --git a/client/tools/html_report.py b/client/tools/html_report.py
index d220ade..8b4b109 100644
--- a/client/tools/html_report.py
+++ b/client/tools/html_report.py
@@ -1563,13 +1563,10 @@
             result['log'] = get_exec_log(dirname, tag)
         if len(stimelist)>0:
             pair = parts[4].split('=')
-            try:
-                etime = int(pair[1])
-                stime = stimelist.pop()
-                total_exec_time_sec = etime - stime
-                result['exec_time_sec'] = total_exec_time_sec
-            except ValueError:
-                result['exec_time_sec'] = "Unknown"
+            etime = int(pair[1])
+            stime = stimelist.pop()
+            total_exec_time_sec = etime - stime
+            result['exec_time_sec'] = total_exec_time_sec
         return result
     return None
 
diff --git a/client/virt/kvm_installer.py b/client/virt/kvm_installer.py
index 54829f4..dc1ffce 100644
--- a/client/virt/kvm_installer.py
+++ b/client/virt/kvm_installer.py
@@ -353,9 +353,7 @@
 class KojiInstaller(YumInstaller):
     """
     Class that handles installing KVM from the fedora build service, koji.
-
-    It uses yum to install and remove packages. Packages are specified
-    according to the syntax defined in the PkgSpec class.
+    It uses yum to install and remove packages.
     """
     load_stock_modules = True
     def set_install_params(self, test, params):
@@ -366,37 +364,27 @@
         @param params: Dictionary with test arguments
         """
         super(KojiInstaller, self).set_install_params(test, params)
+        default_koji_cmd = '/usr/bin/koji'
+        default_src_pkg = 'qemu'
+        self.src_pkg = params.get("src_pkg", default_src_pkg)
         self.tag = params.get("koji_tag", None)
-        self.koji_cmd = params.get("koji_cmd", None)
-        if self.tag is not None:
-            virt_utils.set_default_koji_tag(self.tag)
-        self.koji_pkgs = eval(params.get("koji_pkgs", "[]"))
+        self.build = params.get("koji_build", None)
+        self.koji_cmd = params.get("koji_cmd", default_koji_cmd)
 
 
     def _get_packages(self):
         """
         Downloads the specific arch RPMs for the specific build name.
         """
-        koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
-        for pkg_text in self.koji_pkgs:
-            pkg = virt_utils.KojiPkgSpec(pkg_text)
-            if pkg.is_valid():
-                koji_client.get_pkgs(pkg, dst_dir=self.srcdir)
-            else:
-                logging.error('Package specification (%s) is invalid: %s', pkg,
-                              pkg.describe_invalid())
-
-
-    def _clean_previous_installs(self):
-        kill_qemu_processes()
-        removable_packages = " ".join(self._get_rpm_names())
-        utils.system("yum -y remove %s" % removable_packages)
+        downloader = virt_utils.KojiDownloader(cmd=self.koji_cmd)
+        downloader.get(src_package=self.src_pkg, tag=self.tag,
+                            build=self.build, dst_dir=self.srcdir)
 
 
     def install(self):
-        self._clean_previous_installs()
+        super(KojiInstaller, self)._clean_previous_installs()
         self._get_packages()
-        self._install_packages()
+        super(KojiInstaller, self)._install_packages()
         self.install_unittests()
         create_symlinks(test_bindir=self.test_bindir,
                         bin_list=self.qemu_bin_paths,
@@ -406,35 +394,6 @@
             virt_installer.save_build(self.srcdir, self.results_dir)
 
 
-    def _get_rpm_names(self):
-        all_rpm_names = []
-        koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
-        for pkg_text in self.koji_pkgs:
-            pkg = virt_utils.KojiPkgSpec(pkg_text)
-            rpm_names = koji_client.get_pkg_rpm_names(pkg)
-            all_rpm_names += rpm_names
-        return all_rpm_names
-
-
-    def _get_rpm_file_names(self):
-        all_rpm_file_names = []
-        koji_client = virt_utils.KojiClient(cmd=self.koji_cmd)
-        for pkg_text in self.koji_pkgs:
-            pkg = virt_utils.KojiPkgSpec(pkg_text)
-            rpm_file_names = koji_client.get_pkg_rpm_file_names(pkg)
-            all_rpm_file_names += rpm_file_names
-        return all_rpm_file_names
-
-
-    def _install_packages(self):
-        """
-        Install all downloaded packages.
-        """
-        os.chdir(self.srcdir)
-        rpm_file_names = " ".join(self._get_rpm_file_names())
-        utils.system("yum --nogpgcheck -y localinstall %s" % rpm_file_names)
-
-
 class SourceDirInstaller(BaseInstaller):
     """
     Class that handles building/installing KVM directly from a tarball or
diff --git a/client/virt/kvm_vm.py b/client/virt/kvm_vm.py
index 57fc61b..5df8719 100644
--- a/client/virt/kvm_vm.py
+++ b/client/virt/kvm_vm.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 """
 Utility classes and functions to handle Virtual Machine creation using qemu.
 
@@ -404,7 +405,6 @@
                 device_id = vm.device_id[vlan]
             except IndexError:
                 netdev_id = None
-                device_id = None
             # Handle the '-net nic' part
             try:
                 mac = vm.get_mac_address(vlan)
diff --git a/client/virt/virt_utils.py b/client/virt/virt_utils.py
index 5510c89..97a652d 100644
--- a/client/virt/virt_utils.py
+++ b/client/virt/virt_utils.py
@@ -557,7 +557,7 @@
             match, text = session.read_until_last_line_matches(
                 [r"[Aa]re you sure", r"[Pp]assword:\s*$", r"[Ll]ogin:\s*$",
                  r"[Cc]onnection.*closed", r"[Cc]onnection.*refused",
-                 r"[Pp]lease wait", r"[Ww]arning", prompt],
+                 r"[Pp]lease wait", prompt],
                 timeout=timeout, internal_timeout=0.5)
             if match == 0:  # "Are you sure you want to continue connecting"
                 logging.debug("Got 'Are you sure...'; sending 'yes'")
@@ -592,10 +592,7 @@
                 logging.debug("Got 'Please wait'")
                 timeout = 30
                 continue
-            elif match == 6:  # "Warning added RSA"
-                logging.debug("Got 'Warning added RSA to known host list")
-                continue
-            elif match == 7:  # prompt
+            elif match == 6:  # prompt
                 logging.debug("Got shell prompt -- logged in")
                 break
         except aexpect.ExpectTimeoutError, e:
@@ -1170,8 +1167,7 @@
             # We need only one execution, profiled, hence we're passing
             # the profile_only parameter to job.run_test().
             profile_only = bool(profilers) or None
-            current_status = job.run_test_detail(dict.get("vm_type"),
-                                                 params=dict,
+            current_status = job.run_test_detail("kvm", params=dict,
                                                  tag=test_tag,
                                                  iterations=test_iterations,
                                                  profile_only=profile_only)
@@ -1180,8 +1176,7 @@
         else:
             # We will force the test to fail as TestNA during preprocessing
             dict['dependency_failed'] = 'yes'
-            current_status = job.run_test_detail(dict.get("vm_type"),
-                                                 params=dict,
+            current_status = job.run_test_detail("kvm", params=dict,
                                                  tag=test_tag,
                                                  iterations=test_iterations)
 
@@ -1192,6 +1187,18 @@
     return not failed
 
 
+def create_report(report_dir, results_dir):
+    """
+    Creates a neatly arranged HTML results report in the results dir.
+
+    @param report_dir: Directory where the report script is located.
+    @param results_dir: Directory where the results will be output.
+    """
+    reporter = os.path.join(report_dir, 'html_report.py')
+    html_file = os.path.join(results_dir, 'results.html')
+    os.system('%s -r %s -f %s -R' % (reporter, results_dir, html_file))
+
+
 def display_attributes(instance):
     """
     Inspects a given class instance attributes and displays them, convenient
diff --git a/client/virt/virt_vm.py b/client/virt/virt_vm.py
index f7d672c..fd28966 100644
--- a/client/virt/virt_vm.py
+++ b/client/virt/virt_vm.py
@@ -373,7 +373,7 @@
     def __init__(self, name, params):
         self.name = name
         self.params = params
-
+        
         #
         # Assuming all low-level hypervisors will have a serial (like) console
         # connection to the guest. libvirt also supports serial (like) consoles
@@ -826,3 +826,4 @@
         a restart.
         """
         raise NotImplementedError
+
diff --git a/frontend/afe/models.py b/frontend/afe/models.py
index f560837..8cf42fa 100644
--- a/frontend/afe/models.py
+++ b/frontend/afe/models.py
@@ -561,7 +561,7 @@
         unique_together = ('test', 'name')
 
     def __unicode__(self):
-        return u'%s (%s)' % (self.name, self.test.name)
+        return u'%s (%s)' % (self.name, test.name)
 
 
 class Profiler(dbmodels.Model, model_logic.ModelExtensions):
diff --git a/frontend/afe/resources.py b/frontend/afe/resources.py
index b783115..eaeeea0 100644
--- a/frontend/afe/resources.py
+++ b/frontend/afe/resources.py
@@ -1,11 +1,10 @@
 from django import http
-from autotest_lib.frontend.shared import query_lib, resource_lib, exceptions
+from autotest_lib.frontend.shared import query_lib, resource_lib
 from autotest_lib.frontend.afe import control_file, models, rpc_utils
 from autotest_lib.frontend.afe import model_attributes
 from autotest_lib.frontend import thread_local
 from autotest_lib.client.common_lib import host_protections
 
-
 class EntryWithInvalid(resource_lib.InstanceEntry):
     def put(self):
         if self.instance.invalid:
@@ -320,7 +319,7 @@
         if 'platform' in input_dict:
             label = self.resolve_link(input_dict['platform']) .instance
             if not label.platform:
-                raise exceptions.BadRequest('Label %s is not a platform' % label.name)
+                raise BadRequest('Label %s is not a platform' % label.name)
             for label in self.instance.labels.filter(platform=True):
                 self.instance.labels.remove(label)
             self.instance.labels.add(label)
@@ -780,7 +779,7 @@
     def update(self, input_dict):
         if 'aborted' in input_dict:
             if input_dict['aborted'] != True:
-                raise exceptions.BadRequest('"aborted" can only be set to true')
+                raise BadRequest('"aborted" can only be set to true')
             query = models.HostQueueEntry.objects.filter(pk=self.instance.pk)
             models.AclGroup.check_abort_permissions(query)
             rpc_utils.check_abort_synchronous_jobs(query)
diff --git a/frontend/shared/rest_client.py b/frontend/shared/rest_client.py
index 7294e40..9c4f5d5 100644
--- a/frontend/shared/rest_client.py
+++ b/frontend/shared/rest_client.py
@@ -143,7 +143,7 @@
             logging.debug('Response verification failed, clearing headers and '
                           'trying again:\n%s', response_body)
             _clear_request_headers(uri)
-            headers, response_body = self._http.request(
+            headers, response_body = _http.request(
                 full_uri, method, body=entity_body,
                 headers=_get_request_headers(uri))
 
diff --git a/mirror/config-sample.py b/mirror/config-sample.py
index 131224d..29e215f 100644
--- a/mirror/config-sample.py
+++ b/mirror/config-sample.py
@@ -88,6 +88,5 @@
 
 # now register some trigger actions otherwise nothing will be done for the new
 # kernel versions
-trigger = trigger_module.trigger()
 trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
 trigger.add_action(trigger_module.email_action('test@test.com'))
diff --git a/utils/check_patch.py b/utils/check_patch.py
index bd60d66..78af6b9 100755
--- a/utils/check_patch.py
+++ b/utils/check_patch.py
@@ -32,6 +32,20 @@
                                                                verbose=verbose)
 
 
+def ask(question, auto=False):
+    """
+    Raw input with a prompt that emulates logging.
+
+    @param question: Question to be asked
+    @param auto: Whether to return "y" instead of asking the question
+    """
+    if auto:
+        logging.info("%s (y/n) y" % question)
+        return "y"
+    return raw_input("%s INFO | %s (y/n) " %
+                     (time.strftime("%H:%M:%S", time.localtime()), question))
+
+
 class VCS(object):
     """
     Abstraction layer to the version control system.
@@ -293,8 +307,8 @@
             self._check_unittest()
         if self.corrective_actions:
             for action in self.corrective_actions:
-                answer = utils.ask("Would you like to execute %s?" % action,
-                                   auto=self.confirm)
+                answer = ask("Would you like to execute %s?" % action,
+                             auto=self.confirm)
                 if answer == "y":
                     rc = utils.system(action, ignore_status=True)
                     if rc != 0:
@@ -320,7 +334,7 @@
         if changed_files_before:
             logging.error("Repository has changed files prior to patch "
                           "application. ")
-            answer = utils.ask("Would you like to revert them?", auto=self.confirm)
+            answer = ask("Would you like to revert them?", auto=self.confirm)
             if answer == "n":
                 logging.error("Not safe to proceed without reverting files.")
                 sys.exit(1)
@@ -368,7 +382,7 @@
             for untracked_file in add_to_vcs:
                 logging.info(untracked_file)
             logging.info("Might need to be added to VCS")
-            answer = utils.ask("Would you like to add them to VCS ?")
+            answer = ask("Would you like to add them to VCS ?")
             if answer == "y":
                 for untracked_file in add_to_vcs:
                     self.vcs.add_untracked_file(untracked_file)