ABAT: handle adding the root device to the kernel command line

When booting we need to tell the kernel where root is.  When
booting a new kernel this will always be the current root device.
Discover and add this when booting a kernel.

Signed-off-by: Andy Whitcroft <[email protected]>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@494 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/harness_ABAT.py b/client/bin/harness_ABAT.py
index 3ae1bee..08f0ca9 100755
--- a/client/bin/harness_ABAT.py
+++ b/client/bin/harness_ABAT.py
@@ -60,6 +60,18 @@
 			self.status.flush()
 
 
+	def __root_device(self):
+		fd = open("/proc/mounts", "r")
+		try: 
+			for line in fd.readlines():
+				words = line.split(' ')
+				if words[0] != 'rootfs' and words[1] == '/':
+					return words[0]
+			return None
+		finally:
+			fd.close()
+		
+
 	def run_start(self):
 		"""A run within this job is starting"""
 		self.__send("STATUS GOOD run starting")
@@ -84,6 +96,9 @@
 
 		if args:
 			args = re.sub(r'autobench_args:.*', '', args)
+			args = re.sub(r'root=\S*', '', args)
+			args += " root=" + self.__root_device()
+
 			self.job.config_set('boot.default_args', args)