| #!/usr/bin/python |
| # |
| # autotest <control file> - run the autotest control file specified. |
| # |
| import os, sys, shutil |
| import job, kernel, test |
| from error import * |
| from autotest_utils import * |
| from optparse import OptionParser |
| |
| check_python_version() |
| |
| # Use the name of the binary to find the real installation directory |
| # aka $AUTODIR. Update our path to include the $AUTODIR/bin/tests |
| # directory and ensure we have $AUTODIR in our environment. |
| autodirbin = os.path.abspath(os.path.dirname(sys.argv[0])) |
| autodir = os.path.dirname(autodirbin) |
| |
| ##print 'AUTODIRBIN: ' + autodirbin |
| ##print 'AUTODIR: ' + autodir |
| |
| sys.path.insert(0, autodirbin) |
| |
| os.environ['AUTODIR'] = autodir |
| os.environ['AUTODIRBIN'] = autodirbin |
| os.environ['PYTHONPATH'] = autodirbin |
| |
| parser = OptionParser() |
| |
| parser.add_option("-c", "--continue", dest="cont", action="store_true", |
| default=False, help="continue previously started job") |
| |
| parser.add_option("-t", "--tag", dest="tag", type="string", default="default", |
| help="set the job tag") |
| |
| def usage(): |
| parser.print_help() |
| sys.exit(1) |
| |
| options, args = parser.parse_args() |
| |
| # Check for a control file. |
| if len(args) != 1: |
| usage() |
| |
| # JOB: run the specified job control file. |
| job.runjob(args[0], options.cont, options.tag) |