mbligh | 7c8ea99 | 2009-06-22 19:03:08 +0000 | [diff] [blame^] | 1 | #!/usr/bin/python |
mbligh | 279346a | 2007-07-27 01:04:27 +0000 | [diff] [blame] | 2 | import sys,os |
mbligh | feb25f1 | 2007-07-24 19:01:05 +0000 | [diff] [blame] | 3 | |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 4 | autodir = None |
| 5 | try: |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 6 | autodir = os.path.dirname(os.path.realpath('/etc/autotest.conf')) |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 7 | except: |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 8 | pass |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 9 | if not autodir: |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 10 | for path in ['/usr/local/autotest', '/home/autotest']: |
| 11 | if os.path.exists(os.path.join(path, '/bin/autotest')): |
| 12 | autodir = path |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 13 | |
mbligh | feb25f1 | 2007-07-24 19:01:05 +0000 | [diff] [blame] | 14 | autotest = os.path.join(autodir, 'bin/autotest') |
| 15 | control = os.path.join(autodir, 'control') |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 16 | state = os.path.join(autodir, 'control.state') |
mbligh | feb25f1 | 2007-07-24 19:01:05 +0000 | [diff] [blame] | 17 | |
mbligh | 8d83cdc | 2007-12-03 18:09:18 +0000 | [diff] [blame] | 18 | if len(sys.argv) == 1 or sys.argv[1] == 'start': |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 19 | if os.path.exists(state): |
| 20 | print "Restarting partially completed autotest job" |
| 21 | os.system(autotest + ' --continue ' + control) |
| 22 | else: |
| 23 | print "No autotest jobs outstanding" |