Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
apex
Commits
4cfbe05c
"vscode:/vscode.git/clone" did not exist on "ff42d33e9944832a19171967d2edd6c292bdb2d6"
Commit
4cfbe05c
authored
Aug 08, 2022
by
hubertlu-tw
Browse files
Addd a wrapper to skip flaky unit tests.
parent
87fc4125
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
apex/testing/common_utils.py
apex/testing/common_utils.py
+11
-0
tests/L0/run_rocm.sh
tests/L0/run_rocm.sh
+1
-1
tests/L0/run_test.py
tests/L0/run_test.py
+3
-2
No files found.
apex/testing/common_utils.py
View file @
4cfbe05c
...
...
@@ -10,6 +10,7 @@ import unittest
TEST_WITH_ROCM
=
os
.
getenv
(
'APEX_TEST_WITH_ROCM'
,
'0'
)
==
'1'
SKIP_FLAKY_TEST
=
os
.
getenv
(
'APEX_SKIP_FLAKY_TEST'
,
'0'
)
==
'1'
## Wrapper to skip the unit tests.
def
skipIfRocm
(
fn
):
...
...
@@ -20,3 +21,13 @@ def skipIfRocm(fn):
else
:
fn
(
*
args
,
**
kwargs
)
return
wrapper
## Wrapper to skip the flaky unit tests.
def
skipFlakyTest
(
fn
):
@
wraps
(
fn
)
def
wrapper
(
*
args
,
**
kwargs
):
if
SKIP_FLAKY_TEST
:
raise
unittest
.
SkipTest
(
"Test is flaky."
)
else
:
fn
(
*
args
,
**
kwargs
)
return
wrapper
tests/L0/run_rocm.sh
View file @
4cfbe05c
#!/bin/bash
APEX_TEST_WITH_ROCM
=
1 python run_test.py
APEX_TEST_WITH_ROCM
=
1
APEX_SKIP_FLAKY_TEST
=
1
python run_test.py
tests/L0/run_test.py
View file @
4cfbe05c
...
...
@@ -2,6 +2,7 @@ import unittest
import
sys
from
apex.testing.common_utils
import
TEST_WITH_ROCM
from
apex.testing.common_utils
import
SKIP_FLAKY_TEST
test_dirs
=
[
"run_amp"
,
"run_fp16util"
,
"run_optimizers"
,
"run_fused_layer_norm"
,
"run_pyprof_nvtx"
,
"run_pyprof_data"
,
"run_mlp"
]
...
...
@@ -15,7 +16,7 @@ runner = unittest.TextTestRunner(verbosity=2)
errcode
=
0
for
test_dir
in
test_dirs
:
if
(
test_dir
in
ROCM_BLACKLIST
)
and
TEST_WITH_ROCM
:
if
(
test_dir
in
ROCM_BLACKLIST
)
and
TEST_WITH_ROCM
and
SKIP_FLAKY_TEST
:
continue
suite
=
unittest
.
TestLoader
().
discover
(
test_dir
)
...
...
@@ -26,4 +27,4 @@ for test_dir in test_dirs:
if
not
result
.
wasSuccessful
():
errcode
=
1
sys
.
exit
(
errcode
)
\ No newline at end of file
sys
.
exit
(
errcode
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment