Fix: test lines too long
[deliverable/lttng-analyses.git] / tests / test_io.py
CommitLineData
c163ba2e
AB
1# The MIT License (MIT)
2#
3# Copyright (C) 2016 - Julien Desfossez <jdesfossez@efficios.com>
4# Antoine Busque <abusque@efficios.com>
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22# SOFTWARE.
89086b3e 23
c163ba2e 24from .analysis_test import AnalysisTest
89086b3e 25
89086b3e 26
c163ba2e 27class IoTest(AnalysisTest):
89086b3e
JD
28 def write_trace(self):
29 # app (99) is known at statedump
c163ba2e
AB
30 self.trace_writer.write_lttng_statedump_process_state(
31 1000, 0, 99, 99, 99, 99, 98, 98, 'app', 0, 5, 0, 5, 0)
89086b3e
JD
32 # app2 (100) unknown at statedump has testfile, FD 3 defined at
33 # statedump
c163ba2e
AB
34 self.trace_writer.write_lttng_statedump_file_descriptor(
35 1001, 0, 100, 3, 0, 0, 'testfile')
89086b3e 36 # app write 10 bytes to FD 4
66fe8e47
JD
37 self.trace_writer.write_sched_switch(1002, 0, 'swapper/0', 0, 'app',
38 99)
c163ba2e 39 self.trace_writer.write_syscall_write(1004, 0, 1, 4, 0xabcd, 10, 10)
89086b3e 40 # app2 reads 100 bytes in FD 3
c163ba2e
AB
41 self.trace_writer.write_sched_switch(1006, 0, 'app', 99, 'app2', 100)
42 self.trace_writer.write_syscall_read(1008, 0, 1, 3, 0xcafe, 100, 100)
66fe8e47
JD
43 # app3 and its FD 3 are completely unknown at statedump, tries to read
44 # 100 bytes from FD 3 but only gets 42
c163ba2e
AB
45 self.trace_writer.write_sched_switch(1010, 0, 'app2', 100, 'app3', 101)
46 self.trace_writer.write_syscall_read(1012, 0, 1, 3, 0xcafe, 100, 42)
89086b3e 47 # block write
66fe8e47
JD
48 self.trace_writer.write_block_rq_issue(1015, 0, 264241152, 33, 10, 40,
49 99, 0, 0, '', 'app')
50 self.trace_writer.write_block_rq_complete(1016, 0, 264241152, 33, 10,
51 0, 0, 0, '')
89086b3e 52 # block read
66fe8e47
JD
53 self.trace_writer.write_block_rq_issue(1017, 0, 8388608, 33, 20, 90,
54 101, 1, 0, '', 'app3')
55 self.trace_writer.write_block_rq_complete(1018, 0, 8388608, 33, 20, 0,
56 1, 0, '')
89086b3e 57 # net xmit
c163ba2e 58 self.trace_writer.write_net_dev_xmit(1020, 2, 0xff, 32, 100, 'wlan0')
89086b3e 59 # net receive
c163ba2e
AB
60 self.trace_writer.write_netif_receive_skb(1021, 1, 0xff, 100, 'wlan1')
61 self.trace_writer.write_netif_receive_skb(1022, 1, 0xff, 200, 'wlan0')
89086b3e 62 # syscall open
66fe8e47
JD
63 self.trace_writer.write_syscall_open(1023, 0, 1, 'test/open/file', 0,
64 0, 42)
c163ba2e 65 self.trace_writer.flush()
89086b3e 66
c163ba2e
AB
67 def test_iousagetop(self):
68 expected = self.get_expected_output('iousagetop.txt')
69 result = self.get_cmd_output('lttng-iousagetop')
89086b3e 70
c163ba2e 71 self.assertMultiLineEqual(result, expected)
89086b3e 72
c163ba2e
AB
73 def test_iolatencytop(self):
74 expected = self.get_expected_output('iolatencytop.txt')
75 result = self.get_cmd_output('lttng-iolatencytop')
89086b3e 76
c163ba2e 77 self.assertMultiLineEqual(result, expected)
This page took 0.026598 seconds and 5 git commands to generate.