Created
December 17, 2021 22:01
-
-
Save mqudsi/0edbd38507ce97ac695a72dcb7a7661c to your computer and use it in GitHub Desktop.
A script to bisect vim portably
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# set -x | |
# vim is really hard to run portably; I can't seem to get `set rtp=./runtime/` | |
# to actually work, so we build it with a prefix pointing to $PWD and then | |
# symlink `share/vim/` so it points to the files we need. | |
if mkdir share 2>&1 >/dev/null; then | |
ln -s $(pwd) share/vim | |
fi | |
make clean | |
rm -f ./src/vim | |
# git reserves exit code 125 for build failure, which will skip the commit when | |
# bisecting. | |
echo Building vim $(git rev-parse HEAD) | |
test -f ./configure && { | |
./configure --prefix=$(pwd) > /dev/null || exit 125 | |
} | |
make -j16 > /dev/null || echo "Error compiling project!"; | |
rm -f src/auto/config.cache | |
test -x ./src/vim || exit 125 | |
rm -f output.html | |
# See above regarding portability. We are now using the currently checked out | |
# git source as the runtimepath, so we don't need to use `-u NORC` | |
./src/vim -c 'source bisect.vim' | |
test -f output.html || { | |
echo "error running test!" | |
sleep 10 | |
exit 125 | |
} | |
# If the output matches bad.html, then the bisect test has failed. | |
if diff output.html bad.html >/dev/null; then | |
echo -n $'\e[31m' | |
echo -n $(git rev-parse HEAD) bisects BAD | |
echo $'\e[m' | |
echo "" | |
exit 1 | |
fi | |
echo -n '\e[32m' | |
echo -n $(git rev-parse HEAD) bisects GOOD | |
echo '\e[m' | |
echo "" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment