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

Test package detection in a systematic way #21343

Conversation

alalazo
Copy link
Member

@alalazo alalazo commented Jan 27, 2021

closes #18175

This is a PR competing with #18175, to try a different implementation where all the data for the detection tests is in the corresponding package.py.

Comment on lines 654 to 704
# Data used to test external package detection
detection_tests = {
'paths': [
# Ubuntu 18.04, system compilers without Fortran
{
'layout': [
{'subdir': ['bin'], 'name': 'gcc', 'output': 'echo 7.5.0'},
{'subdir': ['bin'], 'name': 'g++', 'output': 'echo 7.5.0'}
],
'results': [{'spec': 'gcc@7.5.0 languages=c,c++'}]
},
# Mock a version < 7 of GCC that requires -dumpversion and
# errors with -dumpfullversion
{
'layout': [
{
'subdir': ['bin'], 'name': 'gcc-5',
'output': """
if [[ "$1" == "-dumpversion" ]] ; then
echo "5.5.0"
else
echo "gcc-5: fatal error: no input files"
echo "compilation terminated."
exit 1
fi
"""
},
{'subdir': ['bin'], 'name': 'g++-5', 'output': 'echo 5.5.0'},
{'subdir': ['bin'], 'name': 'gfortran-5', 'output': 'echo 5.5.0'}
],
'results': [
{'spec': 'gcc@5.5.0 languages=c,c++,fortran'}
]
},
# Multiple compilers present at the same time
{
'layout': [
{'subdir': ['bin'], 'name': 'x86_64-linux-gnu-gcc-6', 'output': 'echo 6.5.0'},
{'subdir': ['bin'], 'name': 'x86_64-linux-gnu-gcc-10', 'output': 'echo 10.1.0'},
{'subdir': ['bin'], 'name': 'x86_64-linux-gnu-g++-10', 'output': 'echo 10.1.0'}
],
'results': [
{'spec': 'gcc@6.5.0 languages=c'},
{'spec': 'gcc@10.1.0 languages=c,c++'}
]
}
]
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@scheibelp Is this along the lines of what you had in mind?

This commit adds a new test that iterates through
all packages that implement detection and have
a `detection_test.yaml` file alongside `package.py`.
This YAML file contains specifications to perform
detection tests.
This is much faster than going through Spack API that imports
Python modules.
@alalazo alalazo force-pushed the feature/test_for_package_detection_in_package_py branch from 5f22785 to b65504d Compare February 8, 2021 13:18
@alalazo alalazo closed this Mar 3, 2021
@alalazo alalazo reopened this Mar 3, 2021
@alalazo
Copy link
Member Author

alalazo commented Feb 11, 2022

Closing since we decided #18175 is the way to go.

@alalazo alalazo closed this Feb 11, 2022
@alalazo alalazo deleted the feature/test_for_package_detection_in_package_py branch February 11, 2022 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants