-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgit-bisect.sh
executable file
·380 lines (368 loc) · 20.9 KB
/
git-bisect.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#!/bin/bash
# Created by Roel Van de Paar, MariaDB
# Note: if this script is terminated, you can still see the bisect log with: git bisect log # in the correct VERSION dir, or review the main log file (ref MAINLOG variable)
# User variables
VERSION=12.0 # Use the earliest major version affected by the bug
ES=0 # If set to 1, MariaDB Enterprise Server will be used instead of MariaDB Community Server
SKIP_NON_SAME_VERSION=0 # Skip commits which are not of the VERSION version. If you are confident you know what version a bug was introduced in, and this version is specified in VERSION above, set this to 1, otherwise set it to 0
FEATURETREE='bb-11.8-MDEV-34870-join-order' # Leave blank to use /test/git-bisect/${VERSION} or set to use a feature tree in the same location (the VERSION option will be ignored)
DBG_OR_OPT='dbg' # Use 'dbg' or 'opt' only
RECLONE=0 # Set to 1 to reclone a tree before starting
UPDATETREE=0 # Set to 1 to update the tree (git pull) before starting
BISECT_REPLAY=0 # Set to 1 to do a replay rather than good/bad commit
BISECT_REPLAY_LOG='/test/git-bisect/git-bisect' # As manually saved with: git bisect log > git-bisect
# WARNING: Take care to use commits from the same MariaDB server version (i.e. both from for example 10.10 etc.)
# UPDATE: This has proven to work as well when using commits from an earlier, and older, version for the last known good commit as compared to the first known bad commit. For example, a March 2023 commit from 11.0 as the last known good commit, with a April 11.1 commit as the first known bad commit. TODO: may be good to check if disabling the "${VERSION}" match check would improve failing commit resolution. However, this would also slow down the script considerably and it may lead to more errors while building: make it optional. It would be useful in cases where the default "${VERSION}" based matching did not work or is not finegrained enough.i
LAST_KNOWN_GOOD_COMMIT='be6489073190e3af26264abef96af5f2921ceb6a' # Revision of last known good commit
FIRST_KNOWN_BAD_COMMIT='127f28a71da0160b8e53cbb4885ca421cffb9f8e' # Revision of first known bad commit
TESTCASE='/test/in22.sql' # The testcase to be tested
UBASAN=0 # Set to 1 to use UBASAN builds instead (UBSAN+ASAN)
REPLICATION=0 # Set to 1 to use replication (./start_replication)
USE_PQUERY=0 # Uses pquery if set to 1, otherwise the CLI is used
UNIQUEID='' # The UniqueID to scan for [Exclusive]
TEXT='param->got_error' # The string to scan for in the error log [Exclusive]
# [Exclusive]: i.e. UNIQUEID and TEXT are mutually exclusive: do not set both
# And, leave both UNIQUEID and TEXT empty to scan for core files instead
# i.e. 3 different modes in total: UNIQUEID, TEXT or core files scan
# Note that TEXT is regex-capable and case-sensitive
# Script variables, do not change
RANDOM=$(date +%s%N | cut -b10-19 | sed 's|^[0]\+||')
SEED="${RANDOM}${RANDOM}"
MAINLOG="/test/git-bisect/bisect.log"
TMPLOG1="/tmp/git-bisect-${SEED}.out"
TMPLOG2="/tmp/git-bisect-build_${SEED}.exitcode"
die(){
echo "$2"; exit $1
}
# Variable checks
if [ "${ES}" -eq 1 ]; then
CHS="../credentials_helper.source"
if [ ! -r "${CHS}" ]; then CHS="/test/credentials_helper.source"; fi
if [ ! -r "${CHS}" ]; then
echo "ES=1 and ../credentials_helper.source nor /test/credentials_helper.source were found - please fix your install"
exit 1
fi
source "${CHS}" # Call the credentials check helper script to check ~/.git-credentials provisioning
fi
if [ "${ES}" -eq 1 -a ! -z "${FEATURETREE}" ]; then
echo "TODO: please add ES=1 with FEATURETREE='xyz' functionality, not implemented yet"
exit 1
elif [ "${DBG_OR_OPT}" != 'dbg' -a "${DBG_OR_OPT}" != 'opt' ]; then
echo "DBG_OR_OPT variable is incorrectly set: use 'dbg' or 'opt' only"
exit 1
elif [[ "${VERSION}" != "10."* && "${VERSION}" != "11."* && "${VERSION}" != "12."* && "${FEATURETREE}" == "" ]]; then
echo "Version (${VERSION}) does not look correct"
exit 1
elif [ ! -z "${UNIQUEID}" -a ! -z "${TEXT}" ]; then
echo "Both UNIQUEID and TEXT were set. Please only specify one of them"
exit 1
elif [ -z "${LAST_KNOWN_GOOD_COMMIT}" -o -z "${FIRST_KNOWN_BAD_COMMIT}" ]; then
echo "LAST_KNOWN_GOOD_COMMIT or FIRST_KNOWN_BAD_COMMIT (or both) setting(s) missing"
exit 1
elif [ ! -r "${HOME}/mariadb-qa/build_mdpsms_${DBG_OR_OPT}.sh" ]; then
echo "${HOME}/mariadb-qa/build_mdpsms_${DBG_OR_OPT}.sh missing. Try cloning mariadb-qa again from Github into your home directory"
if [ "${UBASAN}" -eq 1 ]; then
echo "(note: UBASAN=1 so a UBASAN build would have been used to build the server in any case, however the script looks for this script above, as a simple verification whetter mariadb-qa was cloned and is generally ready to be used)"
fi
exit 1
elif [ ! -r "${HOME}/start" ]; then
echo "${HOME}/start missing. Try running ${HOME}/mariadb-qa/linkit"
exit 1
elif [ "${BISECT_REPLAY}" -eq 1 -a ! -r "${BISECT_REPLAY_LOG}" ]; then
echo "BISECT_REPLAY Enabled, yet BISECT_REPLAY_LOG (${BISECT_REPLAY_LOG}) cannot read by this script"
exit 1
elif [ ! -r "${TESTCASE}" ]; then
echo "The testcase specified; '${TESTCASE}' is not readable"
exit 1
elif [ "${STY}" == "" ]; then
echo "Not a screen, restarting myself inside a screen"
screen -admS "git-bisect" bash -c "$0;bash"
sleep 1
screen -d -r "git-bisect"
return 2> /dev/null; exit 0
fi
rm -f "${MAINLOG}"
cd /test || die 1 '/test does not exist'
mkdir -p git-bisect || die 1 '/test/git-bisect could not be created'
echo 'Changing directory to /test/git-bisect' | tee -a "${MAINLOG}"
cd git-bisect || die 1 'could not change directory to git-bisect'
if [ ! -z "${FEATURETREE}" ]; then
VERSION="${FEATURETREE}"
fi
if [ "${RECLONE}" -eq 1 ]; then
if [ "${ES}" -eq 1 ]; then
rm -Rf "${VERSION}"
git clone --recurse-submodules -j20 --branch="${VERSION}-enterprise" https://github.com/mariadb-corporation/MariaDBEnterprise "${VERSION}" # We clone the ES branch into ./${VERSION} for simplicity in later handling
cd "${VERSION}" || die 1 "Version ${VERSION} does not exist, or could not be cloned, or similar"
else
rm -Rf "${VERSION}"
if [ "${VERSION}" == "12.0" ]; then # Update as trunk changes to a new version
git clone --recurse-submodules -j20 https://github.com/MariaDB/server.git "${VERSION}"
else
git clone --recurse-submodules -j20 --branch="${VERSION}" https://github.com/MariaDB/server.git "${VERSION}"
fi
cd "${VERSION}" || die 1 "Version ${VERSION} does not exist, or could not be cloned, or similar"
fi
else
if [ -d ${VERSION} ]; then
cd "${VERSION}" || die 1 "While version ${VERSION} directory existed, this script could not change directory to it"
else # RECLONE=0 but we do not have the directory in any case; clone it
if [ "${ES}" -eq 1 ]; then
git clone --recurse-submodules -j20 --branch="${VERSION}-enterprise" https://github.com/mariadb-corporation/MariaDBEnterprise "${VERSION}" # Idem as above
cd "${VERSION}" || die 1 "Version ${VERSION} does not exist, or could not be cloned, or similar"
else
git clone --recurse-submodules -j20 --branch="${VERSION}" https://github.com/MariaDB/server.git "${VERSION}"
cd "${VERSION}" || die 1 "Version ${VERSION} does not exist, or could not be cloned, or similar"
fi
fi
fi
if [ ! -z "${UNIQUEID}" ]; then
echo "Searching for UniqueID Bug: '${UNIQUEID}'" | tee -a "${MAINLOG}"
elif [ ! -z "${TEXT}" ]; then
echo "Searching for Error log text Bug: '${TEXT}'" | tee -a "${MAINLOG}"
else
echo "Searching for core files in the data directory to validate issue occurrence" | tee -a "${MAINLOG}"
fi
bisect_good(){
cd "/test/git-bisect/${VERSION}" || die 1 "Could not change directory to /test/git-bisect/${VERSION}"
rm -f ${TMPLOG1}
git bisect good 2>&1 | grep -v 'warning: unable to rmdir' | tee ${TMPLOG1}
cat "${TMPLOG1}" >> "${MAINLOG}"
if grep -qi 'first bad commit' ${TMPLOG1}; then
rm -f ${TMPLOG1}
echo "Finished. Use 'cd /test/git-bisect/${VERSION} && git bisect log' to see the full git bisect log" | tee -a "${MAINLOG}"
exit 0
fi
rm -f ${TMPLOG1}
}
bisect_bad(){
cd "/test/git-bisect/${VERSION}" || die 1 "Could not change directory to /test/git-bisect/${VERSION}"
rm -f ${TMPLOG1}
git bisect bad 2>&1 | grep -v 'warning: unable to rmdir' | tee ${TMPLOG1}
cat "${TMPLOG1}" >> "${MAINLOG}"
if grep -qi 'first bad commit' ${TMPLOG1}; then
echo "Finished: $(grep 'first bad commit' ${TMPLOG1})" | tee -a "${MAINLOG}"
grep -A5 '^commit' /test/git-bisect/bisect.log
echo '--'
echo "Use 'cat ${MAINLOG}' to see the full git-bisect.sh log'" | tee -a "${MAINLOG}"
echo "Use 'cd /test/git-bisect/${VERSION} && git bisect log' to see the actual git bisect log" | tee -a "${MAINLOG}"
rm -f ${TMPLOG1}
exit 0
fi
rm -f ${TMPLOG1}
}
# Git setup
git bisect reset 2>&1 | grep -v 'We are not bisecting' | tee -a "${MAINLOG}" # Remove any previous bisect run data
git reset --hard | tee -a "${MAINLOG}" # Revert tree to mainline
if [ "${?}" != "0" ]; then
echo "Assert: git reset --hard failed with a non-0 exit status, please check the output above or the logfile ${MAINLOG}"
exit 1
fi
git clean -xfd | tee -a "${MAINLOG}" # Cleanup tree
if [ "${?}" != "0" ]; then
echo "Assert: git clean -xfd failed with a non-0 exit status, please check the output above or the logfile ${MAINLOG}"
exit 1
fi
# Ensure we have the right version
if [ "${ES}" == "1" ]; then
git checkout --force --recurse-submodules "${VERSION}-enterprise" | tee -a "${MAINLOG}"
if [ "${?}" != "0" ]; then
echo "Assert: git checkout --force --recurse-submodules '${VERSION}-enterprise' failed with a non-0 exit status, please check the output above or in the logfile ${MAINLOG}"
exit 1
fi
else
git checkout --force --recurse-submodules "${VERSION}" | tee -a "${MAINLOG}"
if [ "${?}" != "0" ]; then
echo "Assert: git checkout --force --recurse-submodules '${VERSION}' failed with a non-0 exit status, please check the output above or in the logfile ${MAINLOG}"
exit 1
fi
fi
if [ "${UPDATETREE}" -eq 1 ]; then
git pull --recurse-submodules | tee -a "${MAINLOG}" # Ensure we have the latest version
if [ "${?}" != "0" ]; then
echo "Assert: git pull --recurse-submodules failed with a non-0 exit status, please check the output above or the logfile ${MAINLOG}"
exit 1
fi
fi
git bisect start | tee -a "${MAINLOG}" # Start bisect run
if [ "${?}" != "0" ]; then
echo "Assert: git bisect start failed with a non-0 exit status, please check the output above or the logfile ${MAINLOG}"
exit 1
fi
if [ "${BISECT_REPLAY}" -eq 1 ]; then
git bisect replay "${BISECT_REPLAY_LOG}" | tee -a "${MAINLOG}"
if [ "${?}" != "0" ]; then
echo "git bisect replay \"${BISECT_REPLAY_LOG}\" failed. Terminating for manual debugging." | tee -a "${MAINLOG}"
exit 1
else
echo "git bisect replay \"${BISECT_REPLAY_LOG}\" succeeded. Proceding with regular git bisecting." | tee -a "${MAINLOG}"
fi
else
git bisect bad "${FIRST_KNOWN_BAD_COMMIT}" | tee -a "${MAINLOG}" # Starting point, bad
if [ "${?}" != "0" ]; then
echo "Bad revision input failed. Terminating for manual debugging. Possible reasons: you may have used a revision of a feature branch, not trunk, have a typo in the revision, or the current tree being used is not recent enough (try 'git pull' or set RECLONE=1 inside the script)."
exit 1
fi
git bisect good "${LAST_KNOWN_GOOD_COMMIT}" | tee -a "${MAINLOG}" # Starting point, good
if [ "${?}" != "0" ]; then
echo "Good revision input failed. Terminating for manual debugging. Possible reasons: you may have used a revision of a feature branch, not trunk, have a typo in the revision, or the current tree being used is not recent enough (try 'git pull' or set RECLONE=1 inside the script)."
exit 1
fi
fi
# Note that the starting point may not point git to a valid commit to test. i.e. git bisect may jump to a commit
# which was done via a merge in the tree where the current branch is the second parent and not the first one, with
# the result that the tree version (as seen in the VERSION file) is different from the $VERSION needing to be tested.
# For this, the script (ref below) will use 'git bisect skip' until it has located a commit with the correct $VERSION,
# Unless SKIP_NON_SAME_VERSION=1 in which case all commits will be tested and none will be skipped, even if the
# version of the commit at hand does not match $VERSION
LAST_TESTED_COMMIT=
while :; do
CUR_VERSION=;CUR_COMMIT=
while :; do
source ./VERSION
CUR_VERSION="${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}"
CUR_COMMIT="$(git log | head -n1 | tr -d '\n')"
CUR_DATE="$(git log | head -n4 | grep '^Date:' | head -n1 | sed 's|Date:[ \t]*||;s|[ \t]*+.*||' | tr -d '\n')"
if [ "${CUR_VERSION}" != "${VERSION}" ]; then
if [ "${SKIP_NON_SAME_VERSION}" == "1" ]; then
echo "|> ${CUR_COMMIT} (${CUR_DATE}) is version ${CUR_VERSION}, skipping..." | tee -a "${MAINLOG}"
git bisect skip 2>&1 | grep -v 'warning: unable to rmdir' | tee -a "${MAINLOG}" # rmdir: ref above (idem)
else
echo "|> ${CUR_COMMIT} (${CUR_DATE}) is version ${CUR_VERSION}, and SKIP_NON_SAME_VERSION=0, proceeding..." | tee -a "${MAINLOG}"
break
fi
if grep -qiE 'There are only.*skip.*ped commits left to test|The first bad commit could be any of' "${MAINLOG}"; then
exit 1
break
fi
continue
elif [ "${CUR_COMMIT}" == "${LAST_TESTED_COMMIT}" ]; then
# This seems to happen when for example a patch was attempted to be applied but did not apply correctly or source files were changed - i.e. the tree state is not clean anymore. TODO: this is a provisional patch; it may not work. Setting RECLONE=1 is another way to work around such issues (full reclone)
echo "|> ${CUR_COMMIT} is the same as the last tested commit ${LAST_TESTED_COMMIT}, skipping..." | tee -a "${MAINLOG}"
git bisect skip 2>&1 | grep -v 'warning: unable to rmdir' | tee -a "${MAINLOG}" # rmdir: ref above (idem)
else
echo "|> ${CUR_COMMIT} (${CUR_DATE}) is version ${CUR_VERSION}, proceeding..." | tee -a "${MAINLOG}"
LAST_TESTED_COMMIT="${CUR_COMMIT}"
break
fi
done
if grep -qiE 'There are only.*skip.*ped commits left to test|The first bad commit could be any of' "${MAINLOG}"; then
exit 1
break
fi
CONTINUE_MAIN_LOOP=0
OUTCOME_BUILD=
SCREEN_NAME=
while :; do
echo "|> Cleaning up any previous builds in /test/git-bisect" | tee -a "${MAINLOG}"
rm -Rf /test/git-bisect/*MD*mariadb*
SCREEN_NAME="git-bisect-build.${SEED}"
echo "|> Building revision in a screen session: use screen -d -r '${SCREEN_NAME}' to see the build process" | tee -a "${MAINLOG}"
rm -f ${TMPLOG2}
if [ "${UBASAN}" -eq 1 ]; then
screen -admS "${SCREEN_NAME}" bash -c "${HOME}/mariadb-qa/build_mdpsms_${DBG_OR_OPT}_san.sh; echo \"\${?}\" > ${TMPLOG2}"
else
screen -admS "${SCREEN_NAME}" bash -c "${HOME}/mariadb-qa/build_mdpsms_${DBG_OR_OPT}.sh; echo \"\${?}\" > ${TMPLOG2}"
fi
while [ "$(screen -ls | grep -o "${SCREEN_NAME}")" == "${SCREEN_NAME}" ]; do
sleep 2
done
sleep 2
OUTCOME_BUILD="$(cat ${TMPLOG2} 2>/dev/null | head -n1 | tr -d '\n')"
if [ "${OUTCOME_BUILD}" != "0" ]; then
echo "|> Build failure... Skipping revision ${CUR_COMMIT}" | tee -a "${MAINLOG}"
git bisect skip 2>&1 | grep -v 'warning: unable to rmdir' | tee -a "${MAINLOG}" # The 'unable to rmdir' is just for 3rd party/plugins etc. - it is not a fatal error
CONTINUE_MAIN_LOOP=1
break # Failed build, CONTINUE_MAIN_LOOP=1 set, break, then 'continue' in main loop for next revision
else
rm -f ${TMPLOG2} # Only delete log if build succeeded
echo "|> Build successful... Testing revision ${CUR_COMMIT}" | tee -a "${MAINLOG}"
break # Successful build, continue with test (CONTINUE_MAIN_LOOP=0)
fi
done
if [ "${CONTINUE_MAIN_LOOP}" != "0" ]; then
CONTINUE_MAIN_LOOP=0
continue
fi
cd /test/git-bisect || die 1 'Could not change directory to /test/git-bisect'
sleep 1
# Find the TEST_DIR name by taking the name of the tarball created in the last two minutes and removing .tar.gz
TEST_DIR="$(find . -maxdepth 1 -type f -mmin -2 -name "*.tar.gz" -exec bash -c 'basename "{}" .tar.gz' \;)"
if [ -z "${TEST_DIR}" ]; then
echo "Assert: TEST_DIR is empty (no .tar.gz was created in the last two minutes by the build script)" | tee -a "${MAINLOG}"
echo "Will try and recover by using git skip for this commit. Bisecting may fail" | tee -a "${MAINLOG}"
cd "${VERSION}" || die 1 "Script could not change directory to ${VERSION}"
git bisect skip 2>&1 | grep -v 'warning: unable to rmdir' | tee -a "${MAINLOG}" # rmdir: ref above (idem)
continue
elif [ "$(echo "${TEST_DIR}" | wc -l)" -ne "1" ]; then
echo "Assert: TEST_DIR does not contain exactly one line; this should not happen. The current value is:" | tee -a "${MAINLOG}"
echo "${TEST_DIR}" | tee -a "${MAINLOG}"
exit 1
break
elif [ ! -d "${TEST_DIR}" ]; then
echo "Assert: TEST_DIR ${TEST_DIR} does not exits" | tee -a "${MAINLOG}"
echo "Will try and recover by using git skip for this commit. Bisecting may fail" | tee -a "${MAINLOG}"
cd "${VERSION}" || die 1 "Script could not change directory to ${VERSION}"
git bisect skip 2>&1 | grep -v 'warning: unable to rmdir' | tee -a "${MAINLOG}" # rmdir: ref above (idem)
continue
fi
cd "${TEST_DIR}" || die 1 "Could not change directory to TEST_DIR (${TEST_DIR})"
${HOME}/start 2>&1 | grep -vE 'To get a |^Note: |Adding scripts: ' # Init BASEDIR with runtime scripts
cp ${TESTCASE} ./in.sql
if [ "${REPLICATION}" -eq 0 ]; then
./all_no_cl >>"${MAINLOG}" 2>&1 || die 1 "Could not execute ./all_no_cl in ${PWD}" # wipe, start
#DEBUG# read -p 'all_no_cl done'
if [ "${USE_PQUERY}" -eq 1 ]; then
./test_pquery >>"${MAINLOG}" 2>&1 || die 1 "Could not execute ./test_pquery in ${PWD}" # ./in.sql exec test
else
./test >>"${MAINLOG}" 2>&1 || die 1 "Could not execute ./test in ${PWD}" # ./in.sql exec test
fi
#DEBUG# read -p 'test done'
echo "$(./stop 2>&1)" >/dev/null 2>&1 # Output is removed as otherwise it may contain, for example, 'bin/mariadb-admin: connect to server at 'localhost' failed' if the server already crashed due to testcase exec
./kill >/dev/null 2>&1
else
export SRNOCL=1 # No CLI when using ./start_replication
./start_replication 2>&1 | grep -vE 'To get a |^Note: |Adding scripts: '
if [ "${USE_PQUERY}" -eq 1 ]; then
./test_pquery >>"${MAINLOG}" 2>&1 || die 1 "Could not execute ./test_pquery in ${PWD}" # ./in.sql exec test
else
./test >>"${MAINLOG}" 2>&1 || die 1 "Could not execute ./test in ${PWD}" # ./in.sql exec test
fi
./stop_replication >/dev/null 2>&1 # Output is removed, ref above
./kill_replication >/dev/null 2>&1
fi
if [ ! -z "${UNIQUEID}" ]; then
UNIQUEID_CHECK="$(${HOME}/t)"
if [ "${UNIQUEID_CHECK}" == "${UNIQUEID}" ]; then
echo "UniqueID Bug found: ${UNIQUEID_CHECK} -> bad commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_bad
else
echo "UniqueID Bug not found: '$(echo "${UNIQUEID_CHECK}" | sed 's|Assert: n|N|;s|found.*, and|found, and|;s| for all logs.*||')' seen versus target '${UNIQUEID}' -> good commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_good
fi
UNIQUEID_CHECK=
elif [ ! -z "${TEXT}" ]; then
if [ ! -z "$(grep -E "${TEXT}" log/master.err)" ]; then
echo "TEXT Bug found; bad commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_bad
else
echo "TEXT Bug not found; good commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_good
fi
else
if [ $(ls -l data/*core* 2>/dev/null | wc -l) -ge 1 ]; then
echo "Core file found in ./data; bad commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_bad
else
echo "No core file found in ./data; good commit (${CUR_COMMIT})" | tee -a "${MAINLOG}"
bisect_good
fi
fi
done
# For for example checking YACC compilation errors, you can use 'git bisect run':
# For automatic good/bad selection based on exit code, use 'git bisect run ./command_which_provides_exit_code':
# git bisect reset && git bisect start
# git bisect bad ...rev...
# git bisect good ...rev...
# git bisect run yacc -Wother -Wyacc -Wdeprecated --verbose sql/sql_yacc.yy 2>/dev/null # 1 on error
# This will very quickly find the revision where the YACC error was introduced