Skip to content

fixing issue 921#922

Merged
lemire merged 2 commits intomasterfrom
issue921
Jan 15, 2026
Merged

fixing issue 921#922
lemire merged 2 commits intomasterfrom
issue921

Conversation

@lemire
Copy link
Copy Markdown
Member

@lemire lemire commented Jan 15, 2026

When git fails to return the files (i.e., when we are not under git control), we should just have the check_feature_macros test succeed (with a warning message).

Fixes: #921

@lemire lemire requested a review from clausecker January 15, 2026 17:34
@clausecker
Copy link
Copy Markdown
Collaborator

Does the test framework provide a mechanism to skip unit tests? Perhaps that would be more appropriate.

@lemire
Copy link
Copy Markdown
Member Author

lemire commented Jan 15, 2026

Does the test framework provide a mechanism to skip unit tests?

I am not sure what you mean. You definitely can skip running the tests. You can also skip a specific unit test ctest -E "^exactly_my_test_name$".

If you mean skipping this one test when the files are not under git... it is essentially what my PR does, it tries to recover the files, but if it can't, it just does not fail the test.

@clausecker
Copy link
Copy Markdown
Collaborator

Some unit test frameworks have a SKIP result for unit tests in addition to the usual PASS/FAIL ones. SKIP means “test was not run and we cannot say if it would pass or not.” This is more meaningful than just having the unit test pass, as it makes clear that nothing was actually tested.

CMake-based tests support this through the SKIP_RETURN_CODE variable. Maybe that is applicable here?

Comment thread scripts/check_feature_macros.py Outdated
if not files:
print("No .cpp or .h files found in the Git repository" + (" in src/ or include/" if args.limit else "") + ".")
sys.exit(1) # Exit with error code if no files are found
sys.exit(0) # Exit with success code if no files are found, see https://github.com/simdutf/simdutf/issues/921
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
sys.exit(0) # Exit with success code if no files are found, see https://github.com/simdutf/simdutf/issues/921
sys.exit(2) # Exit with success code if no files are found, see https://github.com/simdutf/simdutf/issues/921

And then in tests/CMakeLists.txt, set the SKIP_RETURN_CODE property of this test to 2.

@lemire
Copy link
Copy Markdown
Member Author

lemire commented Jan 15, 2026

@clausecker Yes, well ahead of you. Check my last commit.

I used 142 instead of 2 because 142 is 2 * 71 which is obviously good.

@clausecker
Copy link
Copy Markdown
Collaborator

I like it! LGTM.

@lemire
Copy link
Copy Markdown
Member Author

lemire commented Jan 15, 2026

@clausecker I will let the tests go green.

@lemire lemire merged commit 2950a43 into master Jan 15, 2026
108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit test failure when building the release tarball: check_feature_macros

2 participants