I would like to automate git bisect (instructions also available at official Linux Kernel Git documenation for git bisect) for building a .NET project with MSBuild, and run
To solve the path problem, I simply used an absolute path in the script. To solve the Windows-style forward-slash commandline-option problem, I escaped the forward-slash with another forward slash (I got that tip from another Stack Overflow answer, I'll link to it when I find it again).
So now the working script looks like this:
#!/bin/sh
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_02.html
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
# Build solution.
echo "Building..."
c:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe \
//consoleloggerparameters:ErrorsOnly \
//maxcpucount \
//nologo \
//property:Configuration=Debug \
//verbosity:quiet \
Epic-Project-of-Supreme-Awesome.sln
# Check exit status.
# (status != 0) ?
status=$?
if [ $status -ne 0 ]
then
echo "Build failure, status $status."
exit $status
fi
echo "Build success."
# Run unit tests
nunit-console.exe \
//noresult \
//stoponerror \
bin/Debug/ArtificialIntelligence.Tests.dll \
bin/Debug/TravelingSalesManSolver.Tests.dll
status=$?
if [ $status -ne 0 ]
then
echo "Test failure, status $status."
exit $status
fi
echo "Tests passed."
and once again, you run it like this:
$ git bisect start <bad commit> <good commit>
$ git bisect run auto-build-run-tests.sh