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

Made unit testing enhancements if HWY_TEST_STANDALONE is 1 #2323

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

johnplatts
Copy link
Contributor

Added support for --gtest_filter= and --gtest_list_tests command line arguments if HWY_TEST_STANDALONE is 1 to allow CMake to discover the Highway unit tests using the gtest_discover_tests action without actually running the unit tests and to allow CTest to execute only specific unit tests.

Also added a HWY_TEST_STANDALONE option to CMakeLists.txt that will prevent CMake from downloading Google Test and that will add the -DHWY_TEST_STANDALONE=1 option to the C++ compiler flags for the Google Highway unit tests if the HWY_TEST_STANDALONE CMake option is set to ON.

The HWY_TEST_STANDALONE CMake option defaults to ON when compiling with MSVC and the HWY_TEST_STANDALONE option defaults to OFF when compiling with GCC or Clang.

jan-wassenberg
jan-wassenberg previously approved these changes Sep 9, 2024
Copy link
Member

@jan-wassenberg jan-wassenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea, thanks for adding :)

hwy/tests/hwy_gtest.h Outdated Show resolved Hide resolved
if (!curr_arg) {
break;
}
if (curr_arg[0] == '-' && curr_arg[1] == '-' && curr_arg[2] == 'g' &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about hoisting these comparisons into a function that takes two const char*? (for matching list_test's \0, we'd have to do this outside the new function because the test string always has \0)
I'd think shorter/more typical code is preferable for arg parsing.

@copybara-service copybara-service bot merged commit b1682dd into google:master Oct 2, 2024
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants