autotest: fixed buildlogs location for *.BIN

This commit is contained in:
Andrew Tridgell 2014-11-13 21:52:48 +11:00
parent 7f5cc97769
commit 0d7ec0fbfe

View File

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