diff --git a/infer/tests/build_systems/build_integration_tests.py b/infer/tests/build_systems/build_integration_tests.py index f6ca49ac8..f84d058c6 100755 --- a/infer/tests/build_systems/build_integration_tests.py +++ b/infer/tests/build_systems/build_integration_tests.py @@ -63,6 +63,7 @@ ALL_TESTS = [ 'cc1', 'cmake', 'componentkit', + 'delete', 'fail', 'gradle', 'javac', @@ -522,6 +523,15 @@ class BuildIntegrationTest(unittest.TestCase): extra_check=pmd_check, available=lambda: has_lxml) + def test_infer_deletes_infer_out(self): + # Test that two consecutive analyses do not pollute each other: + # the expected results of running infer on hello.c then on + # hello2.c is that only the bug in hello2.c is reported. + test('delete', 'infer deletes infer-out', + CODETOANALYZE_DIR, + [{'compile': ['clang', '-c', 'hello.c']}, + {'compile': ['clang', '-c', 'hello2.c']}]) + if __name__ == '__main__': # hackish capturing of the arguments after '--' diff --git a/infer/tests/build_systems/expected_outputs/delete_report.json b/infer/tests/build_systems/expected_outputs/delete_report.json new file mode 100644 index 000000000..d8597895b --- /dev/null +++ b/infer/tests/build_systems/expected_outputs/delete_report.json @@ -0,0 +1,7 @@ +[ + { + "bug_type": "NULL_DEREFERENCE", + "file": "hello2.c", + "procedure": "test2" + } +] \ No newline at end of file