예제 #1
0
class TSANAnalyzerResultTestCase(unittest.TestCase):
    """ Test the output of the TSANAnalyzerResult. """
    def setUp(self):
        """ Setup the test. """
        self.analyzer_result = TSANAnalyzerResult()
        self.cc_result_dir = tempfile.mkdtemp()

    def tearDown(self):
        """ Clean temporary directory. """
        shutil.rmtree(self.cc_result_dir)

    def test_tsan(self):
        """ Test for the tsan.plist file. """
        self.analyzer_result.transform('tsan.out', self.cc_result_dir)

        with open('tsan.plist', mode='rb') as pfile:
            exp = plistlib.load(pfile)

        plist_file = os.path.join(self.cc_result_dir, 'tsan.cpp_tsan.plist')
        with open(plist_file, mode='rb') as pfile:
            res = plistlib.load(pfile)

            # Use relative path for this test.
            res['files'][0] = 'files/tsan.cpp'

            self.assertTrue(res['metadata']['generated_by']['version'])
            res['metadata']['generated_by']['version'] = "x.y.z"

        self.assertEqual(res, exp)
예제 #2
0
 def setUp(self):
     """ Setup the test. """
     self.analyzer_result = TSANAnalyzerResult()
     self.cc_result_dir = tempfile.mkdtemp()