-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathtest_commands_lsmod.py
More file actions
40 lines (32 loc) · 1.04 KB
/
test_commands_lsmod.py
File metadata and controls
40 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
import unittest
import gdb
import io
import sys
from crash.commands.lsmod import ModuleCommand
class TestCommandsLsmod(unittest.TestCase):
def setUp(self):
self.stdout = sys.stdout
sys.stdout = io.StringIO()
def tearDown(self):
sys.stdout = self.stdout
def output(self):
return sys.stdout.getvalue()
def test_lsmod(self):
ModuleCommand().invoke("")
output = self.output()
self.assertTrue(len(output.split("\n")) > 2)
def test_lsmod_wildcard(self):
ModuleCommand().invoke("*")
output = self.output()
self.assertTrue(len(output.split("\n")) > 2)
def test_lsmod_p(self):
ModuleCommand().invoke("-p")
output = self.output()
self.assertTrue(len(output.split("\n")) > 2)
print(output)
def test_lsmod_p_0(self):
ModuleCommand().invoke("-p 0")
output = self.output()
self.assertTrue(len(output.split("\n")) > 2)