|
28 | 28 | from typing import NoReturn |
29 | 29 |
|
30 | 30 |
|
| 31 | +def test_qty_validation(test_qty: str) -> str: |
| 32 | + """ |
| 33 | + Verify all test quantity values are positive integers. |
| 34 | +
|
| 35 | + Parameters |
| 36 | + ---------- |
| 37 | + test_qty : str |
| 38 | + A ``string`` of the comma-separated test quantities from the user, |
| 39 | + such as '1,2,3,...' |
| 40 | +
|
| 41 | + Returns |
| 42 | + ------- |
| 43 | + str |
| 44 | + Returns a ``string`` of the original test quantities list if all |
| 45 | + test quantities are positive integers. |
| 46 | +
|
| 47 | + Raises |
| 48 | + ------ |
| 49 | + ArgumentTypeError |
| 50 | + Raises an ``ArgumentTypeError`` if any of the passed test quantities |
| 51 | + are non-integers or negative intergers. |
| 52 | + """ |
| 53 | + test_qty_list = test_qty.split(',') |
| 54 | + conversion_test_list = [] |
| 55 | + for value in test_qty_list: |
| 56 | + try: |
| 57 | + conversion_test_list.append(int(value)) |
| 58 | + except ValueError: |
| 59 | + raise ArgumentTypeError('Test quantity element invalid') |
| 60 | + |
| 61 | + if int(value) <= 0: |
| 62 | + raise ArgumentTypeError('Test quantity element is not positive') |
| 63 | + return test_qty |
| 64 | + |
| 65 | + |
31 | 66 | def unique_hosts(hosts: str) -> str: |
32 | 67 | """ |
33 | 68 | Verify all hosts are unique. |
@@ -142,6 +177,18 @@ def parse_args(version: str) -> Namespace: |
142 | 177 | 'of a single system (so, 3 systems specified ' |
143 | 178 | 'would result in tests for 1, 2, and 3 ' |
144 | 179 | 'systems)', action='store_true') |
| 180 | + commands_parent.add_argument('--test-qty', help='Comma-separated list of ' |
| 181 | + 'host counts to test. For example, for a ' |
| 182 | + 'list of 10 hosts specified via thse hosts ' |
| 183 | + 'flag, to test only multiples of two, this ' |
| 184 | + 'flag value should be 2,4,6,8,10. Note that ' |
| 185 | + '--sweep should also be present, otherwise ' |
| 186 | + 'only the maximum number of systems ' |
| 187 | + 'specified by --hosts will be tested. If ' |
| 188 | + 'this flag is unspecified, all node counts ' |
| 189 | + 'from 1 to the maximum number of systems ' |
| 190 | + 'specified by --hosts will be tested', |
| 191 | + type=test_qty_validation) |
145 | 192 | commands_parent.add_argument('--system', help='If system is specified, ' |
146 | 193 | 'iops-threads, bw-threads, gpus, batch size, ' |
147 | 194 | 'and network interface names are given ' |
|
0 commit comments