Add the version 1 of the TKO parser, modify server_job to use this
version, and modify parse.py to look up the status version number
in order to instantiate the correct parser version.

Basically, it's an implementation of the parser that follows
the spec as outlined in
http://test.kernel.org/autotest/DraftParserSpecification. I did that
by implementing the "version 1" parser, as opposed to the existing
"version 0" parser, and it also adds some code to autotest itself to
log the fact that the status logs being written out follow the
"version 1" specification, so that when re-parsing existing results
older logs will still be parsed using the old (rather ad-hoc and
difficult to follow) algorithm.

The implementation is fairly similar to the existing version 0
implementation; it still uses all the same files for gathering
results, but there are the core changes:
- instead of grabbing kernel information from build.log, it gets
embedded into the status logs associated with reboots
- if a group is lacking a proper "END" section it implicitly assumes
it was somehow aborted
- reboots are wrapped in a group
- a "JOB" result is logged even if nothing bad happens (rather than
only logging it when something bad happens)
- you can have arbitrarily large amounts of group nesting

Signed-off-by: John Admanski <jadmanski@google.com>




git-svn-id: http://test.kernel.org/svn/autotest/trunk@1511 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/status_lib_unittest.py b/tko/status_lib_unittest.py
index a6a74dc..e8c15f2 100644
--- a/tko/status_lib_unittest.py
+++ b/tko/status_lib_unittest.py
@@ -30,6 +30,22 @@
 		self.assertEquals(lines, results)
 
 
+	def test_put_multiple_same_as_multiple_puts(self):
+		buf_put, buf_multi = [status_lib.line_buffer()
+				      for x in xrange(2)]
+		lines = ["line #%d" % x for x in xrange(10)]
+		for line in lines:
+			buf_put.put(line)
+		buf_multi.put_multiple(lines)
+		counter = 0
+		while buf_put.size():
+			self.assertEquals(buf_put.size(), buf_multi.size())
+			line = "line #%d" % counter
+			self.assertEquals(buf_put.get(), line)
+			self.assertEquals(buf_multi.get(), line)
+			counter += 1
+
+
 	def test_put_back_is_lifo(self):
 		buf = status_lib.line_buffer()
 		lines = ["1", "2", "3"]
@@ -147,7 +163,7 @@
 
 
 class parser_test(unittest.TestCase):
-	available_versions = [0]
+	available_versions = [0, 1]
 	def test_can_import_available_versions(self):
 		for version in self.available_versions:
 			p = status_lib.parser(0)