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

Side by Side Diff: tools/cygprofile/check_orderfile_unittest.py

Issue 891713002: Script checking that the observed function order matches an orderfile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Spacing, naming, unused imports. Created 5 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import unittest
7
8 import check_orderfile
9 import symbol_extractor
10
11
12 class TestCheckOrderFile(unittest.TestCase):
13 def testMatchesSymbols(self):
14 symbol_infos = [
pasko 2015/02/02 10:00:30 using this list as a global constant in the test f
Benoit L 2015/02/02 13:11:45 Done.
15 symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
16 symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
17 symbol_extractor.SymbolInfo('third', 0x3, 0, ''),
18 symbol_extractor.SymbolInfo('notProfiled', 0x3, 0, '')]
19 symbols = ['second', 'third', 'first']
20 (_, matched_count, _) = check_orderfile._CountMisorderedSymbols(
pasko 2015/02/02 10:00:30 wouldn't it be good to check the other counts here
Benoit L 2015/02/02 13:11:45 Done.
21 symbols, symbol_infos)
22 self.assertEquals(matched_count, 3)
23
24 def testMissingMatches(self):
25 symbol_infos = [
26 symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
27 symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
28 symbol_extractor.SymbolInfo('third', 0x3, 0, ''),
29 symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, '')]
30 symbols = ['second', 'third', 'other', 'first']
31 (_, matched_count, unmatched_count) = (
32 check_orderfile._CountMisorderedSymbols(symbols, symbol_infos))
33 self.assertEquals(matched_count, 3)
34 self.assertEquals(unmatched_count, 1)
35
36 def testNoUnorderedSymbols(self):
37 symbol_infos = [
38 symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
39 symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
40 symbol_extractor.SymbolInfo('third', 0x3, 0, ''),
41 symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, '')]
42 symbols = ['first', 'other', 'second', 'third', 'noMatchEither']
43 (misordered_pairs_count, _, _) = (
44 check_orderfile._CountMisorderedSymbols(symbols, symbol_infos))
45 self.assertEquals(misordered_pairs_count, 0)
46
47 def testUnorderedSymbols(self):
48 symbol_infos = [
49 symbol_extractor.SymbolInfo('first', 0x1, 0, ''),
50 symbol_extractor.SymbolInfo('second', 0x2, 0, ''),
51 symbol_extractor.SymbolInfo('third', 0x3, 0, ''),
52 symbol_extractor.SymbolInfo('notProfiled', 0x4, 0, '')]
53 symbols = ['first', 'other', 'third', 'second', 'noMatchEither']
54 (misordered_pairs_count, _, _) = (
55 check_orderfile._CountMisorderedSymbols(symbols, symbol_infos))
56 self.assertEquals(misordered_pairs_count, 1)
57
58
59 if __name__ == '__main__':
60 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698