Skip to content

Commit

Permalink
examples/gnrc_networking: add a test that app did not crash
Browse files Browse the repository at this point in the history
Ensure the application did not crash as the shell is answering
  • Loading branch information
cladmi committed Aug 12, 2019
1 parent c945609 commit 09193b9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions examples/gnrc_networking/tests/01-run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python3

# Copyright (C) 2019 Freie Universität Berlin
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

import sys
from testrunner import run


def _check_shell_is_working(child, tries=5):
"""Dirty check that the shell is working.
It ensures the application did not crash.
"""
for i in range(0, tries):
child.sendline('help')
try:
child.expect_exact('Command Description', timeout=1)
child.expect_exact('---------------------------------------',
timeout=1)
child.expect_exact('> ', timeout=1)
break
except Exception:
pass
else:
child.expect('>')


def testfunc(child):
_check_shell_is_working(child)


if __name__ == "__main__":
sys.exit(run(testfunc))

0 comments on commit 09193b9

Please sign in to comment.