Skip to content

Commit ea8aee5

Browse files
committed
Remove --show-attempts-count and make it default
1 parent abf946f commit ea8aee5

File tree

4 files changed

+19
-59
lines changed

4 files changed

+19
-59
lines changed

llvm/docs/CommandGuide/lit.rst

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -144,34 +144,6 @@ OUTPUT OPTIONS
144144

145145
Show expectedly failed tests.
146146

147-
.. option:: --show-attempts-count
148-
149-
Show the number of attempts needed for a test to pass. It also shows the
150-
maximum number of attempts that were allowed for this test. This option is
151-
useful when you want to understand how many attempts took for a flaky test
152-
(``FLAKYPASS``) to pass.
153-
154-
This is how the test output looks like *without* :option:`--show-attempts-count`
155-
156-
.. code-block:: none
157-
158-
PASS: your-test-suite :: your-first-test.py (1 of 3)
159-
FLAKYPASS: your-test-suite :: your-second-test.py (2 of 2)
160-
161-
This is the output *with* :option:`--show-attempts-count`
162-
163-
.. code-block:: none
164-
165-
PASS: your-test-suite :: your-first-test.py (1 of 2)
166-
FLAKYPASS: your-test-suite :: your-second-test.py (2 of 2) [attempts=3,max_allowed_attempts=4]
167-
168-
In this case ``your-second-test.py`` was executed three times and it succeeded
169-
after the third time (``attempts=3``). Technically another run would have been
170-
possible (``max_allowed_attempts=4``).
171-
172-
We will only append the extra information when a test was allowed more than one
173-
attempt to succeed (i.e. see :option:`--max-retries-per-test`).
174-
175147
.. _execution-options:
176148

177149
EXECUTION OPTIONS
@@ -716,6 +688,14 @@ newline.
716688
The ``<progress info>`` field can be used to report progress information such
717689
as (1/300) or can be empty, but even when empty the parentheses are required.
718690

691+
Should a test be allowed retries (see ``ALLOW_RETRIES:`` annotation) and it
692+
needed more than one attempt to succeed, then ``<progess info>`` is extended
693+
by this information:
694+
695+
.. code-block:: none
696+
697+
, <num_attempts_made> of <max_allowed_attempts> attempts
698+
719699
Each test result may include additional (multiline) log information in the
720700
following format:
721701

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ def parse_args():
104104
help="Do not use curses based progress bar",
105105
action="store_false",
106106
)
107-
format_group.add_argument(
108-
"--show-attempts-count",
109-
dest="showAttemptsCount",
110-
help="Show number of attempts and maximum attempts for tests"
111-
" which are allowed to run more than once.",
112-
action="store_true",
113-
)
114107

115108
# Note: this does not generate flags for user-defined result codes.
116109
success_codes = [c for c in lit.Test.ResultCode.all_codes() if not c.isFailure]

llvm/utils/lit/lit/display.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,14 @@ def print_result(self, test):
119119
test_name = test.getFullName()
120120

121121
extra_info = ""
122-
extra_attrs = []
123-
124-
if self.opts.showAttemptsCount:
125-
if (
126-
test.result.max_allowed_attempts is not None
127-
and test.result.max_allowed_attempts > 1
128-
):
129-
extra_attrs.append(f"attempts={test.result.attempts}")
130-
extra_attrs.append(
131-
f"max_allowed_attempts={test.result.max_allowed_attempts}"
132-
)
133-
134-
if len(extra_attrs) > 0:
135-
extra_info = " [" + ",".join(extra_attrs) + "]"
122+
if (
123+
test.result.max_allowed_attempts is not None
124+
and test.result.max_allowed_attempts > 1
125+
) and test.result.attempts > 0:
126+
extra_info = f", {test.result.attempts} of {test.result.max_allowed_attempts} attempts"
136127

137128
print(
138-
"%s: %s (%d of %d)%s"
129+
"%s: %s (%d of %d%s)"
139130
% (
140131
test.result.code.name,
141132
test_name,

llvm/utils/lit/tests/allow-retries.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# RUN: not %{lit} %{inputs}/allow-retries/does-not-succeed-within-limit.py -v |\
2323
# RUN: FileCheck --check-prefix=CHECK-TEST3 -match-full-lines %s
2424
#
25-
# CHECK-TEST3: FAIL: allow-retries :: does-not-succeed-within-limit.py (1 of 1)
25+
# CHECK-TEST3: FAIL: allow-retries :: does-not-succeed-within-limit.py (1 of 1, 4 of 4 attempts)
2626
# CHECK-TEST3-NEXT: {{\**}} TEST 'allow-retries :: does-not-succeed-within-limit.py' FAILED {{\**}}
2727
# CHECK-TEST3-NEXT: Exit Code: 1
2828
# CHECK-TEST3-EMPTY:
@@ -78,11 +78,10 @@
7878
# RUN: rm -f %t.counter
7979
# RUN: %{lit} %{inputs}/max-retries-per-test/no-allow-retries-no-test_retry_attempts/test.py \
8080
# RUN: --max-retries-per-test=7 \
81-
# RUN: --show-attempts-count \
8281
# RUN: -Dcounter=%t.counter \
8382
# RUN: -Dpython=%{python} \
8483
# RUN: | FileCheck --check-prefix=CHECK-TEST8 %s
85-
# CHECK-TEST8: FLAKYPASS: no-allow-retries-no-test_retry_attempts :: test.py (1 of 1) [attempts=4,max_allowed_attempts=8]
84+
# CHECK-TEST8: FLAKYPASS: no-allow-retries-no-test_retry_attempts :: test.py (1 of 1, 4 of 8 attempts)
8685
# CHECK-TEST8: Passed With Retry: 1
8786

8887
# This test only passes on the 4th try. Here we check that a test can be re-run when:
@@ -92,11 +91,10 @@
9291
# RUN: rm -f %t.counter
9392
# RUN: %{lit} %{inputs}/max-retries-per-test/allow-retries-no-test_retry_attempts/test.py \
9493
# RUN: --max-retries-per-test=2 \
95-
# RUN: --show-attempts-count \
9694
# RUN: -Dcounter=%t.counter \
9795
# RUN: -Dpython=%{python} \
9896
# RUN: | FileCheck --check-prefix=CHECK-TEST9 %s
99-
# CHECK-TEST9: FLAKYPASS: allow-retries-no-test_retry_attempts :: test.py (1 of 1) [attempts=4,max_allowed_attempts=9]
97+
# CHECK-TEST9: FLAKYPASS: allow-retries-no-test_retry_attempts :: test.py (1 of 1, 4 of 9 attempts)
10098
# CHECK-TEST9: Passed With Retry: 1
10199

102100
# This test only passes on the 4th try. Here we check that a test can be re-run when:
@@ -106,11 +104,10 @@
106104
# RUN: rm -f %t.counter
107105
# RUN: %{lit} %{inputs}/max-retries-per-test/no-allow-retries-test_retry_attempts/test.py \
108106
# RUN: --max-retries-per-test=2 \
109-
# RUN: --show-attempts-count \
110107
# RUN: -Dcounter=%t.counter \
111108
# RUN: -Dpython=%{python} \
112109
# RUN: | FileCheck --check-prefix=CHECK-TEST10 %s
113-
# CHECK-TEST10: FLAKYPASS: no-allow-retries-test_retry_attempts :: test.py (1 of 1) [attempts=4,max_allowed_attempts=10]
110+
# CHECK-TEST10: FLAKYPASS: no-allow-retries-test_retry_attempts :: test.py (1 of 1, 4 of 10 attempts)
114111
# CHECK-TEST10: Passed With Retry: 1
115112

116113
# This test only passes on the 4th try. Here we check that a test can be re-run when:
@@ -120,9 +117,8 @@
120117
# RUN: rm -f %t.counter
121118
# RUN: %{lit} %{inputs}/max-retries-per-test/allow-retries-test_retry_attempts/test.py \
122119
# RUN: --max-retries-per-test=1 \
123-
# RUN: --show-attempts-count \
124120
# RUN: -Dcounter=%t.counter \
125121
# RUN: -Dpython=%{python} \
126122
# RUN: | FileCheck --check-prefix=CHECK-TEST11 %s
127-
# CHECK-TEST11: FLAKYPASS: allow-retries-test_retry_attempts :: test.py (1 of 1) [attempts=4,max_allowed_attempts=11]
123+
# CHECK-TEST11: FLAKYPASS: allow-retries-test_retry_attempts :: test.py (1 of 1, 4 of 11 attempts)
128124
# CHECK-TEST11: Passed With Retry: 1

0 commit comments

Comments
 (0)