【发布时间】:2013-07-28 01:41:34
【问题描述】:
我想automate git bisect(也可以在official Linux Kernel Git documenation for git bisect 获得说明)使用MSBuild 构建一个.NET 项目,并使用nunit-console.exe 对其运行单元测试。但是,这些工具是为在 Windows 开发环境中使用而构建的,我在让它们在 msysgit 的 Bash 环境中工作时遇到了各种问题,总结如下:
- Bash 似乎找不到
MSBuild.exe或nunit-console.exe(路径问题)。 -
MSBuild.exe和nunit-console.exe都使用 Windows 样式的命令行选项标志,即它们以正斜杠开头,例如MSBuild.exe /M。在 Bash 中,正斜杠会导致错误,因为 Unix/Linux/*nix 系统使用正斜杠来表示目录路径。
这是我一直在使用的git bisect 命令:
$ git bisect start <bad commit> <good commit>
$ git bisect run auto-build-run-tests.sh
这些是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."
【问题讨论】:
标签: git bash msbuild nunit msysgit