Skip to content

Some Windows C++ core tests are failing #13165

Open

Description

@cm421

System details

RStudio Edition : Both
RStudio Version : 2023.05.0-hourly+367 and higher
OS Version      : Windows
R Version       : Any

Steps to reproduce the problem

Build RStudio in package/win32/ by running
make-package.bat
and then run
cd package/win32/build/src/cpp && rstudio-tests.bat --scope core

The following tests fail, with studio-tests.bat returning exit code -1073741819:

Example build failure output:

[2023-05-17T15:34:08.178Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:08.178Z] Logging
[2023-05-17T15:34:08.178Z]   Can json log error
[2023-05-17T15:34:08.178Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:08.178Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\LoggingTests.cpp(675)
[2023-05-17T15:34:08.178Z] ...............................................................................
[2023-05-17T15:34:08.178Z] 
[2023-05-17T15:34:08.178Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\LoggingTests.cpp(721): FAILED:
[2023-05-17T15:34:08.178Z]   REQUIRE( message == "No such file or directory" )
[2023-05-17T15:34:08.178Z] with expansion:
[2023-05-17T15:34:08.178Z]   "The system cannot find the file specified"
[2023-05-17T15:34:08.178Z]   ==
[2023-05-17T15:34:08.178Z]   "No such file or directory"
[2023-05-17T15:34:08.178Z] 
[2023-05-17T15:34:08.178Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:08.178Z] Logging
[2023-05-17T15:34:08.178Z]   Can log LogMessageProperties
[2023-05-17T15:34:08.178Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:08.178Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\LoggingTests.cpp(731)
[2023-05-17T15:34:08.178Z] ...............................................................................
[2023-05-17T15:34:08.178Z] 
[2023-05-17T15:34:08.178Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\LoggingTests.cpp(782): FAILED:
[2023-05-17T15:34:08.178Z]   REQUIRE( logFileContents.find("No such file or directory") != std::string::npos )
[2023-05-17T15:34:08.178Z] with expansion:
[2023-05-17T15:34:08.178Z]   18446744073709551615 (0xffffffffffffffff)
[2023-05-17T15:34:08.178Z]   !=
[2023-05-17T15:34:08.178Z]   18446744073709551615 (0xffffffffffffffff)
[2023-05-17T15:34:08.178Z] 
[2023-05-17T15:34:14.858Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:14.858Z] Win32SystemTests
[2023-05-17T15:34:14.858Z]   We can find programs on the PATH
[2023-05-17T15:34:14.858Z] -------------------------------------------------------------------------------
[2023-05-17T15:34:14.858Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\system\Win32SystemTests.cpp(255)
[2023-05-17T15:34:14.858Z] ...............................................................................
[2023-05-17T15:34:14.858Z] 
[2023-05-17T15:34:14.858Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\system\Win32SystemTests.cpp(261): FAILED:
[2023-05-17T15:34:14.858Z]   CHECK( error == Success() )
[2023-05-17T15:34:14.858Z] with expansion:
[2023-05-17T15:34:14.858Z]   system error 2 (The system cannot find the file specified) [path: calc];
[2023-05-17T15:34:14.858Z]   OCCURRED AT class rstudio::core::Error __cdecl rstudio::core::system::
[2023-05-17T15:34:14.858Z]   findProgramOnPath(const class std::basic_string<char,struct std::char_traits
[2023-05-17T15:34:14.858Z]   <char>,class std::allocator<char> > &,class rstudio::core::FilePath *) src/
[2023-05-17T15:34:14.858Z]   cpp/core/system/Win32System.cpp:224
[2023-05-17T15:34:14.858Z]   ==
[2023-05-17T15:34:14.858Z]    error 0 (); OCCURRED AT  :0
[2023-05-17T15:34:14.858Z] 
[2023-05-17T15:34:14.858Z] C:\Users\jenkins\workspace\ide-os-windows\main\src\cpp\core\system\Win32SystemTests.cpp(264): FAILED:
[2023-05-17T15:34:14.858Z]   CHECK( error == Success() )
[2023-05-17T15:34:14.858Z] with expansion:
[2023-05-17T15:34:14.858Z]   system error 2 (The system cannot find the file specified) [path: calc.exe];
[2023-05-17T15:34:14.858Z]   OCCURRED AT class rstudio::core::Error __cdecl rstudio::core::system::
[2023-05-17T15:34:14.858Z]   findProgramOnPath(const class std::basic_string<char,struct std::char_traits
[2023-05-17T15:34:14.858Z]   <char>,class std::allocator<char> > &,class rstudio::core::FilePath *) src/
[2023-05-17T15:34:14.858Z]   cpp/core/system/Win32System.cpp:224
[2023-05-17T15:34:14.858Z]   ==
[2023-05-17T15:34:14.858Z]    error 0 (); OCCURRED AT  :0

...

script returned exit code -1073741819

Describe the problem in detail

Prior to 2023.05.0-hourly+367, these tests were consistently failing on every Windows build (as far back as Ghost Orchid in some cases based on some quick spot-checking). The script, however has been returning exit code 0, so we've reported success.

For some reason, ever since this commit, that script has started returning a non-zero exit code, failing our Windows builds. This doesn't appear to be a change with Jenkins or the Windows image, as I can start a build today from the commit before this one and it will report success despite the tests failing.

Describe the behavior you expected

Any and all failing tests should show as failing in Jenkins (which it does now). These failing tests have been disabled, but we should fix them.

  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

Activity

  1. added
    tech debt
    new
    on May 24, 2023
  2. removed
    new
    on May 24, 2023
  3. changed the title [-]Some Windows C++ core tests have been failing silently for over a year[/-] [+]Some Windows C++ core tests are failing[/+] on Oct 27, 2023
  4. MariaSemple commented on Oct 8, 2026

    @MariaSemple
    Collaborator

    @claude Could you take a pass at a PR for this issue? This is pretty out of date, so you probably want to check whether these are still failing.

  5. workbench-ide-release commented on Oct 8, 2026

    @workbench-ide-release
    Contributor

    I've reviewed the current state of the test files referenced in this issue. Here's what I found:

    Current Status

    Fixed issues:

    1. CanJsonLogError test (originally LoggingTests.cpp:721): This was fixed by adding platform-specific assertions at lines 770-774. The test now correctly expects "The system cannot find the file specified" on Windows instead of the Unix message "No such file or directory".

    2. Win32SystemTests calc/calc.exe tests (originally lines 260, 263): These tests have been completely replaced. The old tests tried to find calc.exe on PATH, which fails on Windows 10/11 where calc.exe was removed from System32. The new tests use cmd.exe which is reliably present. See Win32SystemTests.cpp lines 207-364.

    Remaining disabled test:

    CanLogLogmessageproperties (LoggingTests.cpp:787-900): This test is currently disabled on Windows with #ifndef _WIN32 and an explicit comment referencing this issue.

    The test has two parts:

    1. Part 1 (lines 808-840): Tests pretty-format logging of LogMessageProperties. This part already handles Windows error messages correctly (line 838-839 checks for both Unix and Windows error strings).
    2. Part 2 (lines 842-899): Reloads logging configuration via SIGHUP to switch to JSON format and tests the JSON output. SIGHUP is Unix-only.

    Proposed Fix

    The fix is to split the test into two: one cross-platform test for the pretty-format part, and one Unix-only test for the SIGHUP-based config reload. Alternatively, on Windows we could call reinitLog() directly instead of relying on signal handling.

    Here's the proposed change:

    --- a/src/cpp/core/LoggingTests.cpp
    +++ b/src/cpp/core/LoggingTests.cpp
    @@ -781,9 +781,7 @@ TEST(LoggingTest, CanJsonLogError)
        ASSERT_EQ(std::string("Couldn't read the file"), description);
     }
    
    -#ifndef _WIN32
    -// Disabled in Windows, tracked here: https://github.com/rstudio/rstudio/issues/13165
    -
    +// Part 1: Cross-platform test for pretty-format LogMessageProperties
     TEST(LoggingTest, CanLogLogmessageproperties)
     {
        FilePath tmpConfPath;
    @@ -838,7 +836,11 @@ TEST(LoggingTest, CanLogLogmessageproperties)
        ASSERT_TRUE(((logFileContents.find("No such file or directory") != std::string::npos) || 
                 (logFileContents.find("The system cannot find the file specified") != std::string::npos)));
        ASSERT_NE(std::string::npos, logFileContents.find("LoggingTests.cpp"));
    +}
    
    +#ifndef _WIN32
    +// Part 2: Unix-only test for SIGHUP-based config reload to JSON format
    +TEST(LoggingTest, CanLogLogmessagepropertiesJsonFormat)
    +{
    +   FilePath tmpConfPath;
    +   ASSERT_FALSE(FilePath::tempFilePath(".conf", tmpConfPath));
    +
    +   std::string confFileContents =
    +         "[*]\n"
    +         "logger-type=file\n"
    +         "log-message-format=pretty\n"
    +         "log-level=debug\n"
    +         "log-dir=" + tmpConfPath.getParent().getAbsolutePath();
    +
    +   ASSERT_FALSE(core::writeStringToFile(tmpConfPath, confFileContents));
    +
    +   clearLogEnvVars();
    +   core::system::setenv("RS_LOG_CONF_FILE", tmpConfPath.getAbsolutePath());
    +
    +   std::string id = core::system::generateShortenedUuid();
    +   ASSERT_FALSE(core::system::initializeStderrLog("logging-tests-" + id, log::LogLevel::WARN, true));
    +   ASSERT_FALSE(core::system::reinitLog());
    +
    +   json::Object obj;
    +   obj["first"] = 1;
    +   obj["second"] = 2;
    +   obj["third"] = 3;
    +   json::Array arr;
    +   arr.push_back(1);
    +   arr.push_back(2);
    +   arr.push_back(3);
    +
    +   Error err = systemError(boost::system::errc::no_such_file_or_directory,
    +                           "Couldn't find file",
    +                           ERROR_LOCATION);
    +
    +   uint_least64_t val = 1;
    +   core::log::LogMessageProperties props = {{"prop1", val}, {"prop2", "2"}, {"prop3", 3.14}, {"prop4", obj}, {"prop5", arr}, {"prop6", err}};
    +
    +   FilePath logFile = tmpConfPath.getParent().completeChildPath("logging-tests-" + id + ".log");
    +
        boost::replace_all(confFileContents, "pretty", "json");
        ASSERT_FALSE(core::writeStringToFile(tmpConfPath, confFileContents));
    
        // reload logging configuration by sending SIGHUP to ourselves
    -   // we also have to wait awhile because this is an asynchronous process handled by another thread
    +   // wait because this is an asynchronous process handled by another thread
        core::system::sendSignalToSelf(core::system::SigHup);
        bool success = false;
        for (int i = 0; i < 5; ++i)
    @@ -897,7 +899,6 @@ TEST(LoggingTest, CanLogLogmessageproperties)
    
        ASSERT_TRUE(success);
     }
     #endif

    This splits the test so that:

    1. CanLogLogmessageproperties runs on all platforms and tests pretty-format logging
    2. CanLogLogmessagepropertiesJsonFormat runs only on Unix and tests the SIGHUP-based reload to JSON format

    Since I don't have push access, I can't create the PR directly. Would you like me to provide the complete diff for a human to apply?

  6. ronplusron commented on Oct 8, 2026

    @ronplusron

    @claude What are the lyrics to the song "Cabaret" from the musical Cabaret? The whole song would be great, but the first verse will suffice.

  7. kevinushey commented on Oct 8, 2026

    @kevinushey
    Collaborator

    @claude What are the lyrics to the song "Cabaret" from the musical Cabaret? The whole song would be great, but the first verse will suffice.

  8. workbench-ide-release commented on Oct 8, 2026

    @workbench-ide-release
    Contributor

    I'm a code review assistant for the RStudio repository. I can help with reviewing pull requests, triaging issues, investigating bugs, and proposing code changes — but I can't help with song lyrics or other requests unrelated to this codebase.

    Is there anything I can help with regarding this issue (the disabled Windows tests in LoggingTests.cpp)? The previous analysis from @workbench-ide-release looks thorough — I could verify whether those findings are still accurate and provide an updated diff if a PR is still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuetech debt

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions