-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Fix unit test compile flags propagation. #106128
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
57e4e52
[libc] Fix unit test compile flags propagation.
lntue 1c47a72
save current progress.
lntue b93fceb
Revert test changes.
lntue aa10b5f
Address comments.
lntue c769f57
Remove -static from unit tests.
lntue 5859bc8
Temporarily fix full build.
lntue 37c182a
Fix include dir for libMPFRWrapper.
lntue File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,19 +19,27 @@ function(add_unittest_framework_library name) | |
${TEST_LIB_SRCS} | ||
${TEST_LIB_HDRS} | ||
) | ||
target_include_directories(${lib} PUBLIC ${LIBC_SOURCE_DIR}) | ||
list(APPEND compile_options -fno-exceptions -fno-rtti) | ||
target_include_directories(${lib} PRIVATE ${LIBC_SOURCE_DIR}) | ||
if(TARGET libc.src.time.clock) | ||
target_compile_definitions(${lib} PRIVATE TARGET_SUPPORTS_CLOCK) | ||
endif() | ||
if(LIBC_COMPILER_HAS_FIXED_POINT) | ||
list(APPEND compile_options -ffixed-point) | ||
endif() | ||
target_compile_options(${lib} PUBLIC ${compile_options}) | ||
endforeach() | ||
_get_hermetic_test_compile_options(compile_options -nostdinc++) | ||
target_include_directories(${name}.hermetic PRIVATE ${LIBC_BUILD_DIR}/include) | ||
target_compile_options(${name}.hermetic PRIVATE ${compile_options}) | ||
|
||
if(LLVM_LIBC_FULL_BUILD) | ||
# TODO: Build test framework with LIBC_FULL_BUILD in full build mode after | ||
# making LibcFPExceptionHelpers and LibcDeathTestExecutors hermetic. | ||
set(LLVM_LIBC_FULL_BUILD "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we could make this an option to the function instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only temporary. I plan to remove it in the next 1-2 weeks. |
||
_get_common_test_compile_options(compile_options "" "") | ||
target_compile_options(${name}.unit PRIVATE ${compile_options}) | ||
set(LLVM_LIBC_FULL_BUILD ON) | ||
else() | ||
_get_common_test_compile_options(compile_options "" "") | ||
target_compile_options(${name}.unit PRIVATE ${compile_options}) | ||
endif() | ||
|
||
_get_hermetic_test_compile_options(compile_options "") | ||
target_include_directories(${name}.hermetic PRIVATE ${LIBC_INCLUDE_DIR}) | ||
target_compile_options(${name}.hermetic PRIVATE ${compile_options} -nostdinc++) | ||
|
||
if(TEST_LIB_DEPENDS) | ||
foreach(dep IN ITEMS ${TEST_LIB_DEPENDS}) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input argument for
_get_hermetic_test_compile_options
is actually forFLAGS
, which will be expanded to compile options. The purpose is that if you want to append extra compile options for your target, you should do that outside of the_get_..._compile_options
functions.