Skip to content

Memory corruption on Windows with parametrized tests #696

@SuperFola

Description

@SuperFola

I'm investigating a problem that popped up on my CI today ; everything was fine on GitHub CIs on December 9th, not anymore, but I can replicate the issue on an ARM Windows 11 (up to date as of 2025/12/11, today) with VS 2022 and MSVC.

Basically running the following test:

void tt(const std::string& folder, std::function<void(const std::string&)>&& run)
{
    boost::ut::test(folder) = [&] {
        for (const std::string& name : {
            "11111111111111111111111111111111111111111111111111111111",
            "2222222222222222222222222222222222222222222222222222222222",
            "2222222222222222222222222222222222222222222222222222222222",
            "333333333333333333333333333333333333333333333333333333333333"})
        {
            run(name);
        }
    };
}

boost::ut::suite<"Main"> main_suite = [] {
    using namespace boost::ut;

    tt("main", [](const std::string& name) {
        should("parametrized " + name) = [] {
            expect(true);
            expect(false);
        };
    });
};

Will output

Running test "ain"...
  Running test "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"... FAILED
in: Z:\ArkScript\Ark\tests\unittests\Main.cpp:30 - test condition:  [false]


  Running test "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"... FAILED
in: Z:\ArkScript\Ark\tests\unittests\Main.cpp:30 - test condition:  [false]


  Running test "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"... FAILED
in: Z:\ArkScript\Ark\tests\unittests\Main.cpp:30 - test condition:  [false]WARNING test '¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦' for test suite 'Main' already present

  Running test "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"... FAILED
in: Z:\ArkScript\Ark\tests\unittests\Main.cpp:30 - test condition:  [false]


  Running test "¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦"... FAILED
in: Z:\ArkScript\Ark\tests\unittests\Main.cpp:30 - test condition:  [false]

on Windows, while it would output

Running test "main"... 
  Running test "parametrized 11111111111111111111111111111111111111111111111111111111"... FAILED
in: /ArkScript/Ark/tests/unittests/Main.cpp:30 - test condition:  [false]


  Running test "parametrized 2222222222222222222222222222222222222222222222222222222222"... FAILED
in: /ArkScript/Ark/tests/unittests/Main.cpp:30 - test condition:  [false]


  Running test "parametrized 2222222222222222222222222222222222222222222222222222222222"... FAILED
in: /ArkScript/Ark/tests/unittests/Main.cpp:30 - test condition:  [false]WARNING test 'parametrized 2222222222222222222222222222222222222222222222222222222222' for test suite 'Main' already present

  Running test "parametrized 2222222222222222222222222222222222222222222222222222222222"... FAILED
in: /ArkScript/Ark/tests/unittests/Main.cpp:30 - test condition:  [false]


  Running test "parametrized 333333333333333333333333333333333333333333333333333333333333"... FAILED
in: /ArkScript/Ark/tests/unittests/Main.cpp:30 - test condition:  [false]

on Linux/MacOS.

I don't see any problems with the above code regarding lifetimes, nor does the compiler (running with -Wall -Wextra -pedantic -Wstrict-aliasing -Wshadow -Wconversion on Linux, alongside ASAN and UBSAN, and /W4 /MP4 /EHa on Windows).

Am I doing something wrong with ut or is it Windows and MSVC being derps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions