diff --git a/Tools/autotest/autotest.py b/Tools/autotest/autotest.py index de645e2952..1daaceddfe 100755 --- a/Tools/autotest/autotest.py +++ b/Tools/autotest/autotest.py @@ -26,6 +26,18 @@ def get_default_params(atype): mavproxy.close() sil.close() 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 ############# @@ -56,6 +68,8 @@ def skip_step(step): util.kill('ArduCopter.elf') util.kill('ArduPilot.elf') +test_prerequesites() + for step in steps: if skip_step(step): continue diff --git a/Tools/autotest/util.py b/Tools/autotest/util.py index dbd8873322..97b7caf916 100644 --- a/Tools/autotest/util.py +++ b/Tools/autotest/util.py @@ -86,3 +86,15 @@ def expect_setup_callback(e, callback): e.expect_user_callback = callback e.expect_saved = e.expect 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)