Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: tools/cygprofile/mergetraces_unittest.py

Issue 319053004: Fix bug in mergetraces.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Egor's comment Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/cygprofile/mergetraces.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cygprofile/mergetraces_unittest.py
diff --git a/tools/cygprofile/mergetraces_unittest.py b/tools/cygprofile/mergetraces_unittest.py
index 5a00bd6d9a03a0450a0a329f62c4cc0a1f38c6cc..de881379d69a260e0092acfc77985ecda748646a 100644
--- a/tools/cygprofile/mergetraces_unittest.py
+++ b/tools/cygprofile/mergetraces_unittest.py
@@ -6,17 +6,17 @@ import unittest
import mergetraces
-class GroupByProcessAndThreadIdTest(unittest.TestCase):
+class GroupByProcessAndThreadIdTestBasic(unittest.TestCase):
def runTest(self):
# (sec, usec, 'pid:tid', function address).
input_trace = [
(100, 10, '2000:2001', 0x5),
(100, 11, '2000:2001', 0x3),
- (100, 11, '2000:2000', 0x1),
- (100, 12, '2001:2001', 0x6),
- (100, 13, '2000:2002', 0x8),
- (100, 13, '2001:2002', 0x9),
- (100, 14, '2000:2000', 0x7)
+ (100, 13, '2000:1999', 0x8),
+ (100, 14, '2000:2000', 0x7),
+ (120, 13, '2001:2003', 0x9),
+ (150, 12, '2001:2004', 0x6),
+ (180, 11, '2000:2000', 0x1),
]
# Functions should be grouped by thread-id and PIDs should not be
@@ -24,13 +24,28 @@ class GroupByProcessAndThreadIdTest(unittest.TestCase):
expected_trace = [
(100, 10, '2000:2001', 0x5),
(100, 11, '2000:2001', 0x3),
- (100, 11, '2000:2000', 0x1),
+ (100, 13, '2000:1999', 0x8),
(100, 14, '2000:2000', 0x7),
- (100, 13, '2000:2002', 0x8),
- (100, 12, '2001:2001', 0x6),
- (100, 13, '2001:2002', 0x9)
+ (180, 11, '2000:2000', 0x1),
+ (120, 13, '2001:2003', 0x9),
+ (150, 12, '2001:2004', 0x6),
]
grouped_trace = mergetraces.GroupByProcessAndThreadId(input_trace)
self.assertEqual(grouped_trace, expected_trace)
+
+class GroupByProcessAndThreadIdFailsWithNonUniqueTIDs(unittest.TestCase):
+ def runTest(self):
+ # (sec, usec, 'pid:tid', function address).
+ input_trace = [
+ (100, 10, '1999:2001', 0x5),
+ (100, 10, '1988:2001', 0x5),
+ ]
+
+ try:
+ mergetraces.GroupByProcessAndThreadId(input_trace)
+ except Exception:
+ return
+
+ self.fail('Multiple processes should not have a same thread-ID.')
« no previous file with comments | « tools/cygprofile/mergetraces.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698