Skip to content

Commit

Permalink
Fixed: softirq-top tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
strizhechenko committed Jun 7, 2017
1 parent b31f6ca commit b480ce5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test: env
./tests/rx_buffers_test.py && \
./tests/softnet_stat_test.py && \
./tests/server-info-show && \
./tests/softirq_net_rx_top_test.py && \
./tests/softirq_top_test.py && \
./tests/assessor_test.py & \
./tests/link_rate_units.sh

Expand Down
5 changes: 4 additions & 1 deletion netutils_linux_monitoring/base_top.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def __init__(self):
help="Don't clear screen after each iteration. May be useful in scripts/logging to file."),
]

def parse_options(self):
def parse_options(self, options=None):
""" That should be explicitly called in __main__ part of any top-like utils """
parser = OptionParser()
for opt in self.specific_options:
Expand All @@ -54,6 +54,9 @@ def parse_options(self):
except OptionConflictError:
pass
self.options, _ = parser.parse_args()
if options:
for name, value in options.iteritems():
setattr(self.options, name, value)
if hasattr(self, 'post_optparse'):
# pylint: disable=E1101
self.post_optparse()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_file2data(self):
for cpu in ('dualcore', 'i7'):
for i in xrange(1, 6):
top = Softirqs()
top.parse_options()
top.parse_options(options={'random': True})
top.options.softirqs_file = 'tests/softirqs/{0}/softirqs{1}'.format(cpu, i)
self.assertIn('NET_RX', top.parse())

Expand Down

0 comments on commit b480ce5

Please sign in to comment.