googletest
googletest copied to clipboard
[Bug]: MacOSX build gtest failed with /test_output.xml not found
Describe the issue
everything runs fine but on teardown we write out our xml file for the test reporter on all other platforms this works fine but on macosx it fails to write out the xml file, this only started happening after the Xcode update so it code be an Xcode issue. This is causing our runs to fail on git ci.
[----------] Global test environment tear-down
[ FATAL ] /Users/<username>/Documents/GitHub/Torque3D/Engine/lib/gtest/googletest/src/gtest.cc:209:: Unable to open file "/test_detail.xml"
our entire main function for running tests:
int main(int argc, char** argv)
{
testing::GTEST_FLAG(output) = "xml:test_detail.xml";
testing::GTEST_FLAG(stack_trace_depth) = 10;
printf("Running main() from %s\n", __FILE__);
// Initialize Google Test.
testing::InitGoogleTest(&argc, argv);
// torques handle command.
StandardMainLoop::init();
// setup torque for testing.
GFXInit::enumerateAdapters();
GFXAdapter* a = GFXInit::chooseAdapter(NullDevice, "");
GFXDevice* newDevice = GFX;
if (newDevice == NULL)
newDevice = GFXInit::createDevice(a);
newDevice->setAllowRender(false);
// required for tests that add gui elements.
Con::evaluate("if (!isObject(GuiDefaultProfile)) new GuiControlProfile(GuiDefaultProfile){}; if (!isObject(GuiTooltipProfile)) new GuiControlProfile(GuiTooltipProfile){};");
// this call is to add the tests that exist in runTests.tscript
// note these tests will not appear in the test explorer.
if(argc > 1)
StandardMainLoop::handleCommandLine(argc, (const char**)argv);
// run tests.
int res = RUN_ALL_TESTS();
StandardMainLoop::shutdown();
return 0;
}
Steps to reproduce the problem
run gtest with an output file
What version of GoogleTest are you using?
version 1.14
What operating system and version are you using?
Macosx Sonoma 14.3
What compiler and version are you using?
Xcode 15.3
What build system are you using?
cmake 3.27.0
Additional context
No response
I think this is unlikely to be a GoogleTest bug, but information to fully reproduce the issue is missing. For example, what is the current working directory when the test is executed? The fact that the error message says /test_detail.xml
makes me think this is being executed with the root directory as the working directory, and you may not have permission to write to that directory by default.