[test] save packets as pcap file in thread-cert tests (#2965)

This commit is contained in:
Yakun Xu
2018-08-20 09:27:04 -07:00
committed by Jonathan Hui
parent e731babedb
commit af2bfc1cc4
99 changed files with 280 additions and 186 deletions
+5 -1
View File
@@ -108,11 +108,15 @@ class otCli:
self.pexpect = fdpexpect.fdspawn(os.open(serialPort, os.O_RDWR|os.O_NONBLOCK|os.O_NOCTTY))
def __del__(self):
if self.pexpect.isalive():
self.destroy()
def destroy(self):
if self.pexpect and self.pexpect.isalive():
self.send_command('exit')
self.pexpect.expect(pexpect.EOF)
self.pexpect.terminate()
self.pexpect.close(force=True)
self.pexpect = None
def send_command(self, cmd):
print("%d: %s" % (self.nodeid, cmd))