Home | History | Annotate | Download | only in tools
      1 #!/usr/bin/python
      2 import sys,os
      3 
      4 autodir = None
      5 autotest_conf = os.path.realpath('/etc/autotest.conf')
      6 
      7 if os.path.isfile(autotest_conf):
      8     autodir = os.path.dirname(autotest_conf)
      9 if not autodir:
     10     for path in ['/usr/local/autotest', '/home/autotest']:
     11         if os.path.exists(os.path.join(path, 'bin/autotest')):
     12             autodir = path
     13 
     14 if not autodir:
     15     print "Autotest home dir NOT FOUND"
     16     sys.exit()
     17 
     18 autotest = os.path.join(autodir, 'bin/autotest')
     19 control = os.path.join(autodir, 'control')
     20 state = os.path.join(autodir, 'control.state')
     21 
     22 if len(sys.argv) == 1 or sys.argv[1] == 'start':
     23     if os.path.exists(state):
     24         print "Restarting partially completed autotest job"
     25         os.system(autotest + ' --continue ' + control)
     26     else:
     27         print "No autotest jobs outstanding"
     28