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 unit tests for it with nunit-console.exe
. However, these tools were built for use in a Windows development environment, and I'm having various issues with getting them to work in the Bash environment of msysgit, summarized as follows:
- Bash can't seem to find
MSBuild.exe
nornunit-console.exe
(path issue). - Both
MSBuild.exe
andnunit-console.exe
use Windows style commandline option flags, i.e. they begin with a foward slash, e.g.MSBuild.exe /M
. In Bash the forward slashes cause errors, because a forward slash is what Unix/Linux/*nix systems use to represent directory paths.
This is the git bisect
command I've been using:
$ git bisect start <bad commit> <good commit>
$ git bisect run auto-build-run-tests.sh
and these are the contents of auto-build-run-tests.sh
:
#!/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..."
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."