-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(test): run tests and update build result #88
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ddce5c6
refactor(test): update results as fixture cleanups
JohelEGP 1267251
refactor(test): order build after codegen
JohelEGP ed9d696
feat(test): run tests and update build result
JohelEGP 65a99b9
fix(test): remove outdated condition
JohelEGP cb398b0
refactor: execute tests without developer mode
JohelEGP 857240f
feat(test): copy new or changed build results only
JohelEGP 369aa23
feat(test): check expected build results
JohelEGP cb0a142
fix(test): add non-`check` tests when developing
JohelEGP 963462c
fix(test): add glob for new error tests
JohelEGP 08de0a6
fix: account for C++23 tests
JohelEGP 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
execute_process( | ||
COMMAND "${CMAKE_COMMAND}" --install "build" --prefix "_local" | ||
COMMAND_ERROR_IS_FATAL ANY | ||
) | ||
find_package(test-case REQUIRED PATHS "${CMAKE_CURRENT_BINARY_DIR}/_local" NO_DEFAULT_PATH) | ||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" | ||
-E copy | ||
"${TEST_CASE_EXECUTABLE}" | ||
"@BUILD_RESULTS_DIR@/test.exe" | ||
) | ||
execute_process( | ||
COMMAND | ||
"${CMAKE_COMMAND}" | ||
-D "OUTPUT_FILE=${OUTPUT_FILE}" | ||
-P "@CMAKE_CURRENT_BINARY_DIR@/ExecuteWithRedirection.cmake" | ||
-- | ||
"./test.exe" | ||
COMMAND_ERROR_IS_FATAL ANY | ||
WORKING_DIRECTORY "@BUILD_RESULTS_DIR@" | ||
) | ||
execute_process(COMMAND "${CMAKE_COMMAND}" -E rm "@BUILD_RESULTS_DIR@/test.exe") |
This file contains 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
if (NOT "${CMAKE_ARGV5}" STREQUAL "--") | ||
message(FATAL_ERROR "Unexpected argument.") | ||
endif () | ||
foreach (i RANGE 6 ${CMAKE_ARGC}) | ||
list(APPEND command_args "${CMAKE_ARGV${i}}") # Probably doesn't handle nested `;`. | ||
endforeach () | ||
execute_process( | ||
COMMAND ${command_args} | ||
OUTPUT_VARIABLE OUTPUT | ||
ERROR_VARIABLE OUTPUT | ||
ECHO_OUTPUT_VARIABLE | ||
ECHO_ERROR_VARIABLE | ||
) | ||
file(WRITE "${OUTPUT_FILE}" "${OUTPUT}") |
This file contains 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Set `OLD_BUILD_RESULTS_DIRS`. | ||
file( | ||
GLOB build_result_dirs | ||
RELATIVE "@TEST_RESULTS_DIR@" | ||
"@TEST_RESULTS_DIR@/@compiler_id@-*" | ||
) | ||
list(SORT build_result_dirs) | ||
list(FIND build_result_dirs "@COMPILER_ITEM_NAME@" i) | ||
list(SUBLIST build_result_dirs 0 ${i} OLD_BUILD_RESULTS_DIRS) | ||
list(REVERSE OLD_BUILD_RESULTS_DIRS) | ||
|
||
function(cppfront_find_build_result_file out_var) | ||
cmake_parse_arguments(PARSE_ARGV 0 ARG "OLD_ONLY" "RESULT_FILE" "") | ||
|
||
if (NOT ARG_OLD_ONLY) | ||
set(extra_item "@COMPILER_ITEM_NAME@") | ||
endif () | ||
|
||
foreach (build_results_dir IN ITEMS "${extra_item}" LISTS OLD_BUILD_RESULTS_DIRS) | ||
set(result_file "@TEST_RESULTS_DIR@/${build_results_dir}/${ARG_RESULT_FILE}") | ||
if (EXISTS "${result_file}") | ||
set("${out_var}" "${result_file}" PARENT_SCOPE) | ||
return() | ||
endif () | ||
endforeach () | ||
|
||
unset("${out_var}" PARENT_SCOPE) | ||
endfunction() |
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.
These only work with "The Makefile Generators and the Ninja generator".
The alternative is
CMAKE_EXPORT_COMPILE_COMMANDS
.I already handle that at https://github.com/JohelEGP/jegp.cmake_modules/blob/master/modules/.detail/JEGPReadExportedCompileCommand.cmake.
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.
I would still need to build and install.
So I'd compile twice to get the output.
Maybe I can hijack
CMAKE_CXX_COMPILER
and use it like
CMAKE_CXX_COMPILER_LAUNCHER
.