autotest: started adding tests for required tools

try to give useful error messages
This commit is contained in:
Andrew Tridgell 2011-11-07 20:12:51 +11:00
parent 8ac8ea9c1d
commit 4bad72f8ac
2 changed files with 26 additions and 0 deletions

View File

@ -27,6 +27,18 @@ def get_default_params(atype):
sil.close() sil.close()
print("Saved defaults for %s to %s" % (atype, dest)) print("Saved defaults for %s to %s" % (atype, dest))
def test_prerequesites():
'''check we have the right directories and tools to run tests'''
print("Testing prerequesites")
util.mkdir_p(util.reltopdir('../buildlogs'))
if not os.path.exists(util.reltopdir('../HILTest/hil_quad.py')):
print('''
You need to install HILTest in %s
You can get it from git://git.samba.org/tridge/UAV/HILTest.git
''' % util.reltopdir('../HILTest'))
############## main program ############# ############## main program #############
parser = optparse.OptionParser("autotest") parser = optparse.OptionParser("autotest")
@ -56,6 +68,8 @@ def skip_step(step):
util.kill('ArduCopter.elf') util.kill('ArduCopter.elf')
util.kill('ArduPilot.elf') util.kill('ArduPilot.elf')
test_prerequesites()
for step in steps: for step in steps:
if skip_step(step): if skip_step(step):
continue continue

View File

@ -86,3 +86,15 @@ def expect_setup_callback(e, callback):
e.expect_user_callback = callback e.expect_user_callback = callback
e.expect_saved = e.expect e.expect_saved = e.expect
e.expect = _expect_callback e.expect = _expect_callback
def mkdir_p(dir):
'''like mkdir -p'''
if not dir:
return
if dir.endswith("/"):
mkdir_p(dir[:-1])
return
if os.path.isdir(dir):
return
mkdir_p(os.path.dirname(dir))
os.mkdir(dir)