Skip to content

Commit bac18ff

Browse files
authored
Relentless fix (#605)
1 parent 4ad7a41 commit bac18ff

File tree

5 files changed

+16
-22
lines changed

5 files changed

+16
-22
lines changed

.github/workflows/frontier/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
gpus=`rocm-smi --showid | awk '{print $1}' | grep -Eo '[0-9]+' | uniq | tr '\n' ' '`
44
ngpus=`echo "$gpus" | tr -d '[:space:]' | wc -c`
55

6-
./mfc.sh test -j $ngpus --sys-hdf5 --sys-fftw -- -c frontier
6+
./mfc.sh test --max-attempts 3 -j $ngpus --sys-hdf5 --sys-fftw -- -c frontier
7+

.github/workflows/phoenix/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ if [ "$job_device" == "gpu" ]; then
1616
n_test_threads=`expr $gpu_count \* 2`
1717
fi
1818

19-
./mfc.sh test -a -j $n_test_threads $device_opts -- -c phoenix
19+
./mfc.sh test --max-attempts 3 -a -j $n_test_threads $device_opts -- -c phoenix
20+
2021

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
- name: Test
9595
run: |
9696
if [ '${{ matrix.intel }}' == 'true' ]; then source /opt/intel/oneapi/setvars.sh; fi
97-
/bin/bash mfc.sh test -j $(nproc) $OPT1 $OPT2
97+
/bin/bash mfc.sh test --max-attempts 3 -j $(nproc) $OPT1 $OPT2
9898
env:
9999
OPT1: ${{ matrix.mpi == 'mpi' && '--test-all' || '' }}
100100
OPT2: ${{ matrix.debug == 'debug' && '-% 20' || '' }}
@@ -109,7 +109,7 @@ jobs:
109109
uses: actions/checkout@v4
110110

111111
- name: Test
112-
run: sudo ./mfc.sh docker ./mfc.sh test -j $(nproc) -a
112+
run: sudo ./mfc.sh docker ./mfc.sh test --max-attempts 3 -j $(nproc) -a
113113

114114
self:
115115
name: Self Hosted

toolchain/mfc/args.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,11 @@ def add_common_arguments(p, mask = None):
8181
test.add_argument("-f", "--from", default=test_cases[0].get_uuid(), type=str, help="First test UUID to run.")
8282
test.add_argument("-t", "--to", default=test_cases[-1].get_uuid(), type=str, help="Last test UUID to run.")
8383
test.add_argument("-o", "--only", nargs="+", type=str, default=[], metavar="L", help="Only run tests with specified properties.")
84-
test.add_argument("-r", "--relentless", action="store_true", default=False, help="Run all tests, even if multiple fail.")
8584
test.add_argument("-a", "--test-all", action="store_true", default=False, help="Run the Post Process Tests too.")
8685
test.add_argument("-%", "--percent", type=int, default=100, help="Percentage of tests to run.")
87-
test.add_argument("-m", "--max-attempts", type=int, default=3, help="Maximum number of attempts to run a test.")
86+
test.add_argument("-m", "--max-attempts", type=int, default=1, help="Maximum number of attempts to run a test.")
8887
test.add_argument( "--no-build", action="store_true", default=False, help="(Testing) Do not rebuild MFC.")
8988
test.add_argument("--case-optimization", action="store_true", default=False, help="(GPU Optimization) Compile MFC targets with some case parameters hard-coded.")
90-
9189
test_meg = test.add_mutually_exclusive_group()
9290
test_meg.add_argument("--generate", action="store_true", default=False, help="(Test Generation) Generate golden files.")
9391
test_meg.add_argument("--add-new-variables", action="store_true", default=False, help="(Test Generation) If new variables are found in D/ when running tests, add them to the golden files.")

toolchain/mfc/test/test.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919

2020
nFAIL = 0
21+
nPASS = 0
22+
nSKIP = 0
2123

2224
def __filter(cases_) -> typing.List[TestCase]:
2325
cases = cases_[:]
@@ -60,7 +62,7 @@ def __filter(cases_) -> typing.List[TestCase]:
6062

6163
def test():
6264
# pylint: disable=global-statement, global-variable-not-assigned
63-
global nFAIL
65+
global nFAIL, nPASS, nSKIP
6466

6567
cases = [ _.to_case() for _ in list_cases() ]
6668

@@ -123,12 +125,9 @@ def test():
123125
ARG("jobs"), ARG("gpus"))
124126

125127
cons.print()
126-
if nFAIL == 0:
127-
cons.print("Tested Simulation [bold green]✓[/bold green]")
128-
else:
129-
raise MFCException(f"Testing: Encountered [bold red]{nFAIL}[/bold red] failure(s).")
130-
131128
cons.unindent()
129+
cons.print(f"\nTest Summary: [bold green]{nPASS}[/bold green] passed, [bold red]{nFAIL}[/bold red] failed, [bold yellow]{nSKIP}[/bold yellow] skipped.")
130+
exit(nFAIL)
132131

133132

134133
# pylint: disable=too-many-locals, too-many-branches, too-many-statements
@@ -217,8 +216,8 @@ def _handle_case(case: TestCase, devices: typing.Set[int]):
217216

218217

219218
def handle_case(case: TestCase, devices: typing.Set[int]):
220-
# pylint: disable=global-statement
221-
global nFAIL
219+
# pylint: disable=global-statement, global-variable-not-assigned
220+
global nFAIL, nPASS, nSKIP
222221

223222
nAttempts = 0
224223

@@ -227,18 +226,13 @@ def handle_case(case: TestCase, devices: typing.Set[int]):
227226

228227
try:
229228
_handle_case(case, devices)
229+
nPASS += 1
230230
except Exception as exc:
231231
if nAttempts < ARG("max_attempts"):
232232
cons.print(f"[bold yellow] Attempt {nAttempts}: Failed test {case.get_uuid()}. Retrying...[/bold yellow]")
233233
continue
234-
235234
nFAIL += 1
236-
237235
cons.print(f"[bold red]Failed test {case} after {nAttempts} attempt(s).[/bold red]")
238-
239-
if ARG("relentless"):
240-
cons.print(f"{exc}")
241-
else:
242-
raise exc
236+
cons.print(f"{exc}")
243237

244238
return

0 commit comments

Comments
 (0)