I'm trying to run Google test in a batch script to run the tests in Jenkins and whereas the tests all pass, Jenkins job status is FAILURE.
here is the batch I'm using:
@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!
And here is the AllTest.cpp where the main() reside:
#include "gtest/gtest.h"
extern "C" void __gcov_flush();
int main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
int r = RUN_ALL_TESTS();
__gcov_flush();
return r;
}
I've printed "r" in some testing and it is correct (0 or 1 if a test fails) Even if I hardcoded a "42" value in return, it does not work. I get this hardcoded value only if I remove RUN_ALL_TESTS().
And event by cheating like this:
set ERRORLEVEL= 0
Jenkins still spit a FAILURE job :-/
What am I missing?