From 2da8940a806dd9cc8e7f893a541baa50e4720721 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Fri, 19 Aug 2016 06:20:52 -0700 Subject: [PATCH] test that running infer deletes the previous infer-out folder Reviewed By: martinoluca Differential Revision: D3736634 fbshipit-source-id: 9fb0c80 --- infer/tests/build_systems/build_integration_tests.py | 10 ++++++++++ .../build_systems/expected_outputs/delete_report.json | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 infer/tests/build_systems/expected_outputs/delete_report.json 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