2011-10-30 23:50:34 -03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# APM automatic test suite
|
|
|
|
# Andrew Tridgell, October 2011
|
|
|
|
|
2011-12-02 00:21:15 -04:00
|
|
|
import pexpect, os, sys, shutil, atexit
|
2012-06-15 03:52:55 -03:00
|
|
|
import optparse, fnmatch, time, glob, traceback, signal
|
2011-10-30 23:50:34 -03:00
|
|
|
|
2011-12-02 00:21:15 -04:00
|
|
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pysim'))
|
2013-06-18 03:24:26 -03:00
|
|
|
|
2012-04-27 00:32:22 -03:00
|
|
|
import util
|
2011-12-02 00:21:15 -04:00
|
|
|
|
2011-11-25 23:44:07 -04:00
|
|
|
os.environ['PYTHONUNBUFFERED'] = '1'
|
|
|
|
|
2011-11-01 08:31:01 -03:00
|
|
|
os.putenv('TMPDIR', util.reltopdir('tmp'))
|
2011-10-30 23:50:34 -03:00
|
|
|
|
|
|
|
def get_default_params(atype):
|
|
|
|
'''get default parameters'''
|
2011-11-07 07:55:21 -04:00
|
|
|
sil = util.start_SIL(atype, wipe=True)
|
2011-10-30 23:50:34 -03:00
|
|
|
mavproxy = util.start_MAVProxy_SIL(atype)
|
2011-11-26 03:12:19 -04:00
|
|
|
print("Dumping defaults")
|
2011-10-30 23:50:34 -03:00
|
|
|
idx = mavproxy.expect(['Please Run Setup', 'Saved [0-9]+ parameters to (\S+)'])
|
|
|
|
if idx == 0:
|
|
|
|
# we need to restart it after eeprom erase
|
2011-11-09 00:45:18 -04:00
|
|
|
util.pexpect_close(mavproxy)
|
|
|
|
util.pexpect_close(sil)
|
2011-10-30 23:50:34 -03:00
|
|
|
sil = util.start_SIL(atype)
|
|
|
|
mavproxy = util.start_MAVProxy_SIL(atype)
|
|
|
|
idx = mavproxy.expect('Saved [0-9]+ parameters to (\S+)')
|
|
|
|
parmfile = mavproxy.match.group(1)
|
2013-09-22 19:48:01 -03:00
|
|
|
dest = util.reltopdir('../buildlogs/%s-defaults.parm' % atype)
|
2011-10-30 23:50:34 -03:00
|
|
|
shutil.copy(parmfile, dest)
|
2011-11-09 00:45:18 -04:00
|
|
|
util.pexpect_close(mavproxy)
|
|
|
|
util.pexpect_close(sil)
|
2011-10-30 23:50:34 -03:00
|
|
|
print("Saved defaults for %s to %s" % (atype, dest))
|
2011-11-09 01:15:53 -04:00
|
|
|
return True
|
2011-11-07 07:55:21 -04:00
|
|
|
|
2012-02-19 02:05:21 -04:00
|
|
|
def build_all():
|
|
|
|
'''run the build_all.sh script'''
|
|
|
|
print("Running build_all.sh")
|
2012-02-19 18:16:57 -04:00
|
|
|
if util.run_cmd(util.reltopdir('Tools/scripts/build_all.sh'), dir=util.reltopdir('.')) != 0:
|
2012-02-19 02:05:21 -04:00
|
|
|
print("Failed build_all.sh")
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2013-03-10 03:16:56 -03:00
|
|
|
def build_binaries():
|
|
|
|
'''run the build_binaries.sh script'''
|
|
|
|
print("Running build_binaries.sh")
|
2013-03-23 00:54:53 -03:00
|
|
|
import shutil
|
|
|
|
# copy the script as it changes git branch, which can change the script while running
|
|
|
|
orig=util.reltopdir('Tools/scripts/build_binaries.sh')
|
|
|
|
copy=util.reltopdir('./build_binaries.sh')
|
|
|
|
shutil.copyfile(orig, copy)
|
|
|
|
shutil.copymode(orig, copy)
|
|
|
|
if util.run_cmd(copy, dir=util.reltopdir('.')) != 0:
|
2013-03-10 03:16:56 -03:00
|
|
|
print("Failed build_binaries.sh")
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2012-11-24 06:12:05 -04:00
|
|
|
def build_examples():
|
|
|
|
'''run the build_examples.sh script'''
|
|
|
|
print("Running build_examples.sh")
|
|
|
|
if util.run_cmd(util.reltopdir('Tools/scripts/build_examples.sh'), dir=util.reltopdir('.')) != 0:
|
|
|
|
print("Failed build_examples.sh")
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2013-05-21 04:01:59 -03:00
|
|
|
def build_parameters():
|
|
|
|
'''run the param_parse.py script'''
|
|
|
|
print("Running param_parse.py")
|
|
|
|
if util.run_cmd(util.reltopdir('Tools/autotest/param_metadata/param_parse.py'), dir=util.reltopdir('.')) != 0:
|
|
|
|
print("Failed param_parse.py")
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
2012-02-19 02:05:21 -04:00
|
|
|
|
2011-11-09 05:27:00 -04:00
|
|
|
def convert_gpx():
|
2013-04-28 02:01:31 -03:00
|
|
|
'''convert any tlog files to GPX and KML'''
|
2011-11-09 05:27:00 -04:00
|
|
|
import glob
|
2013-04-28 02:01:31 -03:00
|
|
|
mavlog = glob.glob(util.reltopdir("../buildlogs/*.tlog"))
|
2011-11-09 05:27:00 -04:00
|
|
|
for m in mavlog:
|
2013-06-16 20:27:35 -03:00
|
|
|
util.run_cmd(util.reltopdir("../mavlink/pymavlink/tools/mavtogpx.py") + " --nofixcheck " + m)
|
2011-11-09 05:27:00 -04:00
|
|
|
gpx = m + '.gpx'
|
|
|
|
kml = m + '.kml'
|
2011-11-12 19:11:25 -04:00
|
|
|
util.run_cmd('gpsbabel -i gpx -f %s -o kml,units=m,floating=1,extrude=1 -F %s' % (gpx, kml), checkfail=False)
|
2011-11-13 15:37:58 -04:00
|
|
|
util.run_cmd('zip %s.kmz %s.kml' % (m, m), checkfail=False)
|
2013-11-22 06:03:31 -04:00
|
|
|
util.run_cmd("mavflightview.py --imagefile=%s.png %s" % (m,m))
|
2011-11-09 05:27:00 -04:00
|
|
|
return True
|
|
|
|
|
|
|
|
|
2011-11-07 05:12:51 -04:00
|
|
|
def test_prerequesites():
|
|
|
|
'''check we have the right directories and tools to run tests'''
|
|
|
|
print("Testing prerequesites")
|
|
|
|
util.mkdir_p(util.reltopdir('../buildlogs'))
|
2011-11-09 01:15:53 -04:00
|
|
|
return True
|
2011-11-12 19:11:25 -04:00
|
|
|
|
2012-06-15 03:52:55 -03:00
|
|
|
def alarm_handler(signum, frame):
|
|
|
|
'''handle test timeout'''
|
|
|
|
global results, opts
|
|
|
|
try:
|
|
|
|
results.add('TIMEOUT', '<span class="failed-text">FAILED</span>', opts.timeout)
|
2012-06-15 17:47:55 -03:00
|
|
|
util.pexpect_close_all()
|
2012-07-09 20:13:16 -03:00
|
|
|
convert_gpx()
|
2013-07-08 19:48:17 -03:00
|
|
|
write_fullresults()
|
2012-06-15 03:52:55 -03:00
|
|
|
os.killpg(0, signal.SIGKILL)
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
sys.exit(1)
|
2011-10-30 23:50:34 -03:00
|
|
|
|
|
|
|
############## main program #############
|
|
|
|
parser = optparse.OptionParser("autotest")
|
|
|
|
parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
|
|
|
|
parser.add_option("--list", action='store_true', default=False, help='list the available steps')
|
2011-11-13 03:33:31 -04:00
|
|
|
parser.add_option("--viewerip", default=None, help='IP address to send MAVLink and fg packets to')
|
2013-05-02 07:03:36 -03:00
|
|
|
parser.add_option("--map", action='store_true', default=False, help='show map')
|
2011-11-13 06:20:29 -04:00
|
|
|
parser.add_option("--experimental", default=False, action='store_true', help='enable experimental tests')
|
2013-03-12 18:23:41 -03:00
|
|
|
parser.add_option("--timeout", default=3000, type='int', help='maximum runtime in seconds')
|
2011-10-30 23:50:34 -03:00
|
|
|
|
|
|
|
opts, args = parser.parse_args()
|
|
|
|
|
2012-11-27 19:43:11 -04:00
|
|
|
import arducopter, arduplane, apmrover2
|
2012-04-27 00:32:22 -03:00
|
|
|
|
2011-10-30 23:50:34 -03:00
|
|
|
steps = [
|
2011-11-09 01:15:53 -04:00
|
|
|
'prerequesites',
|
2012-02-19 02:05:21 -04:00
|
|
|
'build.All',
|
2013-03-10 03:16:56 -03:00
|
|
|
'build.Binaries',
|
2012-11-24 06:12:05 -04:00
|
|
|
'build.Examples',
|
2013-05-21 04:01:59 -03:00
|
|
|
'build.Parameters',
|
2012-11-27 19:43:11 -04:00
|
|
|
|
|
|
|
'build2560.ArduPlane',
|
2011-10-30 23:50:34 -03:00
|
|
|
'build.ArduPlane',
|
|
|
|
'defaults.ArduPlane',
|
2011-11-12 07:13:17 -04:00
|
|
|
'fly.ArduPlane',
|
2012-11-27 19:43:11 -04:00
|
|
|
|
|
|
|
'build2560.APMrover2',
|
|
|
|
'build.APMrover2',
|
|
|
|
'defaults.APMrover2',
|
|
|
|
'drive.APMrover2',
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
'build2560.ArduCopter',
|
2011-11-07 07:55:21 -04:00
|
|
|
'build.ArduCopter',
|
2011-10-30 23:50:34 -03:00
|
|
|
'defaults.ArduCopter',
|
2011-11-07 07:55:21 -04:00
|
|
|
'fly.ArduCopter',
|
2013-05-29 02:33:32 -03:00
|
|
|
'fly.CopterAVC',
|
2012-11-27 19:43:11 -04:00
|
|
|
|
2011-11-09 05:27:00 -04:00
|
|
|
'convertgpx',
|
2011-10-30 23:50:34 -03:00
|
|
|
]
|
|
|
|
|
|
|
|
skipsteps = opts.skip.split(',')
|
|
|
|
|
2012-06-15 03:52:55 -03:00
|
|
|
# ensure we catch timeouts
|
|
|
|
signal.signal(signal.SIGALRM, alarm_handler)
|
|
|
|
signal.alarm(opts.timeout)
|
|
|
|
|
2012-12-21 23:50:32 -04:00
|
|
|
if opts.list:
|
|
|
|
for step in steps:
|
|
|
|
print(step)
|
|
|
|
sys.exit(0)
|
|
|
|
|
2011-10-30 23:50:34 -03:00
|
|
|
def skip_step(step):
|
|
|
|
'''see if a step should be skipped'''
|
|
|
|
for skip in skipsteps:
|
2012-11-29 03:09:44 -04:00
|
|
|
if fnmatch.fnmatch(step.lower(), skip.lower()):
|
2011-10-30 23:50:34 -03:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
def run_step(step):
|
|
|
|
'''run one step'''
|
|
|
|
if step == "prerequesites":
|
|
|
|
return test_prerequesites()
|
|
|
|
|
|
|
|
if step == 'build.ArduPlane':
|
|
|
|
return util.build_SIL('ArduPlane')
|
|
|
|
|
2012-11-27 19:43:11 -04:00
|
|
|
if step == 'build.APMrover2':
|
|
|
|
return util.build_SIL('APMrover2')
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
if step == 'build.ArduCopter':
|
|
|
|
return util.build_SIL('ArduCopter')
|
|
|
|
|
|
|
|
if step == 'build2560.ArduCopter':
|
|
|
|
return util.build_AVR('ArduCopter', board='mega2560')
|
|
|
|
|
|
|
|
if step == 'build2560.ArduPlane':
|
|
|
|
return util.build_AVR('ArduPlane', board='mega2560')
|
|
|
|
|
2012-11-27 19:43:11 -04:00
|
|
|
if step == 'build2560.APMrover2':
|
|
|
|
return util.build_AVR('APMrover2', board='mega2560')
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
if step == 'defaults.ArduPlane':
|
|
|
|
return get_default_params('ArduPlane')
|
|
|
|
|
|
|
|
if step == 'defaults.ArduCopter':
|
|
|
|
return get_default_params('ArduCopter')
|
|
|
|
|
2012-11-27 19:43:11 -04:00
|
|
|
if step == 'defaults.APMrover2':
|
|
|
|
return get_default_params('APMrover2')
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
if step == 'fly.ArduCopter':
|
2013-05-02 07:03:36 -03:00
|
|
|
return arducopter.fly_ArduCopter(viewerip=opts.viewerip, map=opts.map)
|
2011-11-09 01:15:53 -04:00
|
|
|
|
2013-05-29 02:33:32 -03:00
|
|
|
if step == 'fly.CopterAVC':
|
|
|
|
return arducopter.fly_CopterAVC(viewerip=opts.viewerip, map=opts.map)
|
|
|
|
|
2011-11-12 07:13:17 -04:00
|
|
|
if step == 'fly.ArduPlane':
|
2013-05-02 07:03:36 -03:00
|
|
|
return arduplane.fly_ArduPlane(viewerip=opts.viewerip, map=opts.map)
|
2011-11-12 07:13:17 -04:00
|
|
|
|
2012-11-27 19:43:11 -04:00
|
|
|
if step == 'drive.APMrover2':
|
2013-05-02 07:03:36 -03:00
|
|
|
return apmrover2.drive_APMrover2(viewerip=opts.viewerip, map=opts.map)
|
2012-11-27 19:43:11 -04:00
|
|
|
|
2012-02-19 02:05:21 -04:00
|
|
|
if step == 'build.All':
|
|
|
|
return build_all()
|
|
|
|
|
2013-03-10 03:16:56 -03:00
|
|
|
if step == 'build.Binaries':
|
|
|
|
return build_binaries()
|
|
|
|
|
2012-11-24 06:12:05 -04:00
|
|
|
if step == 'build.Examples':
|
|
|
|
return build_examples()
|
|
|
|
|
2013-05-21 04:01:59 -03:00
|
|
|
if step == 'build.Parameters':
|
|
|
|
return build_parameters()
|
|
|
|
|
2011-11-09 05:27:00 -04:00
|
|
|
if step == 'convertgpx':
|
|
|
|
return convert_gpx()
|
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
raise RuntimeError("Unknown step %s" % step)
|
|
|
|
|
2011-11-09 08:25:08 -04:00
|
|
|
class TestResult(object):
|
|
|
|
'''test result class'''
|
|
|
|
def __init__(self, name, result, elapsed):
|
|
|
|
self.name = name
|
|
|
|
self.result = result
|
|
|
|
self.elapsed = "%.1f" % elapsed
|
|
|
|
|
|
|
|
class TestFile(object):
|
|
|
|
'''test result file'''
|
|
|
|
def __init__(self, name, fname):
|
|
|
|
self.name = name
|
|
|
|
self.fname = fname
|
|
|
|
|
|
|
|
class TestResults(object):
|
|
|
|
'''test results class'''
|
|
|
|
def __init__(self):
|
|
|
|
self.date = time.asctime()
|
2012-02-13 18:06:24 -04:00
|
|
|
self.githash = util.run_cmd('git rev-parse HEAD', output=True, dir=util.reltopdir('.')).strip()
|
2011-11-09 08:25:08 -04:00
|
|
|
self.tests = []
|
|
|
|
self.files = []
|
2013-05-05 23:32:42 -03:00
|
|
|
self.images = []
|
2011-11-09 08:25:08 -04:00
|
|
|
|
|
|
|
def add(self, name, result, elapsed):
|
|
|
|
'''add a result'''
|
|
|
|
self.tests.append(TestResult(name, result, elapsed))
|
|
|
|
|
|
|
|
def addfile(self, name, fname):
|
|
|
|
'''add a result file'''
|
|
|
|
self.files.append(TestFile(name, fname))
|
|
|
|
|
2013-05-05 23:32:42 -03:00
|
|
|
def addimage(self, name, fname):
|
|
|
|
'''add a result image'''
|
|
|
|
self.images.append(TestFile(name, fname))
|
|
|
|
|
2011-11-09 08:25:08 -04:00
|
|
|
def addglob(self, name, pattern):
|
|
|
|
'''add a set of files'''
|
|
|
|
import glob
|
|
|
|
for f in glob.glob(util.reltopdir('../buildlogs/%s' % pattern)):
|
|
|
|
self.addfile(name, os.path.basename(f))
|
|
|
|
|
2013-05-05 23:32:42 -03:00
|
|
|
def addglobimage(self, name, pattern):
|
|
|
|
'''add a set of images'''
|
|
|
|
import glob
|
|
|
|
for f in glob.glob(util.reltopdir('../buildlogs/%s' % pattern)):
|
|
|
|
self.addimage(name, os.path.basename(f))
|
|
|
|
|
2011-11-09 08:25:08 -04:00
|
|
|
|
|
|
|
|
|
|
|
def write_webresults(results):
|
|
|
|
'''write webpage results'''
|
2013-08-29 01:20:16 -03:00
|
|
|
from pymavlink.generator import mavtemplate
|
2011-11-09 08:25:08 -04:00
|
|
|
t = mavtemplate.MAVTemplate()
|
2011-11-09 09:23:46 -04:00
|
|
|
for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
|
|
|
|
html = util.loadfile(h)
|
|
|
|
f = open(util.reltopdir("../buildlogs/%s" % os.path.basename(h)), mode='w')
|
|
|
|
t.write(f, html, results)
|
|
|
|
f.close()
|
2011-11-09 09:31:50 -04:00
|
|
|
for f in glob.glob(util.reltopdir('Tools/autotest/web/*.png')):
|
|
|
|
shutil.copy(f, util.reltopdir('../buildlogs/%s' % os.path.basename(f)))
|
2011-11-09 08:25:08 -04:00
|
|
|
|
2013-07-08 19:48:17 -03:00
|
|
|
def write_fullresults():
|
|
|
|
'''write out full results set'''
|
|
|
|
global results
|
|
|
|
results.addglob("Google Earth track", '*.kmz')
|
|
|
|
results.addfile('Full Logs', 'autotest-output.txt')
|
2013-12-28 06:47:12 -04:00
|
|
|
results.addglob('DataFlash Log', '*-log.bin')
|
2013-07-08 19:48:17 -03:00
|
|
|
results.addglob("MAVLink log", '*.tlog')
|
|
|
|
results.addglob("GPX track", '*.gpx')
|
|
|
|
results.addfile('ArduPlane build log', 'ArduPlane.txt')
|
|
|
|
results.addfile('ArduPlane code size', 'ArduPlane.sizes.txt')
|
|
|
|
results.addfile('ArduPlane stack sizes', 'ArduPlane.framesizes.txt')
|
2013-09-22 19:48:01 -03:00
|
|
|
results.addfile('ArduPlane defaults', 'ArduPlane-defaults.parm')
|
2013-07-08 19:48:17 -03:00
|
|
|
results.addfile('ArduCopter build log', 'ArduCopter.txt')
|
|
|
|
results.addfile('ArduCopter code size', 'ArduCopter.sizes.txt')
|
|
|
|
results.addfile('ArduCopter stack sizes', 'ArduCopter.framesizes.txt')
|
2013-09-22 19:48:01 -03:00
|
|
|
results.addfile('ArduCopter defaults', 'ArduCopter-defaults.parm')
|
2013-07-08 19:48:17 -03:00
|
|
|
results.addfile('APMrover2 build log', 'APMrover2.txt')
|
|
|
|
results.addfile('APMrover2 code size', 'APMrover2.sizes.txt')
|
|
|
|
results.addfile('APMrover2 stack sizes', 'APMrover2.framesizes.txt')
|
2013-09-22 19:48:01 -03:00
|
|
|
results.addfile('APMrover2 defaults', 'APMrover2-defaults.parm')
|
2013-08-14 20:08:08 -03:00
|
|
|
results.addglob('APM:Libraries documentation', 'docs/libraries/index.html')
|
|
|
|
results.addglob('APM:Plane documentation', 'docs/ArduPlane/index.html')
|
|
|
|
results.addglob('APM:Copter documentation', 'docs/ArduCopter/index.html')
|
|
|
|
results.addglob('APM:Rover documentation', 'docs/APMrover2/index.html')
|
2013-07-08 19:48:17 -03:00
|
|
|
results.addglobimage("Flight Track", '*.png')
|
|
|
|
|
|
|
|
write_webresults(results)
|
|
|
|
|
2011-11-09 08:25:08 -04:00
|
|
|
|
2012-06-15 03:52:55 -03:00
|
|
|
results = TestResults()
|
2011-11-09 01:15:53 -04:00
|
|
|
|
2011-11-09 00:45:18 -04:00
|
|
|
def run_tests(steps):
|
|
|
|
'''run a list of steps'''
|
2012-06-15 03:52:55 -03:00
|
|
|
global results
|
2011-11-09 08:25:08 -04:00
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
passed = True
|
2011-11-09 02:16:20 -04:00
|
|
|
failed = []
|
2011-11-09 00:45:18 -04:00
|
|
|
for step in steps:
|
2011-12-02 00:21:15 -04:00
|
|
|
util.pexpect_close_all()
|
2011-11-09 00:45:18 -04:00
|
|
|
if skip_step(step):
|
|
|
|
continue
|
2011-11-09 01:15:53 -04:00
|
|
|
|
2011-11-09 08:25:08 -04:00
|
|
|
t1 = time.time()
|
2011-11-09 01:15:53 -04:00
|
|
|
print(">>>> RUNNING STEP: %s at %s" % (step, time.asctime()))
|
|
|
|
try:
|
|
|
|
if not run_step(step):
|
|
|
|
print(">>>> FAILED STEP: %s at %s" % (step, time.asctime()))
|
|
|
|
passed = False
|
2011-11-09 02:16:20 -04:00
|
|
|
failed.append(step)
|
2011-11-09 23:37:52 -04:00
|
|
|
results.add(step, '<span class="failed-text">FAILED</span>', time.time() - t1)
|
2011-11-09 01:15:53 -04:00
|
|
|
continue
|
|
|
|
except Exception, msg:
|
|
|
|
passed = False
|
2011-11-09 02:16:20 -04:00
|
|
|
failed.append(step)
|
2011-11-09 01:15:53 -04:00
|
|
|
print(">>>> FAILED STEP: %s at %s (%s)" % (step, time.asctime(), msg))
|
2011-11-09 08:43:25 -04:00
|
|
|
traceback.print_exc(file=sys.stdout)
|
2011-11-09 23:37:52 -04:00
|
|
|
results.add(step, '<span class="failed-text">FAILED</span>', time.time() - t1)
|
2011-11-25 23:44:07 -04:00
|
|
|
continue
|
2011-11-09 23:37:52 -04:00
|
|
|
results.add(step, '<span class="passed-text">PASSED</span>', time.time() - t1)
|
2011-11-09 01:15:53 -04:00
|
|
|
print(">>>> PASSED STEP: %s at %s" % (step, time.asctime()))
|
2011-11-09 02:16:20 -04:00
|
|
|
if not passed:
|
|
|
|
print("FAILED %u tests: %s" % (len(failed), failed))
|
2011-11-09 08:25:08 -04:00
|
|
|
|
2011-12-02 00:21:15 -04:00
|
|
|
util.pexpect_close_all()
|
|
|
|
|
2013-07-08 19:48:17 -03:00
|
|
|
write_fullresults()
|
2011-11-09 08:25:08 -04:00
|
|
|
|
2011-11-09 01:15:53 -04:00
|
|
|
return passed
|
2011-11-09 00:45:18 -04:00
|
|
|
|
2011-11-09 08:53:09 -04:00
|
|
|
|
2013-04-14 04:16:30 -03:00
|
|
|
util.mkdir_p(util.reltopdir('../buildlogs'))
|
|
|
|
|
2011-11-09 08:53:09 -04:00
|
|
|
lck = util.lock_file(util.reltopdir('../buildlogs/autotest.lck'))
|
|
|
|
if lck is None:
|
|
|
|
print("autotest is locked - exiting")
|
|
|
|
sys.exit(0)
|
|
|
|
|
2011-12-02 00:21:15 -04:00
|
|
|
atexit.register(util.pexpect_close_all)
|
|
|
|
|
2012-11-29 03:09:44 -04:00
|
|
|
if len(args) > 0:
|
|
|
|
# allow a wildcard list of steps
|
|
|
|
matched = []
|
|
|
|
for a in args:
|
|
|
|
for s in steps:
|
|
|
|
if fnmatch.fnmatch(s.lower(), a.lower()):
|
|
|
|
matched.append(s)
|
|
|
|
steps = matched
|
|
|
|
|
2011-11-09 00:45:18 -04:00
|
|
|
try:
|
2011-11-09 01:15:53 -04:00
|
|
|
if not run_tests(steps):
|
|
|
|
sys.exit(1)
|
2011-11-09 00:45:18 -04:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
util.pexpect_close_all()
|
2011-11-09 01:15:53 -04:00
|
|
|
sys.exit(1)
|
2011-11-09 00:45:18 -04:00
|
|
|
except Exception:
|
|
|
|
# make sure we kill off any children
|
|
|
|
util.pexpect_close_all()
|
|
|
|
raise
|