我如何 运行 使用 Appveyor 进行自定义 C 单元测试?
How do I run a custom C unit test with Appveyor?
我目前正在用 C (https://github.com/Srekel/sralloc) 编写一个开源库,并且有一个简单的单元测试 solution/project 运行ning。它使用一个简单的 C 单元测试框架并生成一个 unittest.exe 打印结果和 returns 1 或 0 取决于它是否成功。
我的问题是我不确定如何在构建后将 Appveyor 配置为 运行 这个可执行文件。 Appveyor 可执行文件在 C:\projects\sralloc\examples\Build\x64_Debug\unittest.exe
生成
所以我尝试了这个:
test_script:
- '%APPVEYOR_BUILD_FOLDER%\examples\build\%PLATFORM%_%CONFIGURATION%\unittest.exe'
但是 Appveyor 说:The system cannot find the path specified.
我在网上搜索了很多,但还没有真正找到任何东西。
这是我的全部 appveyor.xml
version: 1.0.{build}
image: Visual Studio 2017
configuration:
- Debug
- Release
build:
parallel: true
project: examples/sralloc.sln
test_script:
- '%APPVEYOR_BUILD_FOLDER%\examples\build\%PLATFORM%_%CONFIGURATION%\unittest.exe'
我分叉了你的 repo 并将以下内容添加到你的 appeyor.yml
:
platform:
- x64
和 cannot find the path
错误消失了。如果您在 YAML 中没有此设置,则构建 VM 上没有名为 platform
的环境变量,并且 msbuild
选择了 first in list 平台。
旁注:现在它停留在 Press any key to continue . . .
但我相信这是另一个主题,您可以通过更改命令行语法来修复它。
旁注 2:使用 this approach 上传文本结果(我假设您的测试可以在其中一种受支持的格式上创建 XML 结果。
我目前正在用 C (https://github.com/Srekel/sralloc) 编写一个开源库,并且有一个简单的单元测试 solution/project 运行ning。它使用一个简单的 C 单元测试框架并生成一个 unittest.exe 打印结果和 returns 1 或 0 取决于它是否成功。
我的问题是我不确定如何在构建后将 Appveyor 配置为 运行 这个可执行文件。 Appveyor 可执行文件在 C:\projects\sralloc\examples\Build\x64_Debug\unittest.exe
所以我尝试了这个:
test_script:
- '%APPVEYOR_BUILD_FOLDER%\examples\build\%PLATFORM%_%CONFIGURATION%\unittest.exe'
但是 Appveyor 说:The system cannot find the path specified.
我在网上搜索了很多,但还没有真正找到任何东西。
这是我的全部 appveyor.xml
version: 1.0.{build}
image: Visual Studio 2017
configuration:
- Debug
- Release
build:
parallel: true
project: examples/sralloc.sln
test_script:
- '%APPVEYOR_BUILD_FOLDER%\examples\build\%PLATFORM%_%CONFIGURATION%\unittest.exe'
我分叉了你的 repo 并将以下内容添加到你的 appeyor.yml
:
platform:
- x64
和 cannot find the path
错误消失了。如果您在 YAML 中没有此设置,则构建 VM 上没有名为 platform
的环境变量,并且 msbuild
选择了 first in list 平台。
旁注:现在它停留在 Press any key to continue . . .
但我相信这是另一个主题,您可以通过更改命令行语法来修复它。
旁注 2:使用 this approach 上传文本结果(我假设您的测试可以在其中一种受支持的格式上创建 XML 结果。