diff options
author | Klement Sekera <ksekera@cisco.com> | 2016-11-03 05:36:01 +0100 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2016-11-03 16:43:04 +0000 |
commit | 931be3aca223e094241a92ae7184ff97375fa155 (patch) | |
tree | 4708e25d2f2ede55ecc37c86c847c87d004d1f38 /test/framework.py | |
parent | bdb1f8193736c0c63429d049397d4783959c1148 (diff) |
Test framework: improve gdbserver handlingv17.01-rc0
Produce a user-friendly message if gdbserver is not available, instead
of cryptic exception.
Change-Id: Ia0d99e0488d2ee6e8af764b466dae2639f17ea55
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/framework.py')
-rw-r--r-- | test/framework.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/test/framework.py b/test/framework.py index ed71908ca2d..b10592cf1e7 100644 --- a/test/framework.py +++ b/test/framework.py @@ -152,13 +152,24 @@ class VppTestCase(unittest.TestCase): cmdline = cls.vpp_cmdline if cls.debug_gdbserver: - cmdline = ['gdbserver', 'localhost:7777'] + cls.vpp_cmdline + gdbserver = '/usr/bin/gdbserver' + if not os.path.isfile(gdbserver) or \ + not os.access(gdbserver, os.X_OK): + raise Exception("gdbserver binary '%s' does not exist or is " + "not executable" % gdbserver) + + cmdline = [gdbserver, 'localhost:7777'] + cls.vpp_cmdline cls.logger.info("Gdbserver cmdline is %s", " ".join(cmdline)) - cls.vpp = subprocess.Popen(cmdline, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - bufsize=1) + try: + cls.vpp = subprocess.Popen(cmdline, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + bufsize=1) + except Exception as e: + cls.logger.critical("Couldn't start vpp: %s" % e) + raise + cls.wait_for_enter() @classmethod @@ -209,8 +220,9 @@ class VppTestCase(unittest.TestCase): target=pump_output, args=(cls.vpp.stderr, cls.vpp_stderr_queue)) cls.vpp_stderr_reader_thread.start() except: - cls.vpp.terminate() - del cls.vpp + if hasattr(cls, 'vpp'): + cls.vpp.terminate() + del cls.vpp raise @classmethod |