diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2013-11-15 18:08:50 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-11-18 12:40:46 +0000 |
commit | 6f1568e54a7808b2ab568618fc5bb244249579f1 (patch) | |
tree | bb16107b7fd8a3be426b0841da058c620374b4f1 /scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py | |
parent | 3cfce710faf82024c5d8973fe83a125d0375309b (diff) | |
download | openembedded-core-contrib-6f1568e54a7808b2ab568618fc5bb244249579f1.tar.gz |
pybootchartgui: Import pybootchartgui 0.14.5
This update the pybootchartgui code to the latest release from its new
location at "https://github.com/mmeeks/bootchart". This only imports
the relevant parts, and not all of bootchart2.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py')
-rw-r--r-- | scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py b/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py index 971e125eab..6f46a1c03d 100644 --- a/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py +++ b/scripts/pybootchartgui/pybootchartgui/tests/process_tree_test.py @@ -4,16 +4,28 @@ import unittest sys.path.insert(0, os.getcwd()) -import parsing -import process_tree +import pybootchartgui.parsing as parsing +import pybootchartgui.process_tree as process_tree +import pybootchartgui.main as main + +if sys.version_info >= (3, 0): + long = int class TestProcessTree(unittest.TestCase): def setUp(self): - self.name = "Process tree unittest" - self.rootdir = '../examples/1' - self.ps_stats = parsing.parse_file(parsing.ParserState(), self.mk_fname('proc_ps.log')).ps_stats - self.processtree = process_tree.ProcessTree(self.ps_stats, None, False, for_testing = True) + self.name = "Process tree unittest" + self.rootdir = os.path.join(os.path.dirname(sys.argv[0]), '../../examples/1/') + + parser = main._mk_options_parser() + options, args = parser.parse_args(['--q', self.rootdir]) + writer = main._mk_writer(options) + trace = parsing.Trace(writer, args, options) + + parsing.parse_file(writer, trace, self.mk_fname('proc_ps.log')) + trace.compile(writer) + self.processtree = process_tree.ProcessTree(writer, None, trace.ps_stats, \ + trace.ps_stats.sample_period, None, options.prune, None, None, False, for_testing = True) def mk_fname(self,f): return os.path.join(self.rootdir, f) @@ -26,14 +38,16 @@ class TestProcessTree(unittest.TestCase): return flattened def checkAgainstJavaExtract(self, filename, process_tree): - for expected, actual in zip(open(filename), self.flatten(process_tree)): + test_data = open(filename) + for expected, actual in zip(test_data, self.flatten(process_tree)): tokens = expected.split('\t') - self.assertEqual(int(tokens[0]), actual.pid) + self.assertEqual(int(tokens[0]), actual.pid // 1000) self.assertEqual(tokens[1], actual.cmd) self.assertEqual(long(tokens[2]), 10 * actual.start_time) self.assert_(long(tokens[3]) - 10 * actual.duration < 5, "duration") self.assertEqual(int(tokens[4]), len(actual.child_list)) self.assertEqual(int(tokens[5]), len(actual.samples)) + test_data.close() def testBuild(self): process_tree = self.processtree.process_tree |