autotest: use buildlogs directory consistently

This commit is contained in:
Andrew Tridgell 2015-05-11 08:37:49 +10:00
parent aaff670ec4
commit 068b862888

View File

@ -37,7 +37,7 @@ def get_default_params(atype):
mavproxy = util.start_MAVProxy_SIL(atype)
idx = mavproxy.expect('Saved [0-9]+ parameters to (\S+)')
parmfile = mavproxy.match.group(1)
dest = 'buildlogs/%s-defaults.parm' % atype
dest = util.reltopdir('../buildlogs/%s-defaults.parm' % atype)
shutil.copy(parmfile, dest)
util.pexpect_close(mavproxy)
util.pexpect_close(sil)
@ -100,7 +100,7 @@ def build_parameters():
def convert_gpx():
'''convert any tlog files to GPX and KML'''
import glob
mavlog = glob.glob("buildlogs/*.tlog")
mavlog = glob.glob(util.reltopdir("../buildlogs/*.tlog"))
for m in mavlog:
util.run_cmd(util.reltopdir("../mavlink/pymavlink/tools/mavtogpx.py") + " --nofixcheck " + m)
gpx = m + '.gpx'
@ -114,7 +114,7 @@ def convert_gpx():
def test_prerequisites():
'''check we have the right directories and tools to run tests'''
print("Testing prerequisites")
util.mkdir_p('buildlogs')
util.mkdir_p(util.reltopdir('../buildlogs'))
return True
def alarm_handler(signum, frame):
@ -282,13 +282,13 @@ class TestResults(object):
def addglob(self, name, pattern):
'''add a set of files'''
import glob
for f in glob.glob('buildlogs/%s' % pattern):
for f in glob.glob(util.reltopdir('../buildlogs/%s' % pattern)):
self.addfile(name, os.path.basename(f))
def addglobimage(self, name, pattern):
'''add a set of images'''
import glob
for f in glob.glob('buildlogs/%s' % pattern):
for f in glob.glob(util.reltopdir('../buildlogs/%s' % pattern)):
self.addimage(name, os.path.basename(f))
@ -299,11 +299,11 @@ def write_webresults(results):
t = mavtemplate.MAVTemplate()
for h in glob.glob(util.reltopdir('Tools/autotest/web/*.html')):
html = util.loadfile(h)
f = open("buildlogs/%s" % os.path.basename(h), mode='w')
f = open(util.reltopdir("../buildlogs/%s" % os.path.basename(h)), mode='w')
t.write(f, html, results)
f.close()
for f in glob.glob(util.reltopdir('Tools/autotest/web/*.png')):
shutil.copy(f, 'buildlogs/%s' % os.path.basename(f))
shutil.copy(f, util.reltopdir('../buildlogs/%s' % os.path.basename(f)))
def write_fullresults():
'''write out full results set'''
@ -359,13 +359,13 @@ def check_logs(step):
logs = glob.glob("logs/*.BIN")
for log in logs:
bname = os.path.basename(log)
newname = "buildlogs/%s-%s" % (vehicle, bname)
newname = util.reltopdir("../buildlogs/%s-%s" % (vehicle, bname))
print("Renaming %s to %s" % (log, newname))
os.rename(log, newname)
corefile = "core"
if os.path.exists(corefile):
newname = "buildlogs/%s.core" % vehicle
newname = util.reltopdir("../buildlogs/%s.core" % vehicle)
print("Renaming %s to %s" % (corefile, newname))
os.rename(corefile, newname)
util.run_cmd('/bin/cp A*/A*.elf ../buildlogs', dir=util.reltopdir('.'))
@ -411,9 +411,9 @@ def run_tests(steps):
return passed
util.mkdir_p('buildlogs')
util.mkdir_p(util.reltopdir('../buildlogs'))
lck = util.lock_file('buildlogs/autotest.lck')
lck = util.lock_file(util.reltopdir('../buildlogs/autotest.lck'))
if lck is None:
print("autotest is locked - exiting")
sys.exit(0)