Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests relying on assert (release builds) #1945

Open
dmitriy-sobolev opened this issue Nov 21, 2024 · 0 comments
Open

Fix tests relying on assert (release builds) #1945

dmitriy-sobolev opened this issue Nov 21, 2024 · 0 comments
Labels
bug test Test only Change

Comments

@dmitriy-sobolev
Copy link
Contributor

Describe the Bug:
Some tests rely on assert for issuing errors, but there is no any handling of NDEBUG e.g. on CMake side. That may result in a worse test coverage for release builds.

To Reproduce:
The steps to reproduce the behavior (Windows as an example):

# Comment line in test_config.h to trigger an error:
// #define _PSTL_TEST_COMPLEX_OP_BROKEN (_MSVC_STL_VERSION && _MSVC_STL_VERSION <= _PSTL_TEST_LATEST_MSVC_STL_VERSION)

# The error is detected in the debug build
cmake -GNinja -DCMAKE_CXX_COMPILER=icx -DCMAKE_BUILD_TYPE=debug -DONEDPL_DEVICE_TYPE=CPU path\to\oneDPL
ninja run-asin.pass
1/1 Test #468: asin.pass ........................Exit code 0xc0000409
***Exception:   0.99 sec
Assertion failed: std::isinf(r.imag()), file C:\repos\oneDPL\test\xpu_api\numerics\complex.number\complex.transcendentals\asin.pass.cpp, line 89

# The error is overlooked in the release build
cmake -GNinja -DCMAKE_CXX_COMPILER=icx -DCMAKE_BUILD_TYPE=release -DONEDPL_DEVICE_TYPE=CPU C:\repos\oneDPL
ninja run-asin.pass
1/1 Test #468: asin.pass ........................   Passed    0.84 sec

# Adding "#undef NDEBUG" to the top of asin.pass.cpp results in the triggering of the assertion in the release build as well.

Expected Behavior:
The tests are equally covered in the release and debug builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug test Test only Change
Projects
None yet
Development

No branches or pull requests

1 participant