tests add real sequence testing

Add the core of a self test suite.  Add a bunch of tests for sequencing
confirmation.  Specifically test basic ordering, parallel ordering and
stepper progression both simple and in the face of boot'ing.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@21 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/bin/tests/selftest.py b/bin/tests/selftest.py
new file mode 100644
index 0000000..f77bd82
--- /dev/null
+++ b/bin/tests/selftest.py
@@ -0,0 +1,30 @@
+import test
+from autotest_utils import *
+from error import *
+
+class selftest(test.test):
+	def setup(self):
+		name = self.job.resultdir + '/sequence'
+		if (not os.path.exists(name)):
+			fd = file(name, 'w')
+			fd.write('0')
+			fd.close()
+	
+	def execute(self, checkpoint):
+		name = self.job.resultdir + '/sequence'
+		fd = file(name, 'r')
+		current = int(fd.readline())
+		fd.close()
+
+		current += 1
+		fd = file(name + '.new', 'w')
+		fd.write('%d' % current)
+		fd.close()
+
+		os.rename(name + '.new', name)
+
+		print "checkpoint %d %d" % (current, checkpoint)
+
+		if (current != checkpoint):
+			raise JobError("selftest: sequence was " +
+				"%d when %d expected" % (current, checkpoint))