blob: f77bd8258ea8e644692e5391ed9001a5f4b9f37d [file] [log] [blame]
apw6e551622006-04-04 08:50:53 +00001import test
2from autotest_utils import *
3from error import *
4
5class selftest(test.test):
6 def setup(self):
7 name = self.job.resultdir + '/sequence'
8 if (not os.path.exists(name)):
9 fd = file(name, 'w')
10 fd.write('0')
11 fd.close()
12
13 def execute(self, checkpoint):
14 name = self.job.resultdir + '/sequence'
15 fd = file(name, 'r')
16 current = int(fd.readline())
17 fd.close()
18
19 current += 1
20 fd = file(name + '.new', 'w')
21 fd.write('%d' % current)
22 fd.close()
23
24 os.rename(name + '.new', name)
25
26 print "checkpoint %d %d" % (current, checkpoint)
27
28 if (current != checkpoint):
29 raise JobError("selftest: sequence was " +
30 "%d when %d expected" % (current, checkpoint))