autotest revision 8a17e7caeb8ae95e41b239c009b32de183fccd56
1#!/usr/bin/python -u 2# 3# autotest <control file> - run the autotest control file specified. 4# 5import os, sys, shutil 6import common 7from optparse import OptionParser 8from autotest_lib.client.bin import job 9 10 11# Use the name of the binary to find the real installation directory 12# aka $AUTODIR. Update our path to include the $AUTODIR/bin/tests 13# directory and ensure we have $AUTODIR in our environment. 14autodirbin = os.path.dirname(os.path.realpath(sys.argv[0])) 15autodir = os.path.dirname(autodirbin) 16 17##print 'AUTODIRBIN: ' + autodirbin 18##print 'AUTODIR: ' + autodir 19 20sys.path.insert(0, autodirbin) 21 22os.environ['AUTODIR'] = autodir 23os.environ['AUTODIRBIN'] = autodirbin 24os.environ['PYTHONPATH'] = autodirbin 25 26parser = OptionParser() 27 28parser.add_option("-c", "--continue", dest="cont", action="store_true", 29 default=False, help="continue previously started job") 30 31parser.add_option("-t", "--tag", dest="tag", type="string", default="default", 32 help="set the job tag") 33 34parser.add_option("-H", "--harness", dest="harness", type="string", default='', 35 help="set the harness type") 36 37parser.add_option("-l", "--external_logging", dest="log", action="store_true", 38 default=False, help="enable external logging") 39 40def usage(): 41 parser.print_help() 42 sys.exit(1) 43 44options, args = parser.parse_args() 45 46# Check for a control file. 47if len(args) != 1: 48 usage() 49 50# JOB: run the specified job control file. 51job.runjob(os.path.realpath(args[0]), options.cont, options.tag, options.harness, 52 options.log) 53