else:
import subprocess
+# Python2/3 compatible
+try:
+ input = raw_input
+except NameError:
+ pass
+
PASS = 0
FAIL = 1
ERROR = 2
print("Now is the time to attach a gdb by running the above "
"command and set up breakpoints etc.")
print(single_line_delim)
- raw_input("Press ENTER to continue running the testcase...")
+ input("Press ENTER to continue running the testcase...")
@classmethod
def run_vpp(cls):
print(double_line_delim)
print("VPP or GDB server is still running")
print(single_line_delim)
- raw_input("When done debugging, press ENTER to kill the "
- "process and finish running the testcase...")
+ input("When done debugging, press ENTER to kill the "
+ "process and finish running the testcase...")
# first signal that we want to stop the pump thread, then wake it up
if hasattr(cls, 'pump_thread_stop_flag'):
input.add_stream(pkts)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
- if isinstance(object, (list,)):
- rx = []
- for o in output:
- rx.append(output.get_capture(len(pkts)))
- else:
- rx = output.get_capture(len(pkts))
+ rx = output.get_capture(len(pkts))
return rx
def send_and_expect_only(self, input, pkts, output, timeout=None):
input.add_stream(pkts)
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
- if isinstance(object, (list,)):
- outputs = output
- rx = []
- for o in outputs:
- rx.append(output.get_capture(len(pkts)))
- else:
- rx = output.get_capture(len(pkts))
- outputs = [output]
+ rx = output.get_capture(len(pkts))
+ outputs = [output]
if not timeout:
timeout = 1
for i in self.pg_interfaces:
return rx
+ def runTest(self):
+ """ unittest calls runTest when TestCase is instantiated without a
+ test case. Use case: Writing unittests against VppTestCase"""
+ pass
+
def get_testcase_doc_name(test):
return getdoc(test.__class__).splitlines()[0]