summaryrefslogtreecommitdiffstats
path: root/git-bisect.html
diff options
context:
space:
mode:
authorJunio C Hamano <junio@kernel.org>2011-03-23 05:40:15 +0000
committerJunio C Hamano <junio@kernel.org>2011-03-23 05:40:15 +0000
commit9a2fb2de47af2cda8265eddf4c01de0c0bee7810 (patch)
tree457100abdf5cdf598bc9fe6f5f77742c7a461abb /git-bisect.html
parent78f25df845b9b3579ac0c29a415f8282599831d0 (diff)
downloadgit-htmldocs-9a2fb2de47af2cda8265eddf4c01de0c0bee7810.tar.gz
Autogenerated HTML docs for v1.7.4.1-415-g5e839
Diffstat (limited to 'git-bisect.html')
-rw-r--r--git-bisect.html63
1 files changed, 40 insertions, 23 deletions
diff --git a/git-bisect.html b/git-bisect.html
index db48733ed..bfc3b7f84 100644
--- a/git-bisect.html
+++ b/git-bisect.html
@@ -642,54 +642,71 @@ $ git bisect run make test # "make test" builds and tests</tt></pre>
</li>
<li>
<p>
-Automatically bisect a broken test suite:
+Automatically bisect a broken test case:
</p>
<div class="listingblock">
<div class="content">
<pre><tt>$ cat ~/test.sh
#!/bin/sh
-make || exit 125 # this skips broken builds
-make test # "make test" runs the test suite
-$ git bisect start v1.3 v1.1 -- # v1.3 is bad, v1.1 is good
+make || exit 125 # this skips broken builds
+~/check_test_case.sh # does the test case pass?
+$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
$ git bisect run ~/test.sh</tt></pre>
</div></div>
<div class="paragraph"><p>Here we use a "test.sh" custom script. In this script, if "make"
-fails, we skip the current commit.</p></div>
-<div class="paragraph"><p>It is safer to use a custom script outside the repository to prevent
-interactions between the bisect, make and test processes and the
-script.</p></div>
-<div class="paragraph"><p>"make test" should "exit 0", if the test suite passes, and
-"exit 1" otherwise.</p></div>
+fails, we skip the current commit.
+"check_test_case.sh" should "exit 0" if the test case passes,
+and "exit 1" otherwise.</p></div>
+<div class="paragraph"><p>It is safer if both "test.sh" and "check_test_case.sh" are
+outside the repository to prevent interactions between the bisect,
+make and test processes and the scripts.</p></div>
</li>
<li>
<p>
-Automatically bisect a broken test case:
+Automatically bisect with temporary modifications (hot-fix):
</p>
<div class="listingblock">
<div class="content">
<pre><tt>$ cat ~/test.sh
#!/bin/sh
-make || exit 125 # this skips broken builds
-~/check_test_case.sh # does the test case passes ?
-$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
-$ git bisect run ~/test.sh</tt></pre>
+
+# tweak the working tree by merging the hot-fix branch
+# and then attempt a build
+if git merge --no-commit hot-fix &amp;&amp;
+ make
+then
+ # run project specific test and report its status
+ ~/check_test_case.sh
+ status=$?
+else
+ # tell the caller this is untestable
+ status=125
+fi
+
+# undo the tweak to allow clean flipping to the next commit
+git reset --hard
+
+# return control
+exit $status</tt></pre>
</div></div>
-<div class="paragraph"><p>Here "check_test_case.sh" should "exit 0" if the test case passes,
-and "exit 1" otherwise.</p></div>
-<div class="paragraph"><p>It is safer if both "test.sh" and "check_test_case.sh" scripts are
-outside the repository to prevent interactions between the bisect,
-make and test processes and the scripts.</p></div>
+<div class="paragraph"><p>This applies modifications from a hot-fix branch before each test run,
+e.g. in case your build or test environment changed so that older
+revisions may need a fix which newer ones have already. (Make sure the
+hot-fix branch is based off a commit which is contained in all revisions
+which you are bisecting, so that the merge does not pull in too much, or
+use <tt>git cherry-pick</tt> instead of <tt>git merge</tt>.)</p></div>
</li>
<li>
<p>
-Automatically bisect a broken test suite:
+Automatically bisect a broken test case:
</p>
<div class="listingblock">
<div class="content">
<pre><tt>$ git bisect start HEAD HEAD~10 -- # culprit is among the last 10
$ git bisect run sh -c "make || exit 125; ~/check_test_case.sh"</tt></pre>
</div></div>
-<div class="paragraph"><p>Does the same as the previous example, but on a single line.</p></div>
+<div class="paragraph"><p>This shows that you can do without a run script if you write the test
+on a single line.</p></div>
</li>
</ul></div>
</div>
@@ -704,7 +721,7 @@ $ git bisect run sh -c "make || exit 125; ~/check_test_case.sh"</tt></pre>
</div>
<div id="footer">
<div id="footer-text">
-Last updated 2011-03-20 19:41:42 UTC
+Last updated 2011-03-23 05:39:52 UTC
</div>
</div>
</body>