-
Notifications
You must be signed in to change notification settings - Fork 205
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
Modify ctest so we can package the testfiles and install on the target. #435
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,17 +139,18 @@ function(VOLK_ADD_TEST test_name executable_name) | |
#generate a shell script file that sets the environment and runs the test | ||
set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) | ||
file(WRITE ${sh_file} "#!${SHELL}\n") | ||
if(SHELL_SUPPORTS_IFS) | ||
file(APPEND ${sh_file} "export IFS=:\n") | ||
else() | ||
file(APPEND ${sh_file} "LL=\"$1\" && for tf in \"\$@\"; do LL=\"\${LL}:\${tf}\"; done\n") | ||
endif() | ||
|
||
#each line sets an environment variable | ||
foreach(environ ${environs}) | ||
file(APPEND ${sh_file} "export ${environ}\n") | ||
endforeach(environ) | ||
|
||
if (NOT CMAKE_CROSSCOMPILING) | ||
if(SHELL_SUPPORTS_IFS) | ||
file(APPEND ${sh_file} "export IFS=:\n") | ||
else() | ||
file(APPEND ${sh_file} "LL=\"$1\" && for tf in \"\$@\"; do LL=\"\${LL}:\${tf}\"; done\n") | ||
endif() | ||
|
||
#each line sets an environment variable | ||
foreach(environ ${environs}) | ||
file(APPEND ${sh_file} "export ${environ}\n") | ||
endforeach(environ) | ||
endif(CMAKE_CROSSCOMPILING) | ||
set(VOLK_TEST_ARGS "${test_name}") | ||
|
||
#redo the test args to have a space between each | ||
|
@@ -164,10 +165,15 @@ function(VOLK_ADD_TEST test_name executable_name) | |
#add the shell file as the test to execute; | ||
#use the form that allows for $<FOO:BAR> substitutions, | ||
#then combine the script arguments inside the script. | ||
add_test(NAME qa_${test_name} | ||
COMMAND ${SHELL} ${sh_file} ${TARGET_DIR_LIST} | ||
) | ||
|
||
if (NOT CMAKE_CROSSCOMPILING) | ||
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. I think most of lines 154-168 can be incorporated into both of these changes as one big change: either we're doing cross compiling or not; if so, then we use this indirect shell script to set various environment variables & such then internally call the test script; if not, then we just call the test directly. From a code-flow perspective, I prefer a full divide and conquer approach rather than this piecemeal. |
||
add_test(NAME qa_${test_name} | ||
COMMAND ${SHELL} ${sh_file} ${TARGET_DIR_LIST} | ||
) | ||
else() | ||
add_test(NAME qa_${test_name} | ||
COMMAND ${SHELL} ${test_name}_test.sh ${TARGET_DIR_LIST} | ||
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. Shouldn't this be |
||
) | ||
endif(CMAKE_CROSSCOMPILING) | ||
Comment on lines
+168
to
+176
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. So the difference here is 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. sh_file contains the path to the shell file also. This path is based on the location of the build system, which is not where tests are installed on the target. 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. Still, wouldn't it be better to write the value you need to |
||
endif(UNIX) | ||
|
||
if(WIN32) | ||
|
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.
How is one supposed to use it for cross-compiling?
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.
Now that's some documentation that I'd read.
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.
What I am doing is creating a package that has all the tests in it. So tests run on the target are not running in the build tree. Are we actually using the bit that runs qemu?
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.
We have 2 CI tests that use QEMU. I'd argue that we can consider these tests our cross compile tests.
I'd really love to make cross compiling as simple as possible. Given the fact that I don't have experience with that yet I'd like to understand how to use your changes though. Otherwise I fear things will break again soon.