google / googletest

GoogleTest - Google Testing and Mocking Framework
https://google.github.io/googletest/
BSD 3-Clause "New" or "Revised" License
33.7k stars 9.98k forks source link

[Bug]: testing::KilledBySignal on MinGW Windows is not defined #4460

Closed Raffaello closed 4 months ago

Raffaello commented 5 months ago

Describe the issue

compiling is causing member not found.

looking at the source code here: https://github.com/google/googletest/blob/v1.14.0/googletest/src/gtest-death-test.cc#L187-L203

it looks like is missing a define if (OS_WINDOWS && !MINGW) or maybe !defined(__GCC) as mingw has signal handlers like unix/linu

Steps to reproduce the problem

for e.g. just use an ASSERT_EXIT on a windows (using GCC through MinGW)

What version of GoogleTest are you using?

1.13

but just checked on 1.14 and it looks like similar

What operating system and version are you using?

Windows 11,

What compiler and version are you using?

gcc -v

Using built-in specs.
COLLECT_GCC=C:\msys64\ucrt64\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-13.2.0/configure --prefix=/ucrt64 --with-local-prefix=/ucrt64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/ucrt64/include --libexecdir=/ucrt64/lib --enable-bootstrap --enable-checking=release --with-arch=nocona --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++,jit --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts --enable-libstdcxx-time --disable-libstdcxx-pch --enable-lto --enable-libgomp --disable-libssp --disable-multilib --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/ucrt64 --with-mpfr=/ucrt64 --with-mpc=/ucrt64 --with-isl=/ucrt64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://github.com/msys2/MINGW-packages/issues --with-gnu-as --with-gnu-ld --disable-libstdcxx-debug --with-boot-ldflags=-static-libstdc++ --with-stage1-ldflags=-static-libstdc++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (Rev3, Built by MSYS2 project)

What build system are you using?

cmake --version
cmake version 3.28.1

Additional context

i think it is only a matter of considering mingw when OS_WINDOWS macro is defined, mostly. at least as a shallow overview.

higher-performance commented 4 months ago

Hi, could you provide (step-by-step) the command-line you're using to generate & build the CMake projects, along with any relevant environment variables etc.

MSYS2 isn't officially supported, but if you can provide easy repro instructions I can see if there's a quick fix.

Raffaello commented 4 months ago

Hi, could you provide (step-by-step) the command-line you're using to generate & build the CMake projects, along with any relevant environment variables etc.

MSYS2 isn't officially supported, but if you can provide easy repro instructions I can see if there's a quick fix.

Hi @higher-performance,

I have moved on using a work-around and installing a signal handler for those specific tests so i can test that they return that specific exit code from the signal handler, basically redesigned a little the test.

Besides,

No real special environment vairables, nor either fancy CMAKE settings. If asking about googletest itself, i just downloaded&instaled from MSYS2 package manager.

higher-performance commented 4 months ago

Ah okay thanks, in that case I'll close this then since you moved on. Thanks for the update.