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

Modify ctest so we can package the testfiles and install on the target. #435

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

balister
Copy link
Contributor

This lets us run the volk tests on the embedded target easily. Major changes
are not including full paths to files, since these were based on the build
system paths and not setting paths to find libraries in the build directory.

Signed-off-by: Philip Balister [email protected]

This lets us run the volk tests on the embedded target easily. Major changes
are not including full paths to files, since these were based on the build
system paths and not setting paths to find libraries in the build directory.

Signed-off-by: Philip Balister <[email protected]>
Copy link
Contributor

@jdemel jdemel left a comment

Choose a reason for hiding this comment

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

I have some comments regarding this PR.
Mostly, can you add info on how does this change make life easier for cross compiled libraries. How does one use it in that case? An example added to the documentation would be great. e.g. in our README file in the cross-compile section.

Unfortunately, our TravisCI is still down. Thus, we can't see the impact of these particular changes in our cross compile tests with QEMU.

Comment on lines +168 to +176
if (NOT CMAKE_CROSSCOMPILING)
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}
)
endif(CMAKE_CROSSCOMPILING)
Copy link
Contributor

Choose a reason for hiding this comment

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

So the difference here is {sh_file} vs {test_name}_test.sh. Wouldn't it be sensible to write the correct filename into the variable {sh_file} directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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 ${sh_file}? This would make this particular section simpler. The other section l142ff would benefit as well because comments on why things are done the way they are done could go there. I'd expect your short explanation why this is necessary there.

Comment on lines +142 to +153
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)
Copy link
Contributor

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?

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@michaelld michaelld left a comment

Choose a reason for hiding this comment

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

I'm not sure your solution here is the right solution ... it's really not clear to me how it helps allow testing function when cross-building. I'd need to do some cross-building & testing ... which is unlikely any time soon given my current workload. So ... it's on you to help me/us understand how your tweaks here -do- help.

)
else()
add_test(NAME qa_${test_name}
COMMAND ${SHELL} ${test_name}_test.sh ${TARGET_DIR_LIST}
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh ... just to be explicit?

COMMAND ${SHELL} ${sh_file} ${TARGET_DIR_LIST}
)

if (NOT CMAKE_CROSSCOMPILING)
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

@jdemel
Copy link
Contributor

jdemel commented May 18, 2021

@balister I'd like to see these improvements in a release. Could you address the comments and maybe rebase this PR? A rebase should trigger more CI as well.

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.

4 participants