mirror of
https://github.com/ivre/masscanned.git
synced 2025-10-02 14:48:22 +00:00
Add check for masscanned panic in python tests
This commit is contained in:
parent
bf1a2c7429
commit
843729b961
2 changed files with 9 additions and 4 deletions
|
@ -44,9 +44,13 @@ def test(f):
|
|||
KO = "\033[1m\033[1;%dmKO\033[0m" % 31
|
||||
fname = f.__name__.ljust(50, ".")
|
||||
|
||||
def w():
|
||||
def w(m):
|
||||
try:
|
||||
# check that masscanned is still running
|
||||
assert(m.poll() is None), "masscanned not running"
|
||||
f()
|
||||
# check that masscanned is still running
|
||||
assert(m.poll() is None), "masscanned terminated unexpectedly"
|
||||
LOG.info("{}{}".format(fname, OK))
|
||||
except AssertionError as e:
|
||||
LOG.error("{}{}: {}".format(fname, KO, e))
|
||||
|
@ -56,11 +60,12 @@ def test(f):
|
|||
return w
|
||||
|
||||
|
||||
def test_all():
|
||||
def test_all(m):
|
||||
global ERRORS, TESTS
|
||||
# execute tests
|
||||
for t in TESTS:
|
||||
t()
|
||||
# perform unit test
|
||||
t(m)
|
||||
LOG.info(f"\033[1mRan {len(TESTS)} tests with {len(ERRORS)} errors\033[0m")
|
||||
return len(ERRORS)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue