Risk: Low
Visibility: The bonnie, dbench, reaim, sysbench and tbench tests will
all include their test output in stdout/stderr again.

Modified the recent changes to the benchmarks that converted
system -> system_output to also make use of the retain_output
parameter on system_output that also sends the std* of the commands
to the autotest std*. This also changes the accumulation of the
results to use a list which is concatenated at the end, rather than
concatenating strings as the output is generated.

Signed-off-by: John Admanski <[email protected]>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1524 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/tests/bonnie/bonnie.py b/client/tests/bonnie/bonnie.py
index 5efda71..85405ef 100755
--- a/client/tests/bonnie/bonnie.py
+++ b/client/tests/bonnie/bonnie.py
@@ -42,21 +42,21 @@
 
 		args = '-d ' + testdir + ' -u ' + user + ' ' + extra_args
 		cmd = self.srcdir + '/bonnie++ ' + args
-		results = ''
+		results = []
 		profilers = self.job.profilers
 		if not profilers.only():
 			for i in range(iterations):
-				results += system_output(cmd) + '\n'
+				results.append(system_output(cmd,
+							retain_output=True))
 
 		# Do a profiling run if necessary
 		if profilers.present():
 			profilers.start(self)
-			results += system_output(cmd) + '\n'
+			results.append(system_output(cmd, retain_output=True))
 			profilers.stop(self)
 			profilers.report(self)
 
-		print results
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 	def __format_results(self, results):
 		strip_plus = lambda s: re.sub(r"^\++$", "0", s)
diff --git a/client/tests/dbench/dbench.py b/client/tests/dbench/dbench.py
index a174a32..e5fe27a 100755
--- a/client/tests/dbench/dbench.py
+++ b/client/tests/dbench/dbench.py
@@ -23,20 +23,20 @@
 			args += ' -D ' + dir
 		args += ' %s' % nprocs
 		cmd = self.srcdir + '/dbench ' + args
-		results = ''
+		results = []
 		if not profilers.only():
 			for i in range(iterations):
-				results += system_output(cmd) + '\n'
+				results.append(system_output(cmd,
+							retain_output=True))
 
 		# Do a profiling run if necessary
 		if profilers.present():
 			profilers.start(self)
-			results += system_output(cmd) + '\n'
+			results.append(system_output(cmd, retain_output=True))
 			profilers.stop(self)
 			profilers.report(self)
 
-		print results
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 
 	def __format_results(self, results):
diff --git a/client/tests/reaim/reaim.py b/client/tests/reaim/reaim.py
index 446b925..b37c0fb 100755
--- a/client/tests/reaim/reaim.py
+++ b/client/tests/reaim/reaim.py
@@ -54,22 +54,23 @@
 		os.chdir(self.srcdir)
 		print os.getcwd()
 		cmd = self.ldlib + ' ./reaim ' + args + ' ' + extra_args
-		results = ''
+
+		results = []
 
 		profilers = self.job.profilers
 		if not profilers.only():
 			for i in range(iterations):
-				results += system_output(cmd) + '\n'
+				results.append(system_output(cmd,
+							retain_output=True))
 
 		# Do a profiling run if necessary
 		if profilers.present():
 			profilers.start(self)
-			results += system_output(cmd) + '\n'
+			resuls.append(system_output(cmd, retain_output=True))
 			profilers.stop(self)
 			profilers.report(self)
 
-		print results
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 
 	def __format_results(self, results):
diff --git a/client/tests/sysbench/sysbench.py b/client/tests/sysbench/sysbench.py
index 968ba5e..219b008 100644
--- a/client/tests/sysbench/sysbench.py
+++ b/client/tests/sysbench/sysbench.py
@@ -85,25 +85,28 @@
 			if read_only:
 				cmd = cmd + ' --oltp-read-only=on'
 
+			results = []
+
 			profilers = self.job.profilers
 			if not profilers.only():
-				results = system_output(cmd + ' run') + '\n'
+				results.append(system_output(cmd + ' run',
+							retain_output=True))
 
 			# Do a profiling run if necessary
 			if profilers.present():
 				profilers.start(self)
-				results = "Profiling run ...\n"
-				results += system_output(cmd + ' run') + '\n'
+				results.append("Profiling run ...")
+				results.append(system_output(cmd + ' run',
+							retain_output=True))
 				profilers.stop(self)
 				profilers.report(self)
 		except:
 			system(self.sudo + bin + '/pg_ctl -D ' + data + ' stop')
 			raise
 
-		print results
 		system(self.sudo + bin + '/pg_ctl -D ' + data + ' stop')
 
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 
 	def execute_mysql(self, build, num_threads, max_time, read_only, args):
@@ -142,25 +145,28 @@
 			if read_only:
 				cmd = cmd + ' --oltp-read-only=on'
 
+			results = []
+
 			profilers = self.job.profilers
                 	if not profilers.only():
-				results = system(cmd + ' run') + '\n'
+				results.append(system_output(cmd + ' run',
+							 retain_output=True))
 
 			# Do a profiling run if necessary
 			if profilers.present():
 				profilers.start(self)
-				results = "Profiling run ...\n" 
-				results += system_output(cmd + ' run') + '\n'
+				results.append("Profiling run ...")
+				results.append(system_output(cmd + ' run',
+							retain_output=True))
 				profilers.stop(self)
 				profilers.report(self)
 		except:
 			system(bin + '/mysqladmin shutdown')
 			raise
 
-		print results
 		system(bin + '/mysqladmin shutdown')
 
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 
 	def __format_results(self, results):
@@ -180,4 +186,3 @@
 
 		print >> out, 'threads=%s\ntps=%s' % (threads, tps)
 		out.close()
-
diff --git a/client/tests/tbench/tbench.py b/client/tests/tbench/tbench.py
index f617a15..62a0689 100755
--- a/client/tests/tbench/tbench.py
+++ b/client/tests/tbench/tbench.py
@@ -19,21 +19,20 @@
 		if not nprocs:
 			nprocs = self.job.cpu_count()
 		args += ' %s' % nprocs
-		results = ''
+		results = []
 		profilers = self.job.profilers
 		if not profilers.only():
 			for i in range(iterations):
-				results += self.run_tbench(args)
+				results.append(self.run_tbench(args))
 
 		# Do a profiling run if necessary
 		if profilers.present():
 			profilers.start(self)
-			results += self.run_tbench(args)
+			results.append(self.run_tbench(args))
 			profilers.stop(self)
 			profilers.report(self)
 
-		print results
-		self.__format_results(results)
+		self.__format_results("\n".join(results))
 
 
 	def run_tbench(self, args):
@@ -42,12 +41,13 @@
 			time.sleep(1)
 			client = self.srcdir + '/client.txt'
 			args = '-c ' + client + ' ' + '%s' % args
-			results = system_output(self.srcdir + '/tbench ' + args) 
+			cmd = os.path.join(self.srcdir, "tbench") + " " + args
+			results = system_output(cmd, retain_output=True)
 			os.kill(pid, signal.SIGTERM)    # clean up the server
 		else:				# child
 			server = self.srcdir + '/tbench_srv'
 			os.execlp(server, server)
-		return results + '\n'
+		return results
 
 
 	def __format_results(self, results):