-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
Before-after-tests with small, handwritten test sets are missing. See an example here: https://github.com/alpaka-group/bashi/pull/17/files |
Starting point for the filter rule test, create the file # 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",
) |
Add the following test to the 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),
) |
For the test input, there are some general rules, what you should test:
|
a76f22f
to
858eb8c
Compare
Codecov ReportAttention: Patch coverage is
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. |
Please remove the comments on top of the function - # TODO(SimeonEhrig): remove disable=unused-argument
- # only required for the CI at the moment
def software_dependency_filter( |
fix #28