I had written some tests manually that are now obsolete because of internal changes. I thought of using transcript based testing instead so this is my first try but I am not sure to do it correctly:
http://cmd2.readthedocs.io/en/latest/transcript.html
After running a few commands, I did history 1:4 -t transcript.txt which saves the following transcript.txt:
iperf-mptcp-0-0.pcap> load_pcap examples\/iperf-mptcp-0-0.pcap
iperf-mptcp-0-0.pcap> lc
iperf-mptcp-0-0.pcap> ls 0
iperf-mptcp-0-0.pcap> ls 1
+Ready>load_pcap examples/iperf-mptcp-0-0.pcap
>>> examples/iperf-mptcp-0-0.pcap
/home/teto/mptcpanalyzer/mptcpanalyzer/data.py:144: ParserWarning: Both a converter and dtype were specified for column tcp.flags - only the converter will be used
"mptcp.duplicated_dsn": lambda x: list(map(int, x.split(','))) if x is not None else np.nan,
+iperf-mptcp-0-0.pcap> lc
>>>
1 mptcp connection(s)
Description of mptcp.stream 0
The connection has 4 subflow(s) (client/server):
tcp.stream 0.0 : 10.1.0.1:5001.0 <-> 10.2.0.1:5001.0
tcp.stream 1.0 : 10.1.1.1:43376.0 <-> 10.2.0.1:5001.0
tcp.stream 2.0 : 10.1.0.1:49078.0 <-> 10.2.1.1:5001.0
tcp.stream 3.0 : 10.1.1.1:57841.0 <-> 10.2.1.1:5001.0
+iperf-mptcp-0-0.pcap> ls 0
>>> 0
Description of mptcp.stream 0
The connection has 4 subflow(s) (client/server):
tcp.stream 0.0 : 10.1.0.1:5001.0 <-> 10.2.0.1:5001.0
tcp.stream 1.0 : 10.1.1.1:43376.0 <-> 10.2.0.1:5001.0
tcp.stream 2.0 : 10.1.0.1:49078.0 <-> 10.2.1.1:5001.0
tcp.stream 3.0 : 10.1.1.1:57841.0 <-> 10.2.1.1:5001.0
+iperf-mptcp-0-0.pcap> ls 1
>>> 1
Traceback (most recent call last):
File "/nix/store/75apj1nkg5i2sy4hhfw8bjgx2dh2ghz9-python3.6-cmd2-0.8.0/lib/python3.6/site-packages/cmd2.py", line 981, in onecmd_plus_hooks
stop = self.onecmd(statement)
File "/nix/store/75apj1nkg5i2sy4hhfw8bjgx2dh2ghz9-python3.6-cmd2-0.8.0/lib/python3.6/site-packages/cmd2.py", line 1179, in onecmd
stop = func(statement)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 65, in wrapped
return f(self, *args)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 296, in do_list_subflows
self.list_subflows(args.mptcpstream)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 65, in wrapped
return f(self, *args)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 300, in list_subflows
con = MpTcpConnection.build_from_dataframe(self.data, mptcpstreamid)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/connection.py", line 215, in build_from_dataframe
raise MpTcpException("No packet with this mptcp.stream id %r" % mptcpstreamid)
mptcpanalyzer.MpTcpException: No packet with this mptcp.stream id 1
EXCEPTION of type 'MpTcpException' occurred with message: 'No packet with this mptcp.stream id 1'
To enable full traceback, run the following command: 'set debug true'
+iperf-mptcp-0-0.pcap> history
>>>
-------------------------[1]
load_pcap examples/iperf-mptcp-0-0.pcap
-------------------------[2]
lc
-------------------------[3]
ls 0
-------------------------[4]
ls 1
+iperf-mptcp-0-0.pcap> history 1:4 -t transcript.txt
>>> 1:4 -t transcript.txt
>>> examples/iperf-mptcp-0-0.pcap
/home/teto/mptcpanalyzer/mptcpanalyzer/data.py:144: ParserWarning: Both a converter and dtype were specified for column tcp.flags - only the converter will be used
"mptcp.duplicated_dsn": lambda x: list(map(int, x.split(','))) if x is not None else np.nan,
>>>
1 mptcp connection(s)
Description of mptcp.stream 0
The connection has 4 subflow(s) (client/server):
tcp.stream 0.0 : 10.1.0.1:5001.0 <-> 10.2.0.1:5001.0
tcp.stream 1.0 : 10.1.1.1:43376.0 <-> 10.2.0.1:5001.0
tcp.stream 2.0 : 10.1.0.1:49078.0 <-> 10.2.1.1:5001.0
tcp.stream 3.0 : 10.1.1.1:57841.0 <-> 10.2.1.1:5001.0
>>> 0
Description of mptcp.stream 0
The connection has 4 subflow(s) (client/server):
tcp.stream 0.0 : 10.1.0.1:5001.0 <-> 10.2.0.1:5001.0
tcp.stream 1.0 : 10.1.1.1:43376.0 <-> 10.2.0.1:5001.0
tcp.stream 2.0 : 10.1.0.1:49078.0 <-> 10.2.1.1:5001.0
tcp.stream 3.0 : 10.1.1.1:57841.0 <-> 10.2.1.1:5001.0
>>> 1
Traceback (most recent call last):
File "/nix/store/75apj1nkg5i2sy4hhfw8bjgx2dh2ghz9-python3.6-cmd2-0.8.0/lib/python3.6/site-packages/cmd2.py", line 981, in onecmd_plus_hooks
stop = self.onecmd(statement)
File "/nix/store/75apj1nkg5i2sy4hhfw8bjgx2dh2ghz9-python3.6-cmd2-0.8.0/lib/python3.6/site-packages/cmd2.py", line 1179, in onecmd
stop = func(statement)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 65, in wrapped
return f(self, *args)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 296, in do_list_subflows
self.list_subflows(args.mptcpstream)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 65, in wrapped
return f(self, *args)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/cli.py", line 300, in list_subflows
con = MpTcpConnection.build_from_dataframe(self.data, mptcpstreamid)
File "/home/teto/mptcpanalyzer/mptcpanalyzer/connection.py", line 215, in build_from_dataframe
raise MpTcpException("No packet with this mptcp.stream id %r" % mptcpstreamid)
mptcpanalyzer.MpTcpException: No packet with this mptcp.stream id 1
EXCEPTION of type 'MpTcpException' occurred with message: 'No packet with this mptcp.stream id 1'
To enable full traceback, run the following command: 'set debug true'
4 commands and outputs saved to transcript file 'transcript.txt'
I had written some tests manually that are now obsolete because of internal changes. I thought of using transcript based testing instead so this is my first try but I am not sure to do it correctly:
http://cmd2.readthedocs.io/en/latest/transcript.html
After running a few commands, I did
history 1:4 -t transcript.txtwhich saves the following transcript.txt:This lacks the output, here is the complete session:
EDIT: could that be because I use a custom prompt ?