on xenial help sign in
improve the bzr commit hook

- don't run qmltests in here, it takes too long - don't abort commit commit on failed tests, its too annoying - instead, print a fat warning and backup the commit message to be reused after uncommitting and fixing the tests

commit4e9819369e8972483a450e8675134278f26dc152 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 28 Jun 2013, 22:27 (13 years ago) parentdc9964e
2 files changed+15−5
.bazaar/plugins/makecheck_unity_phablet.py+14−5 .bzrignore+1
.bazaar/plugins/makecheck_unity_phablet.py+14−5
@@ -24,11 +24,20 @@ def execute_makecheck(local_branch, master_branch, old_revision_number, old_revi
2424 os.chdir(local_path_from_url(master_branch.base))
2525
2626 print "Executing 'make check'.."
27− if (subprocess.call("make check", shell=True) != 0):
28− raise errors.BzrError("Unit tests failed, fix them before committing!")
27+ os.environ['CTEST_OUTPUT_ON_FAILURE'] = "1"
28+ if (subprocess.call("make -C builddir test", shell=True) != 0):
2929
30− print "Executing 'make qmluitests'.."
31− if (subprocess.call("make qmluitests", shell=True) != 0):
32− raise errors.BzrError("QML UI tests failed, fix them before committing!")
30+ print("\n\n*** Warning ***\n\nBasic tests failed. This commit will not pass continuous integration.")
31+
32+ branch = local_branch or master_branch
33+ revision = branch.repository.get_revision(future_revision_id)
34+ msg_file = open('message.txt', 'w')
35+ msg_file.write(revision.message)
36+ msg_file.close()
37+
38+ print("\n\nSaved commit message to $SRC_DIR/message.txt.")
39+ print("You can uncommit this revision, fix the tests and reuse your message running:\n\nbzr commit -F message.txt\n\n")
40+ elif os.path.isfile("message.txt"):
41+ os.remove("message.txt")
3342
3443branch.Branch.hooks.install_named_hook('pre_commit', execute_makecheck, 'make check pre-commit')
.bzrignore+1
@@ -7,3 +7,4 @@
77/.cproject
88/.settings
99/.pydevproject
10+message.txt