Esempio n. 1
0
    def test_parse(self):
        """
        Test if parse there are skip messages in the output of the parse if
        the source files did change between the analysis and the parse.
        """

        test_proj_path = self._testproject_data['project_path']

        test_proj_files = os.listdir(test_proj_path)
        print(test_proj_files)

        null_deref_file = os.path.join(test_proj_path, 'null_dereference.cpp')

        codechecker.analyze(self._codechecker_cfg, 'hash_change',
                            test_proj_path)

        ret, out, _ = codechecker.parse(self._codechecker_cfg)
        self.assertEqual(ret, 0)

        # Need to wait a little before updating the last modification time.
        # If we do not wait, not enough time will be past
        # between the analysis and the parse in the test.
        time.sleep(2)
        touch(null_deref_file)

        ret, out, _ = codechecker.parse(self._codechecker_cfg)
        self.assertEqual(ret, 0)
        print(out)

        msg = 'did change since the last analysis.'
        self.assertTrue(msg in out,
                        '"' + msg + '" was not found in the parse output')
Esempio n. 2
0
    def test_parse(self):
        """
        Test if parse there are skip messages in the output of the parse if
        the source files did change between the analysis and the parse.
        """

        test_proj_path = self._testproject_data['project_path']

        test_proj_files = os.listdir(test_proj_path)
        print(test_proj_files)

        null_deref_file = os.path.join(test_proj_path, 'null_dereference.cpp')

        codechecker.analyze(self._codechecker_cfg,
                            'hash_change',
                            test_proj_path)

        ret, out, _ = codechecker.parse(self._codechecker_cfg)
        self.assertEqual(ret, 0)

        # Need to wait a little before updating the last modification time.
        # If we do not wait, not enough time will be past
        # between the analysis and the parse in the test.
        time.sleep(2)
        touch(null_deref_file)

        ret, out, _ = codechecker.parse(self._codechecker_cfg)
        self.assertEqual(ret, 0)
        print(out)

        msg = 'did change since the last analysis.'
        self.assertTrue(msg in out,
                        '"' + msg + '" was not found in the parse output')