mirror of https://github.com/ArduPilot/ardupilot
Tools: make and declare bisect-helper.py flake8-compliant
This commit is contained in:
parent
ee79895a4e
commit
cee348d082
|
@ -28,7 +28,7 @@ git bisect reset
|
||||||
git bisect start
|
git bisect start
|
||||||
git bisect bad
|
git bisect bad
|
||||||
git bisect good HEAD~1024
|
git bisect good HEAD~1024
|
||||||
time git bisect run /tmp/bisect-helper.py --autotest --autotest-vehicle=Plane --autotest-test=NeedEKFToArm --autotest-branch=wip/bisection-using-named-test
|
time git bisect run /tmp/bisect-helper.py --autotest --autotest-vehicle=Plane --autotest-test=NeedEKFToArm --autotest-branch=wip/bisection-using-named-test # noqa
|
||||||
|
|
||||||
Work out who overflowed Omnbusf4pro:
|
Work out who overflowed Omnbusf4pro:
|
||||||
cp -a Tools Tools2
|
cp -a Tools Tools2
|
||||||
|
@ -49,6 +49,8 @@ git bisect good $GOOD &&
|
||||||
rm /tmp/bisect-debug/*; git commit -m "stuff" -a ; cp Tools/autotest/bisect-helper.py /tmp; git bisect reset; git bisect start; git bisect bad d24e569b20; git bisect good 3f6fd49507f286ad8f6ccc9e29b110d5e9fc9207^
|
rm /tmp/bisect-debug/*; git commit -m "stuff" -a ; cp Tools/autotest/bisect-helper.py /tmp; git bisect reset; git bisect start; git bisect bad d24e569b20; git bisect good 3f6fd49507f286ad8f6ccc9e29b110d5e9fc9207^
|
||||||
time git bisect run /tmp/bisect-helper.py --autotest --autotest-vehicle=Copter --autotest-test=Replay --autotest-branch=wip/bisection-using-flapping-test --autotest-test-passes=40 --autotest-failure-require-string="Mismatch in field XKF1.Pitch" --autotest-failure-ignore-string="HALSITL::SITL_State::_check_rc_input"
|
time git bisect run /tmp/bisect-helper.py --autotest --autotest-vehicle=Copter --autotest-test=Replay --autotest-branch=wip/bisection-using-flapping-test --autotest-test-passes=40 --autotest-failure-require-string="Mismatch in field XKF1.Pitch" --autotest-failure-ignore-string="HALSITL::SITL_State::_check_rc_input"
|
||||||
|
|
||||||
|
AP_FLAKE8_CLEAN
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import optparse
|
import optparse
|
||||||
|
@ -59,6 +61,7 @@ import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
def get_exception_stacktrace(e):
|
def get_exception_stacktrace(e):
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
ret = "%s\n" % e
|
ret = "%s\n" % e
|
||||||
|
@ -68,6 +71,7 @@ def get_exception_stacktrace(e):
|
||||||
return ret
|
return ret
|
||||||
return traceback.format_exc(e)
|
return traceback.format_exc(e)
|
||||||
|
|
||||||
|
|
||||||
class Bisect(object):
|
class Bisect(object):
|
||||||
def __init__(self, opts):
|
def __init__(self, opts):
|
||||||
self.opts = opts
|
self.opts = opts
|
||||||
|
@ -154,7 +158,7 @@ class Bisect(object):
|
||||||
cmd_build.extend(piece)
|
cmd_build.extend(piece)
|
||||||
try:
|
try:
|
||||||
self.run_program("WAF-build", cmd_build)
|
self.run_program("WAF-build", cmd_build)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
# well, it definitely failed....
|
# well, it definitely failed....
|
||||||
if self.opts.build_failure_string is not None:
|
if self.opts.build_failure_string is not None:
|
||||||
if self.opts.build_failure_string in self.program_output:
|
if self.opts.build_failure_string in self.program_output:
|
||||||
|
@ -185,11 +189,10 @@ class BisectCITest(Bisect):
|
||||||
def autotest_script(self):
|
def autotest_script(self):
|
||||||
return os.path.join("Tools", "autotest", "autotest.py")
|
return os.path.join("Tools", "autotest", "autotest.py")
|
||||||
|
|
||||||
|
|
||||||
def git_reset(self):
|
def git_reset(self):
|
||||||
try:
|
try:
|
||||||
self.run_program("Reset autotest directory", ["git", "reset", "--hard"])
|
self.run_program("Reset autotest directory", ["git", "reset", "--hard"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.exit_abort()
|
self.exit_abort()
|
||||||
|
|
||||||
def get_current_hash(self):
|
def get_current_hash(self):
|
||||||
|
@ -211,16 +214,15 @@ class BisectCITest(Bisect):
|
||||||
try:
|
try:
|
||||||
self.run_program("Update submodules",
|
self.run_program("Update submodules",
|
||||||
["git", "submodule", "update", "--init", "--recursive"])
|
["git", "submodule", "update", "--init", "--recursive"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.exit_abort()
|
self.exit_abort()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.run_program("Check autotest directory out from master",
|
self.run_program("Check autotest directory out from master",
|
||||||
["git", "checkout", self.opts.autotest_branch, "Tools/autotest"])
|
["git", "checkout", self.opts.autotest_branch, "Tools/autotest"])
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.exit_abort()
|
self.exit_abort()
|
||||||
|
|
||||||
|
|
||||||
self.progress("Build")
|
self.progress("Build")
|
||||||
cmd = [self.autotest_script()]
|
cmd = [self.autotest_script()]
|
||||||
if self.opts.autotest_valgrind:
|
if self.opts.autotest_valgrind:
|
||||||
|
@ -230,7 +232,7 @@ class BisectCITest(Bisect):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.run_program("Run autotest (build)", cmd)
|
self.run_program("Run autotest (build)", cmd)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
self.git_reset()
|
self.git_reset()
|
||||||
self.exit_skip()
|
self.exit_skip()
|
||||||
|
|
||||||
|
@ -246,7 +248,7 @@ class BisectCITest(Bisect):
|
||||||
self.run_program(
|
self.run_program(
|
||||||
"Run autotest (%u/%u)" % (i+1, self.opts.autotest_test_passes),
|
"Run autotest (%u/%u)" % (i+1, self.opts.autotest_test_passes),
|
||||||
cmd)
|
cmd)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError:
|
||||||
for ignore_string in self.opts.autotest_failure_ignore_string:
|
for ignore_string in self.opts.autotest_failure_ignore_string:
|
||||||
if ignore_string in self.program_output:
|
if ignore_string in self.program_output:
|
||||||
self.progress("Found ignore string (%s) in program output" % ignore_string)
|
self.progress("Found ignore string (%s) in program output" % ignore_string)
|
||||||
|
@ -255,7 +257,8 @@ class BisectCITest(Bisect):
|
||||||
if self.opts.autotest_failure_require_string not in self.program_output:
|
if self.opts.autotest_failure_require_string not in self.program_output:
|
||||||
# it failed, but not for the reason we're looking
|
# it failed, but not for the reason we're looking
|
||||||
# for...
|
# for...
|
||||||
self.progress("Did not find test failure string (%s); skipping" % self.opts.autotest_failure_require_string)
|
self.progress("Did not find test failure string (%s); skipping" %
|
||||||
|
self.opts.autotest_failure_require_string)
|
||||||
code = self.exit_skip_code()
|
code = self.exit_skip_code()
|
||||||
break
|
break
|
||||||
if not ignore:
|
if not ignore:
|
||||||
|
@ -321,10 +324,10 @@ if __name__ == '__main__':
|
||||||
type="string",
|
type="string",
|
||||||
help="Branch on which the test exists. The autotest directory will be reset to this branch")
|
help="Branch on which the test exists. The autotest directory will be reset to this branch")
|
||||||
group_autotest.add_option("--autotest-failure-require-string",
|
group_autotest.add_option("--autotest-failure-require-string",
|
||||||
type='string',
|
type='string',
|
||||||
default=None,
|
default=None,
|
||||||
help="If supplied, must be present in"
|
help="If supplied, must be present in"
|
||||||
"test output to count as a failure")
|
"test output to count as a failure")
|
||||||
group_autotest.add_option("--autotest-failure-ignore-string",
|
group_autotest.add_option("--autotest-failure-ignore-string",
|
||||||
type='string',
|
type='string',
|
||||||
default=[],
|
default=[],
|
||||||
|
|
Loading…
Reference in New Issue