-
-
Save in3otd/053641a2bb24d7303c66 to your computer and use it in GitHub Desktop.
Bash script for automatic bisection
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 | |
# Quick usage instructions: | |
# change QTESTPATH to the qucs root parent dir | |
QTESTPATH=~/test | |
# place this script in $QTESTPATH | |
# copy the netlist.txt file to use for testing qucsator in ~/.qucs/ | |
# then start the automatic bisection, using e.g. | |
# cd $QTESTPATH/qucs | |
# git bisect reset | |
# git bisect start <bad_commit> <good_commit> | |
# git bisect run ../runqucsator.sh | |
# | |
cd $QTESTPATH/qucs/qucs-core | |
GITSHA=`git rev-parse HEAD` | |
if [ -f ./bootstrap.sh ]; then | |
./bootstrap.sh | |
fi | |
if [ -f ./autogen.sh ]; then | |
./autogen.sh | |
fi | |
make clean | |
#./configure --enable-maintainer-mode | |
./configure --enable-maintainer-mode | |
make | |
# Retrieve the exit code | |
if [ "$?" -ne "0" ]; then | |
git checkout -- . | |
git clean -xdf . | |
touch $QTESTPATH/$GITSHA-skipped.out | |
exit 125 # an exit code of 125 asks "git bisect" to "skip" the current commit | |
fi | |
# allow 5 s for simulation | |
timeout 5 $QTESTPATH/qucs/qucs-core/src/qucsator -i ~/.qucs/netlist.txt -o /tmp/netlist.out | |
# Retrieve the exit code | |
if [ "$?" -ne "124" ]; then # not timed out | |
cp /tmp/netlist.out $QTESTPATH/$GITSHA.out | |
grep -i nan /tmp/netlist.out | |
else | |
git checkout -- . | |
git clean -xdf . | |
exit 1 # failed | |
fi | |
# Retrieve the exit code of the grep. | |
if [ "$?" -eq "0" ]; then | |
# echo "Text found." | |
git checkout -- . | |
git clean -xdf . | |
exit 1 # failed | |
else | |
# echo "Text not found." | |
git checkout -- . | |
git clean -xdf . | |
exit 0 # run ok | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment