def run_analyzer(content, opts):
    with fixtures.TempDir() as tmpdir:
        filename = os.path.join(tmpdir, 'test.cpp')
        with open(filename, 'w') as handle:
            handle.write(content)

        opts.update({
            'directory': os.getcwd(),
            'clang': 'clang',
            'file': filename,
            'language': 'c++',
            'analyze': ['--analyze', '-x', 'c++', filename],
            'output': ['-o', tmpdir]})
        spy = fixtures.Spy()
        result = sut.run_analyzer(opts, spy.call)
        return (result, spy.arg)
    def run_analyzer(content, failures_report):
        with libear.TemporaryDirectory() as tmpdir:
            filename = os.path.join(tmpdir, 'test.cpp')
            with open(filename, 'w') as handle:
                handle.write(content)

            opts = {
                'clang': 'clang',
                'directory': os.getcwd(),
                'flags': [],
                'direct_args': [],
                'file': filename,
                'output_dir': tmpdir,
                'output_format': 'plist',
                'output_failures': failures_report
            }
            spy = Spy()
            result = sut.run_analyzer(opts, spy.call)
            return (result, spy.arg)
Exemple #3
0
    def run_analyzer(content, failures_report):
        with libear.TemporaryDirectory() as tmpdir:
            filename = os.path.join(tmpdir, 'test.cpp')
            with open(filename, 'w') as handle:
                handle.write(content)

            opts = {
                'clang': 'clang',
                'directory': os.getcwd(),
                'flags': [],
                'direct_args': [],
                'file': filename,
                'output_dir': tmpdir,
                'output_format': 'plist',
                'output_failures': failures_report
            }
            spy = Spy()
            result = sut.run_analyzer(opts, spy.call)
            return (result, spy.arg)