Skip to content

Test package detection in a systematic way#21343

Closed
alalazo wants to merge 7 commits intospack:developfrom
alalazo:feature/test_for_package_detection_in_package_py
Closed

Test package detection in a systematic way#21343
alalazo wants to merge 7 commits intospack:developfrom
alalazo:feature/test_for_package_detection_in_package_py

Conversation

@alalazo
Copy link
Copy Markdown
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': '[email protected] 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': '[email protected] 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': '[email protected] languages=c'},
{'spec': '[email protected] languages=c,c++'}
]
}
]
}
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants