lib/ltemplate.py: add KeepGoing parameter to ltemplateTest

Signed-off-by: G. Paul Ziemba <paulz@labn.net>
This commit is contained in:
G. Paul Ziemba 2018-03-03 12:22:39 -08:00 committed by Donald Sharp
parent 19246819f4
commit 90d56c6cca

View File

@ -144,7 +144,7 @@ def teardown_module(mod):
tgen.stop_topology() tgen.stop_topology()
_lt = None _lt = None
def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None): def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, KeepGoing=False):
tgen = get_topogen() tgen = get_topogen()
if not os.path.isfile(script): if not os.path.isfile(script):
if not os.path.isfile(os.path.join(_lt.scriptdir, script)): if not os.path.isfile(os.path.join(_lt.scriptdir, script)):
@ -156,7 +156,8 @@ def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None)
if SkipIfFailed and tgen.routers_have_failure(): if SkipIfFailed and tgen.routers_have_failure():
pytest.skip(tgen.errors) pytest.skip(tgen.errors)
if numEntry > 0: if numEntry > 0:
pytest.skip("Have %d errors" % numEntry) if not KeepGoing:
pytest.skip("Have %d errors" % numEntry)
if CheckFuncStr != None: if CheckFuncStr != None:
check = eval(CheckFuncStr) check = eval(CheckFuncStr)
@ -170,7 +171,8 @@ def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None)
if numFail > 0: if numFail > 0:
luShowFail() luShowFail()
fatal_error = "%d tests failed" % numFail fatal_error = "%d tests failed" % numFail
assert "scripts/cleanup_all.py failed" == "See summary output above", fatal_error if not KeepGoing:
assert "scripts/cleanup_all.py failed" == "See summary output above", fatal_error
# Memory leak test template # Memory leak test template
def test_memory_leak(): def test_memory_leak():