Skip to content

Commit

Permalink
Add command line argument to skip unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Jul 9, 2019
1 parent 716140d commit 4b1ab96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions run_project_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,8 @@ def detect_system_compiler():
choices=backendlist)
parser.add_argument('--failfast', action='store_true',
help='Stop running if test case fails')
parser.add_argument('--no-unittests', action='store_true',
help='Not used, only here to simplify run_tests.py')
parser.add_argument('--only', help='name of test(s) to run', nargs='+')
options = parser.parse_args()
setup_commands(options.backend)
Expand Down
18 changes: 12 additions & 6 deletions run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def main():
choices=backendlist)
parser.add_argument('--cross', default=False, dest='cross', action='store_true')
parser.add_argument('--failfast', action='store_true')
parser.add_argument('--no-unittests', action='store_true', default=False)
(options, _) = parser.parse_known_args()
# Enable coverage early...
enable_coverage = options.cov
Expand All @@ -273,6 +274,7 @@ def main():
returncode = 0
cross = options.cross
backend, _ = guess_backend(options.backend, shutil.which('msbuild'))
no_unittests = options.no_unittests
# Running on a developer machine? Be nice!
if not mesonlib.is_windows() and not mesonlib.is_haiku() and 'CI' not in os.environ:
os.nice(20)
Expand Down Expand Up @@ -314,12 +316,16 @@ def main():
returncode += subprocess.call(cmd, env=env)
if options.failfast and returncode != 0:
return returncode
cmd = mesonlib.python_command + ['run_unittests.py', '-v']
if options.failfast:
cmd += ['--failfast']
returncode += subprocess.call(cmd, env=env)
if options.failfast and returncode != 0:
return returncode
if no_unittests:
print('Skipping all unit tests.')
returncode = 0
else:
cmd = mesonlib.python_command + ['run_unittests.py', '-v']
if options.failfast:
cmd += ['--failfast']
returncode += subprocess.call(cmd, env=env)
if options.failfast and returncode != 0:
return returncode
cmd = mesonlib.python_command + ['run_project_tests.py'] + sys.argv[1:]
returncode += subprocess.call(cmd, env=env)
else:
Expand Down

0 comments on commit 4b1ab96

Please sign in to comment.