[Ocfs2-test-devel] [PATCH 08/11] ocfs2-test: changed to accept an alternate NIC to be used by the test.

Marcos Matsunaga Marcos.Matsunaga at oracle.com
Thu Jun 3 06:55:32 PDT 2010


- added the makelog logfile to separate the output of the build from
  the general logfile.

Signed-off-by: Marcos Matsunaga <Marcos.Matsunaga at oracle.com>
---
 programs/buildkernel/buildkernel.py     |   88 ++++++++++---------------------
 programs/buildkernel/run_buildkernel.py |   19 +++++--
 2 files changed, 43 insertions(+), 64 deletions(-)

diff --git a/programs/buildkernel/buildkernel.py b/programs/buildkernel/buildkernel.py
index 6ce8dee..4f0be74 100755
--- a/programs/buildkernel/buildkernel.py
+++ b/programs/buildkernel/buildkernel.py
@@ -29,7 +29,7 @@
 # E-mail		  : Marcos.Matsunaga at oracle.com
 
 #
-import os, sys, time, optparse, socket, string, o2tf, pdb, timing, time, config
+import os, sys, time, optparse, socket, string, o2tf, pdb, timing, time, config, platform
 #
 DEBUGON = os.getenv('DEBUG',0)
 #
@@ -50,13 +50,9 @@ def tbuild(thrid, command):
 	'	 command - command to be executed'
 	if DEBUGON:
 		o2tf.printlog('buildkernel:tbuild - current directory %s' % os.getcwd(), 
-			logfile, 
-			0, 
-			'')
+			logfile, 0, '')
 		o2tf.printlog('buildkernel:tbuild - command	%s ' % command, 
-			logfile, 
-			0, 
-			'')
+			logfile, 0, '')
 	pidlist[thrid] = os.spawnv(os.P_NOWAIT, 
 			'/bin/bash', 
 			['bash', 
@@ -69,38 +65,25 @@ def check_thread(logfile):
 	'check_thread takes 1 argument:'
 	'	 logfile - logfile name'
 	o2tf.printlog('buildkernel:check_thread: Waiting for processes to finish '
-		'on thread ',
-		logfile, 
-		0, 
-		'')
+		'on thread ', logfile, 0, '')
 	while len(pidlist) > 0:
 		o2tf.printlog('buildkernel:check_thread: Checking thread processes',
-			logfile, 
-			0, 
-			'')
+			logfile, 0, '')
 		o2tf.printlog('buildkernel:check_thread: pid list %s' % (pidlist), 
-			logfile, 
-			0, 
-			'')
+			logfile, 0, '')
 		for z in range(len(pidlist)):
 			out = os.waitpid(pidlist[z],os.WNOHANG)
 			o2tf.printlog('buildkernel:check_thread: z=%s, out=%s' % (z, out[1]), 
-				logfile, 
-				0, 
-				'')
+				logfile, 0, '')
 			if out[0] > 0:
 				o2tf.printlog('buildkernel:check_thread: Removing pid '
 					'%s from the list' %	pidlist[z], 
-					logfile, 
-					0, 
-					'')
+					logfile, 0, '')
 				t2 = time.time()
 				o2tf.printlog('buildkernel:check_thread: %s [%s]: Build '
 					'time is %f seconds' % 
 					(str(socket.gethostname()), pidlist[z], t2 - t1), 
-					logfile, 
-					0, 
-					'')
+					logfile, 0, '')
 				pidlist.remove(out[0])
 				break
 		time.sleep(CHECKTHREAD_SLEEPTIME)
@@ -200,34 +183,20 @@ if __name__=='__main__':
 #
 if DEBUGON:
 	o2tf.printlog('buildkernel: cleardir = (%s)' % cleardir, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 	o2tf.printlog('buildkernel: dirlist = (%s)' % dirlist, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 	o2tf.printlog('buildkernel: dirlen = (%s)' % dirlen, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 	o2tf.printlog('buildkernel: logfile = (%s)' % logfile, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 	o2tf.printlog('buildkernel: nodelist = (%s)' % nodelist, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 	if options.extract_tar:
 		o2tf.printlog('buildkernel: tarfile = (%s)' % tarfile, 
-			logfile, 
-			0, 
-			'')
+			logfile, 0, '')
 	o2tf.printlog('buildkernel: extract_tar = (%s)' % extract_tar, 
-		logfile, 
-		0, 
-		'')
+		logfile, 0, '')
 #
 if cleardir:
 	o2tf.ClearDir(DEBUGON, logfile, options.dirlist)
@@ -262,29 +231,28 @@ import os.path
 logdir = os.path.dirname(logfile)
 pidlist = [0] * dirlen * 2
 for x in range(dirlen):
+	logdate = str(time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime()))
+	arch = str(platform.machine())
+	hostname = str(socket.gethostname())
+	makelog = os.path.join(logdir,logdate+'_make_'+arch+'_'+hostname)
+	o2tf.printlog('buildkernel:Main - build logfiles %s' % makelog,
+		logfile, 0, '')
+
 	wdir = dirlist[x] + '/' + str(socket.gethostname()) +'/'+ config.KERNELDIR
 	cmd = 'cd ' + wdir + '; \
 		make mrproper 1>>%s 2>&1; \
 		make defconfig 1>>%s 2>&1; \
-		/usr/bin/make -j2 V=1 1>>%s 2>&1' %  (logfile, logfile, logfile)
+		/usr/bin/make -j2 V=1 1>>%s 2>&1' %  (makelog, makelog, makelog)
 #
 	if DEBUGON:
 		o2tf.printlog('buildkernel:Main - current directory %s' % os.getcwd(),
-			logfile,
-			0,
-			'')
+			logfile, 0, '')
 		o2tf.printlog('buildkernel:Main - working directory %s' % dirlist[x],
-			logfile,
-			0,
-			'')
+			logfile, 0, '')
 		o2tf.printlog('buildkernel:Main - wdir =  %s' %  wdir,
-			logfile,
-			0,
-			'')
+			logfile, 0, '')
 		o2tf.printlog('buildkernel:Main - cmd = %s' % cmd,
-			logfile,
-			0,
-			'')
+			logfile, 0, '')
 	t1 = time.time()
 	tbuild(x, cmd)
 	cmd = 'cd ' + dirlist[x] + '/' + nodefind + '; \
diff --git a/programs/buildkernel/run_buildkernel.py b/programs/buildkernel/run_buildkernel.py
index 494713e..26bda2b 100755
--- a/programs/buildkernel/run_buildkernel.py
+++ b/programs/buildkernel/run_buildkernel.py
@@ -91,6 +91,7 @@ def Initialize():
 			options.logfile) ),
 			options.nodelist, 
 			'ssh',
+			options.interface,
 			options.logfile,
 			'WAIT')
 #
@@ -102,6 +103,7 @@ def Initialize():
 			tarfile) ),
 			options.nodelist, 
 			'ssh',
+			options.interface,
 			options.logfile,
 			'WAIT')
 	o2tf.printlog('Directories initialization completed.', logfile, 0, '')
@@ -109,10 +111,11 @@ def Initialize():
 Usage = 'Usage: %prog [-c|--count count] \
 [-d|--directorylist dirlist] \
 [-h|--help] \
-[-i|--initialize] \
+[--initialize] \
+[-i|--if <Network Interface>] \
 [-l|-logfile logfilename] \
 [-n|--nodes nodelist] \
-[-nocheck] \
+[--nocheck] \
 [-t|--tarfile fullpath tar filename] \
 [-u|--user username]'
 #
@@ -138,13 +141,18 @@ if __name__=='__main__':
 		type='string',
 		help='List of directories that will be used by the test.')
 #
-	parser.add_option('-i',
-		'--initialize', 
+	parser.add_option('--initialize', 
 		action="store_true",
 		dest='initialize',
 		default=False,
 		help='Initialize directories before each run. Default=False.')
 #
+	parser.add_option('-i', 
+		'--if', 
+		dest='interface',
+		type='string',
+		help='Network interface to be used by the test.')
+#
 	parser.add_option('-l', 
 		'--logfile', 
 		dest='logfile',
@@ -187,6 +195,7 @@ if __name__=='__main__':
 	else:
 		nodelist = options.nodelist.split(',')
 	logfile = options.logfile
+	interface = options.interface
 	tarfile = options.tarfile
 	if nodelen > config.NPROC:
 	   nproc = nodelen
@@ -202,6 +211,7 @@ if DEBUGON:
    o2tf.printlog('run_buildkernel: dirlist = (%s)' % dirlist, logfile, 0, '')
    o2tf.printlog('run_buildkernel: dirlen = (%s)' % dirlen, logfile, 0, '')
    o2tf.printlog('run_buildkernel: nodelist = (%s)' % nodelist, logfile, 0, '')
+   o2tf.printlog('run_buildkernel: interface = (%s)' % interface, logfile, 0, '')
    o2tf.printlog('run_buildkernel: nodelen = (%s)' % nodelen, logfile, 0, '')
    o2tf.printlog('run_buildkernel: logfile = (%s)' % logfile, logfile, 0, '')
    o2tf.printlog('run_buildkernel: tarfile = (%s)' % tarfile, logfile, 0, '')
@@ -224,6 +234,7 @@ for i in range(options.count):
 			options.nodelist) ), 
 			options.nodelist, 
 			'ssh',
+			options.interface,
 			options.logfile,
 			'WAIT' )
 if not ret:
-- 
1.5.6.5




More information about the Ocfs2-test-devel mailing list