Debian Codegraph @

cmake/tribits/doc/guides/scripts/dummy_test_commit.sh

raw
1 #!/bin/bash
2 #
3 # Script: dummy_test_commit.sh
4 #
5 # This script simulates a test script used with 'git bisect run <script>' to
6 # show how to use the is_checkin_tested_commit.py script to skip commits that
7 # are not known to be tested with the checkin-test.py script. To use this
8 # script, set the env variable DUMMY_TEST_COMMIT_BAD_SHA to the SHA1 of a
9 # commit that you are pretending is the bad commit in the range of commits
10 # <good-commit>..<bad-commit> and then run:
11 #
12 # git bisect <bad-commit> <good-commit>
13 # git bisect run ./dummy_test_commit.sh
14 #
15 # This should result in git-bisect bounding the commits around
16 # $DUMMY_TEST_COMMIT_BAD_SHA. To see the sorted set of commits containing the
17 # first bad commit, run:
18 #
19 # git bisect log | grep "possible first bad commit"
20 #
21
22 LOG_DUMMY_COMMIT=`git log --oneline HEAD ^$DUMMY_TEST_COMMIT_BAD_SHA^`
23 if [ "$LOG_DUMMY_COMMIT" == "" ] ; then
24 echo "Commit is *before* bad commit $DUMMY_TEST_COMMIT_BAD_SHA!"
25 else
26 echo "Commit is or after *after* bad commit $DUMMY_TEST_COMMIT_BAD_SHA!"
27 fi
28
29 # Skip the commit if not tested with checkin-test.py script
30 $TRIBITS_DIR/ci_support/is_checkin_tested_commit.py
31 IS_CHECKIN_TESTED_COMMIT_RTN=$?
32 if [ "$IS_CHECKIN_TESTED_COMMIT_RTN" != "0" ] ; then
33 exit 125 # Skip the commit because it was not known to be tested!
34 fi
35
36 echo "Building the current version ..."
37 if [ "$LOG_DUMMY_COMMIT" == "" ] ; then
38 echo "Commit is *before* bad commit $DUMMY_TEST_COMMIT_BAD_SHA! so marking good!"
39 exit 0
40 else
41 echo "Commit is or *after* bad commit $DUMMY_TEST_COMMIT_BAD_SHA so marking bad!"
42 exit 1
43 fi