diff --git a/infer/tests/build_systems/build_integration_tests.py b/infer/tests/build_systems/build_integration_tests.py index 0aab13338..aefa68282 100755 --- a/infer/tests/build_systems/build_integration_tests.py +++ b/infer/tests/build_systems/build_integration_tests.py @@ -61,6 +61,7 @@ EXPECTED_OUTPUTS_DIR = os.path.join(SCRIPT_DIR, 'expected_outputs') ALL_TESTS = [ 'ant', + 'assembly', 'buck', 'cc1', 'cmake', @@ -496,6 +497,11 @@ class BuildIntegrationTest(unittest.TestCase): [], preprocess=preprocess) + def test_clang_assembly(self): + test('assembly', 'compile with assembly code', CODETOANALYZE_DIR, + [{'compile': ['clang', '-x', 'c', '-c', 'hello.c', '-x', + 'assembler-with-cpp', 'example.S']}]) + def test_clang_component_kit_imports(self): test('componentkit', 'component quality analyzer skips imports', os.path.join(CODETOANALYZE_DIR, 'componentkit'), diff --git a/infer/tests/build_systems/codetoanalyze/example.S b/infer/tests/build_systems/codetoanalyze/example.S new file mode 100644 index 000000000..ae962fae5 --- /dev/null +++ b/infer/tests/build_systems/codetoanalyze/example.S @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +// THIS CODE HAS NO REAL MEANING, DO NOT TRY TO USE IT + .file "example.S" + .text +test: + pushq %rbp + movq %rsp, %rbp + movl %edi, -4(%rbp) + movl -4(%rbp), %eax + addl $1, %eax + popq %rbp + ret diff --git a/infer/tests/build_systems/expected_outputs/assembly_report.json b/infer/tests/build_systems/expected_outputs/assembly_report.json new file mode 100644 index 000000000..a6ed10eff --- /dev/null +++ b/infer/tests/build_systems/expected_outputs/assembly_report.json @@ -0,0 +1,7 @@ +[ + { + "bug_type": "NULL_DEREFERENCE", + "file": "hello.c", + "procedure": "test" + } +] \ No newline at end of file