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

Adding filter rule: GCC 6 and older is not available on Ubuntu 20.04 #46

Merged
merged 1 commit into from
Sep 5, 2024

Conversation

YuriiPerets
Copy link
Contributor

@YuriiPerets YuriiPerets commented Aug 13, 2024

fix #28

@YuriiPerets YuriiPerets marked this pull request as ready for review August 13, 2024 15:08
src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
@SimeonEhrig
Copy link
Member

Before-after-tests with small, handwritten test sets are missing. See an example here: https://github.com/alpaka-group/bashi/pull/17/files

@SimeonEhrig
Copy link
Member

Starting point for the filter rule test, create the file test_filter_software_dependency.py in the folder tests with the following content and extend it:

# pylint: disable=missing-docstring
import unittest
import io

from collections import OrderedDict as OD
from utils_test import parse_param_val as ppv
from bashi.globals import *  # pylint: disable=wildcard-import,unused-wildcard-import
from bashi.filter_software_dependency import software_dependency_filter_typechecked


class TestOldGCCVersionInUbuntu2004(unittest.TestCase):
    def test_valid_gcc_is_in_ubuntu_2004_d1(self):
        for gcc_version in [7, 13, 99]:
            self.assertTrue(
                software_dependency_filter_typechecked(
                    OD({HOST_COMPILER: ppv((GCC, gcc_version)), UBUNTU: ppv((UBUNTU, "20.04"))}),
                )
            )

            self.assertTrue(
                software_dependency_filter_typechecked(
                    OD(
                        {
                            HOST_COMPILER: ppv((GCC, gcc_version)),
                            DEVICE_COMPILER: ppv((GCC, gcc_version)),
                            UBUNTU: ppv((UBUNTU, "20.04")),
                        }
                    ),
                )
            )

    def test_not_valid_gcc_is_in_ubuntu_2004_d1(self):
        for gcc_version in [6, 3, 1]:
            reason_msg = io.StringIO()
            self.assertFalse(
                software_dependency_filter_typechecked(
                    OD({HOST_COMPILER: ppv((GCC, gcc_version)), UBUNTU: ppv((UBUNTU, "20.04"))}),
                    reason_msg,
                ),
                f"GCC {gcc_version} + Ubuntu 20.04",
            )
            self.assertEqual(
                reason_msg.getvalue(),
                f"GCC {gcc_version} is not available in Ubuntu 20.04",
            )

@SimeonEhrig
Copy link
Member

Add the following test to the test_results.py and extend it.

    def test_remove_unsupported_gcc_versions_for_ubuntu2004(self):
        test_param_value_pairs: List[ParameterValuePair] = parse_expected_val_pairs(
            [
                OD({HOST_COMPILER: (GCC, 10), DEVICE_COMPILER: (NVCC, 11.2)}),
                OD({HOST_COMPILER: (GCC, 6), UBUNTU: (UBUNTU, "20.04")}),
                OD({HOST_COMPILER: (GCC, 5), UBUNTU: (UBUNTU, "20.04")}),
                OD({HOST_COMPILER: (GCC, 7), UBUNTU: (UBUNTU, "20.04")}),
                OD({DEVICE_COMPILER: (GCC, 6), UBUNTU: (UBUNTU, "20.04")}),
                OD({HOST_COMPILER: (GCC, 6), DEVICE_COMPILER: (GCC, 6)}),
            ]
        )

        _remove_unsupported_gcc_versions_for_ubuntu2004(test_param_value_pairs)

        test_param_value_pairs.sort()
        expected_results = sorted(
            parse_expected_val_pairs(
                [
                    OD({HOST_COMPILER: (GCC, 10), DEVICE_COMPILER: (NVCC, 11.2)}),
                    OD({HOST_COMPILER: (GCC, 7), UBUNTU: (UBUNTU, "20.04")}),
                    OD({HOST_COMPILER: (GCC, 6), DEVICE_COMPILER: (GCC, 6)}),
                ]
            )
        )

        self.assertEqual(
            test_param_value_pairs,
            expected_results,
            create_diff_parameter_value_pairs(test_param_value_pairs, expected_results),
        )

@SimeonEhrig
Copy link
Member

For the test input, there are some general rules, what you should test:

  • corner cases like gcc 6 (first unsupported version) and gcc 7 (first supported version)
  • versions in both directions of the corner case, like gcc 1 and 3 (old versions) and 9, 13 (released version) and 99 (potential upcoming version, which could be released in future)
  • different number of input parameter
    • minimum case like host compiler + Ubuntu, device compiler + Ubuntu and host compiler + device compiler
    • all relevant parameter together: host and device compiler and Ubuntu
    • test with unrelated parameter e.g. host compiler + Ubuntu + CMake
      • test with fully unrelated parameter e.g. Boost + CMake

@SimeonEhrig SimeonEhrig changed the title Adding software filter rule Adding filter rule: GCC 6 and older is not available on Ubuntu 20.04 Aug 15, 2024
tests/test_results.py Outdated Show resolved Hide resolved
src/bashi/results.py Outdated Show resolved Hide resolved
tests/test_filter_software_dependency.py Show resolved Hide resolved
src/bashi/results.py Outdated Show resolved Hide resolved
src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
tests/test_filter_software_dependency.py Show resolved Hide resolved
src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
@YuriiPerets YuriiPerets force-pushed the filter branch 3 times, most recently from a76f22f to 858eb8c Compare September 4, 2024 15:21
@codecov-commenter
Copy link

codecov-commenter commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Project coverage is 94.80%. Comparing base (0ff5ba8) to head (77145e2).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/bashi/filter_software_dependency.py 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #46      +/-   ##
==========================================
+ Coverage   94.77%   94.80%   +0.02%     
==========================================
  Files          10       10              
  Lines         632      654      +22     
  Branches      188      196       +8     
==========================================
+ Hits          599      620      +21     
  Misses         15       15              
- Partials       18       19       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/bashi/filter_software_dependency.py Outdated Show resolved Hide resolved
src/bashi/filter_software_dependency.py Show resolved Hide resolved
@SimeonEhrig
Copy link
Member

Please remove the comments on top of the function software_dependency_filter(). They are not required anymore, because the filter function has functionality now.

- # TODO(SimeonEhrig): remove disable=unused-argument
- # only required for the CI at the moment
def software_dependency_filter(

@SimeonEhrig SimeonEhrig merged commit a92ebbe into alpaka-group:main Sep 5, 2024
8 checks passed
@YuriiPerets YuriiPerets deleted the filter branch September 5, 2024 13:00
@YuriiPerets YuriiPerets restored the filter branch September 5, 2024 16:40
@YuriiPerets YuriiPerets deleted the filter branch September 5, 2024 16:42
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.

add filter rule: gcc <=6 is not available on Ubuntu 20.04
3 participants