No changes in tests since the intercepted invocation function in called in a forked process. The clang-tidy integration is also broken.
This commit is contained in:
parent
2f62e9d316
commit
cc92b09ec1
|
@ -277,7 +277,8 @@ unsigned int ProcessExecutor::check()
|
||||||
|
|
||||||
if (iFileSettings != mSettings.project.fileSettings.end()) {
|
if (iFileSettings != mSettings.project.fileSettings.end()) {
|
||||||
resultOfCheck = fileChecker.check(*iFileSettings);
|
resultOfCheck = fileChecker.check(*iFileSettings);
|
||||||
// TODO: call analyseClangTidy()
|
if (fileChecker.settings().clangTidy)
|
||||||
|
fileChecker.analyseClangTidy(*iFileSettings);
|
||||||
} else {
|
} else {
|
||||||
// Read file from a file
|
// Read file from a file
|
||||||
resultOfCheck = fileChecker.check(iFile->first);
|
resultOfCheck = fileChecker.check(iFile->first);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# python -m pytest test-more-projects.py
|
# python -m pytest test-more-projects.py
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import pytest
|
||||||
from testutils import cppcheck
|
from testutils import cppcheck
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,3 +253,41 @@ def test_project_std(tmpdir):
|
||||||
ret, stdout, stderr = cppcheck(['--project=' + compile_commands, '--enable=all', '-rp=' + str(tmpdir), '--template=cppcheck1'])
|
ret, stdout, stderr = cppcheck(['--project=' + compile_commands, '--enable=all', '-rp=' + str(tmpdir), '--template=cppcheck1'])
|
||||||
assert ret == 0, stdout
|
assert ret == 0, stdout
|
||||||
assert (stderr == '[bug1.cpp:3]: (error) Division by zero.\n')
|
assert (stderr == '[bug1.cpp:3]: (error) Division by zero.\n')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip() # clang-tidy is not available in all cases
|
||||||
|
def test_clang_tidy(tmpdir):
|
||||||
|
test_file = os.path.join(tmpdir, 'test.cpp')
|
||||||
|
with open(test_file, 'wt') as f:
|
||||||
|
f.write("""
|
||||||
|
int main(int argc)
|
||||||
|
{
|
||||||
|
(void)argc;
|
||||||
|
}
|
||||||
|
""")
|
||||||
|
|
||||||
|
project_file = os.path.join(tmpdir, 'test.cppcheck')
|
||||||
|
with open(project_file, 'wt') as f:
|
||||||
|
f.write(
|
||||||
|
"""<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="1">
|
||||||
|
<paths>
|
||||||
|
<dir name="{}"/>
|
||||||
|
</paths>>
|
||||||
|
<tools>
|
||||||
|
<tool>clang-tidy</tool>
|
||||||
|
</tools>
|
||||||
|
</project>""".format(test_file))
|
||||||
|
|
||||||
|
args = ['--project={}'.format(project_file)]
|
||||||
|
|
||||||
|
exitcode, stdout, stderr = cppcheck(args)
|
||||||
|
assert exitcode == 0, stdout
|
||||||
|
lines = stdout.splitlines()
|
||||||
|
# TODO: should detect clang-tidy issue
|
||||||
|
assert len(lines) == 1
|
||||||
|
assert lines == [
|
||||||
|
'Checking {} ...'.format(test_file)
|
||||||
|
]
|
||||||
|
assert stderr == ''
|
||||||
|
|
Loading…
Reference in New Issue