Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file Jenkins作业失败,Google测试通过_Batch File_Jenkins_Googletest - Fatal编程技术网

Batch file Jenkins作业失败,Google测试通过

Batch file Jenkins作业失败,Google测试通过,batch-file,jenkins,googletest,Batch File,Jenkins,Googletest,我试图在批处理脚本中运行Google测试,以在Jenkins中运行测试,而测试全部通过,Jenkins作业状态为失败 以下是我正在使用的批次: @echo off setlocal ENABLEDELAYEDEXPANSION call "C:\Program Files (x86)\Maxim Integrated\eclipse\eclipsec.exe" --launcher.suppressErrors -nosplash -application org.eclipse.cdt.ma

我试图在批处理脚本中运行Google测试,以在Jenkins中运行测试,而测试全部通过,Jenkins作业状态为失败

以下是我正在使用的批次:

@echo off
setlocal ENABLEDELAYEDEXPANSION

call "C:\Program Files (x86)\Maxim Integrated\eclipse\eclipsec.exe" --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import ".\Loader" -data ./ -cleanBuild "Loader/UnitTest" && (
call .\Loader\UnitTest\Loader.exe
echo Loader status = !ERRORLEVEL!
)

echo !ERRORLEVEL!
下面是main()所在的AllTest.cpp:

我在一些测试中打印了“r”,它是正确的(如果测试失败,则为0或1) 即使我硬编码了一个“42”值作为回报,它也不起作用。只有在删除RUN_ALL_TESTS()时,我才能获得此硬编码值

通过这样的作弊:

set ERRORLEVEL= 0
詹金斯仍然在吐一份失败的工作:-/


我遗漏了什么?

我使用以下方法解决了这个问题:


因此,我在GTest运行后调用gawk,让Jenkins高兴,并根据链接帖子使用Jenkins的JUnit测试插件。

set ERRORLEVEL=0
将不起作用。这只会创建与退出代码不同的环境变量ERRORLEVEL。尝试退出/b0
set ERRORLEVEL= 0