diff --git a/lib/errorlogger.cpp b/lib/errorlogger.cpp index c1a7e6874f2..69b9667323f 100644 --- a/lib/errorlogger.cpp +++ b/lib/errorlogger.cpp @@ -170,6 +170,9 @@ ErrorMessage::ErrorMessage(const tinyxml2::XMLElement * const errmsg) const char *attr = errmsg->Attribute("id"); id = attr ? attr : unknown; + attr = errmsg->Attribute("file0"); + file0 = attr ? attr : ""; + attr = errmsg->Attribute("severity"); severity = attr ? severityFromString(attr) : Severity::none; diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 720b483d458..35b5a113709 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -2675,11 +2675,7 @@ def test_duplicate_suppressions_mixed(tmp_path): assert stderr == '' -@pytest.mark.xfail(strict=True) -def test_xml_builddir(tmp_path): # #13391 / #13485 - build_dir = tmp_path / 'b1' - os.mkdir(build_dir) - +def test_xml_output(tmp_path): # #13391 / #13485 test_file = tmp_path / 'test.cpp' with open(test_file, 'wt') as f: f.write(""" @@ -2690,46 +2686,42 @@ def test_xml_builddir(tmp_path): # #13391 / #13485 } """) + _, version_str, _ = cppcheck(['--version']) + version_str = version_str.replace('Cppcheck ', '').strip() + args = [ '-q', '--enable=style', - '--cppcheck-build-dir={}'.format(build_dir), '--xml', str(test_file) ] exitcode_1, stdout_1, stderr_1 = cppcheck(args) assert exitcode_1 == 0, stdout_1 assert stdout_1 == '' - # TODO: handle version assert (stderr_1 == - ''' - - - - - - - p - - - - '''.format(test_file, test_file, test_file)) - - exitcode_2, stdout_2, stderr_2 = cppcheck(args) - assert exitcode_1 == exitcode_2, stdout_2 - assert stdout_1 == stdout_2 - assert stderr_1 == stderr_2 +''' + + + + + + + p + + + +'''.format(version_str, str(test_file).replace('\\', '/'), test_file, test_file)) # TODO: the slashes are inconsistent def test_internal_error_loc_int(tmp_path): test_file = tmp_path / 'test.c' with open(test_file, 'wt') as f: f.write( -""" -void f() { - int i = 0x10000000000000000; -} -""") + """ + void f() { + int i = 0x10000000000000000; + } + """) args = [ '-q',