Package FuzzManager :: Package FTB :: Module tests
[hide private]
[frames] | no frames]

Source Code for Module FuzzManager.FTB.tests

 1  ''' 
 2  Tests 
 3   
 4  @author:     Christian Holler (:decoder) 
 5   
 6  @license: 
 7   
 8  This Source Code Form is subject to the terms of the Mozilla Public 
 9  License, v. 2.0. If a copy of the MPL was not distributed with this 
10  file, You can obtain one at http://mozilla.org/MPL/2.0/. 
11   
12  @contact:    choller@mozilla.com 
13  ''' 
14  import unittest 
15  from FTB import AssertionHelper 
16   
17  asanFFAbort = """Hit MOZ_CRASH() at /srv/repos/browser/mozilla-central/memory/mozalloc/mozalloc_abort.cpp:30 
18  ASAN:SIGSEGV 
19  ================================================================= 
20  ==26289==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fac9b54873a sp 0x7fff085f2120 bp 0x7fff085f2130 T0) 
21  """ 
22   
23  jsshellMozCrash = """ 
24  Hit MOZ_CRASH(named lambda static scopes should have been skipped) at /srv/repos/mozilla-central/js/src/vm/ScopeObject.cpp:1277 
25  """ 
26   
27 -class AssertionHelperTestASanFFAbort(unittest.TestCase):
28 - def runTest(self):
29 err = asanFFAbort.splitlines() 30 31 self.assertIn("AddressSanitizer", AssertionHelper.getAssertion(err, False)) 32 33 # Now check that ASan crash message is not used if only programmatic assertions are requested 34 self.assertEqual(AssertionHelper.getAssertion(err, True), None)
35
36 -class AssertionHelperTestSanitizing(unittest.TestCase):
37 - def runTest(self):
38 err = asanFFAbort.splitlines() 39 40 sanitizedMsg = AssertionHelper.getSanitizedAssertionPattern(AssertionHelper.getAssertion(err, False)) 41 expectedMsg = "==[0-9]{2,}==ERROR: AddressSanitizer: SEGV on unknown address 0x[0-9a-fA-F]+ \\(pc 0x[0-9a-fA-F]+ sp 0x[0-9a-fA-F]+ bp 0x[0-9a-fA-F]+ T0\\)" 42 43 self.assertEqual(sanitizedMsg, expectedMsg)
44
45 -class AssertionHelperTestMozCrash(unittest.TestCase):
46 - def runTest(self):
47 err = jsshellMozCrash.splitlines() 48 49 sanitizedMsg = AssertionHelper.getSanitizedAssertionPattern(AssertionHelper.getAssertion(err, False)) 50 expectedMsg = "Hit MOZ_CRASH\\(named lambda static scopes should have been skipped\\) at /.+/ScopeObject\\.cpp:[0-9]+" 51 52 self.assertEqual(sanitizedMsg, expectedMsg)
53 54 if __name__ == "__main__": 55 unittest.main() 56