From 811328ef726cf4de36bcdd8960f795b19cb327d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 11 Nov 2025 19:59:21 +0100 Subject: [PATCH 01/14] Fixed #12771 (Progress value is not increased) --- cli/processexecutor.cpp | 4 +++- cli/threadexecutor.cpp | 2 +- test/cli/more-projects_test.py | 36 ++++++++++++++++++++++++++++++++++ test/cli/other_test.py | 30 +++++++++++++--------------- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index 7efd4106db1..e1ebe58f986 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -407,7 +407,9 @@ unsigned int ProcessExecutor::check() fileCount++; processedsize += size; if (!mSettings.quiet) - Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), processedsize, totalfilesize); + Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), //processedsize, totalfilesize); + mFileSettings.empty() ? processedsize : fileCount, + mFileSettings.empty() ? totalfilesize : mFileSettings.size()); close(*rp); rp = rpipes.erase(rp); diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index b1bc75731ff..65ea40fbc32 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -153,7 +153,7 @@ class ThreadData mProcessedSize += fileSize; mProcessedFiles++; if (!mSettings.quiet) - logForwarder.reportStatus(mProcessedFiles, mTotalFiles, mProcessedSize, mTotalFileSize); + logForwarder.reportStatus(mProcessedFiles, mTotalFiles, mTotalFileSize>0 ? mProcessedSize : mProcessedFiles, mTotalFileSize>0 ? mTotalFileSize: mTotalFiles); } private: diff --git a/test/cli/more-projects_test.py b/test/cli/more-projects_test.py index f3ed273c4b9..e9940d17b72 100644 --- a/test/cli/more-projects_test.py +++ b/test/cli/more-projects_test.py @@ -1061,3 +1061,39 @@ def test_project_file_no_analyze_all_vs_configs(tmp_path): ret, stdout, stderr = cppcheck(['--project=' + str(project_path)]) assert ret == 0, stdout assert stderr == '' + + +@pytest.mark.parametrize("j,executor", [ + (1, "thread"), + (2, "thread"), + (2, "process"), +]) +def test_project_progress(tmp_path, j, executor): + if sys.platform == 'win32' and executor == "process": + pytest.skip("process executor not supported on Windows") + + code = 'x = 1;' + with open(tmp_path / 'test1.c', 'wt') as f: + f.write(code) + with open(tmp_path / 'test2.c', 'wt') as f: + f.write(code) + + compilation_db = [ + {"directory": str(tmp_path), + "command": "gcc -c test1.c", + "file": "test1.c", + "output": "test1.o"}, + {"directory": str(tmp_path), + "command": "gcc -c test2.c", + "file": "test2.c", + "output": "test2.o"}, + ] + + project_file = tmp_path / 'compile_commands.json' + + with open(project_file, 'wt') as f: + f.write(json.dumps(compilation_db)) + + _, stdout, _ = cppcheck([f'--project={project_file}', f'-j{j}', f'--executor={executor}']) + assert '1/2 files checked 50% done' in stdout + assert '2/2 files checked 100% done' in stdout diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 38391ad0720..9220593bd79 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1076,22 +1076,20 @@ def test_markup_j(tmpdir): assert exitcode == 0, stdout if stdout else stderr lines = stdout.splitlines() for i in range(1, 5): - lines.remove('{}/4 files checked 0% done'.format(i)) - - # this test started to fail in the -j2 injection run when using ThreadExecutor although it always specifies -j2. - # the order of the files in the output changed so just check for the file extentions - assert len(lines) == 4 - assert lines[0].endswith('.cpp ...') - assert lines[1].endswith('.cpp ...') - assert lines[2].endswith('.qml ...') - assert lines[3].endswith('.qml ...') - - #assert lines == [ - # 'Checking {} ...'.format(test_file_2), - # 'Checking {} ...'.format(test_file_4), - # 'Checking {} ...'.format(test_file_1), - # 'Checking {} ...'.format(test_file_3) - #] + try: + if '{}/4 files checked 0% done'.format(i) in lines: + lines.remove('{}/4 files checked 0% done'.format(i)) + else: + lines.remove('{}/4 files checked {}% done'.format(i, i * 25)) + except ValueError as e: + assert False, f'failed {i}' + + assert sorted(lines) == [ + 'Checking {} ...'.format(test_file_1), + 'Checking {} ...'.format(test_file_2), + 'Checking {} ...'.format(test_file_3), + 'Checking {} ...'.format(test_file_4) + ] assert stderr == '' From a2fcce08a7a2ce61d8586d21488796e00d99bd21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Tue, 11 Nov 2025 22:34:35 +0100 Subject: [PATCH 02/14] scriptcheck --- test/cli/other_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 9220593bd79..f85902eb75d 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1081,7 +1081,7 @@ def test_markup_j(tmpdir): lines.remove('{}/4 files checked 0% done'.format(i)) else: lines.remove('{}/4 files checked {}% done'.format(i, i * 25)) - except ValueError as e: + except ValueError: assert False, f'failed {i}' assert sorted(lines) == [ From 478483069296a7cfc255cd983cf4d925afa2cc14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 12 Nov 2025 08:29:30 +0100 Subject: [PATCH 03/14] Update cli/processexecutor.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- cli/processexecutor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index e1ebe58f986..a1b5dd2e5d4 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -407,7 +407,7 @@ unsigned int ProcessExecutor::check() fileCount++; processedsize += size; if (!mSettings.quiet) - Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), //processedsize, totalfilesize); + Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), mFileSettings.empty() ? processedsize : fileCount, mFileSettings.empty() ? totalfilesize : mFileSettings.size()); From 48ad09a51875f01844b97881b69b9b1997e92fce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 12 Nov 2025 08:29:39 +0100 Subject: [PATCH 04/14] Update test/cli/other_test.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- test/cli/other_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index f85902eb75d..a61f086f917 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1082,7 +1082,7 @@ def test_markup_j(tmpdir): else: lines.remove('{}/4 files checked {}% done'.format(i, i * 25)) except ValueError: - assert False, f'failed {i}' + assert False, f"Expected progress message for file {i}/4 not found in output. Checked for '{{}}/4 files checked 0% done' and '{{}}/4 files checked {{}}% done'. Output lines: {lines}" assert sorted(lines) == [ 'Checking {} ...'.format(test_file_1), From 796766fe0475d1a5a37f2d57b3fdcb31a5dabdee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 13 Nov 2025 15:25:51 +0100 Subject: [PATCH 05/14] refactor test --- test/cli/other_test.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index a61f086f917..6401f2638c2 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1074,16 +1074,14 @@ def test_markup_j(tmpdir): exitcode, stdout, stderr = cppcheck(args) assert exitcode == 0, stdout if stdout else stderr - lines = stdout.splitlines() - for i in range(1, 5): - try: - if '{}/4 files checked 0% done'.format(i) in lines: - lines.remove('{}/4 files checked 0% done'.format(i)) - else: - lines.remove('{}/4 files checked {}% done'.format(i, i * 25)) - except ValueError: - assert False, f"Expected progress message for file {i}/4 not found in output. Checked for '{{}}/4 files checked 0% done' and '{{}}/4 files checked {{}}% done'. Output lines: {lines}" - + file_num = 1 + lines = [] + for line in stdout.splitlines(): + if re.match('{}/4' files checked [0-9]+% done'.format(file_num), line): + file_num += 1 + else: + lines.append(line) + assert file_num == 5 assert sorted(lines) == [ 'Checking {} ...'.format(test_file_1), 'Checking {} ...'.format(test_file_2), From bc3c159d2b25be7d25854568e306119bf1131081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 13 Nov 2025 16:29:03 +0100 Subject: [PATCH 06/14] fix --- test/cli/other_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 6401f2638c2..490501fb288 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1077,7 +1077,7 @@ def test_markup_j(tmpdir): file_num = 1 lines = [] for line in stdout.splitlines(): - if re.match('{}/4' files checked [0-9]+% done'.format(file_num), line): + if re.match('{}/4 files checked [0-9]+% done'.format(file_num), line): file_num += 1 else: lines.append(line) From eb3c6cddac6fbdb0e20fcd7f09e0c6de73097129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 13 Nov 2025 16:41:31 +0100 Subject: [PATCH 07/14] import re --- test/cli/other_test.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 490501fb288..314f359a8fc 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -6,6 +6,7 @@ import pytest import glob import json +import re import subprocess import shutil From 090d57362c86c4912360121d673fe56e42c211fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 13:16:27 +0100 Subject: [PATCH 08/14] only qml files --- test/cli/other_test.py | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 314f359a8fc..e6c170a98e8 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1061,33 +1061,21 @@ def test_markup_j(tmpdir): test_file_1 = os.path.join(tmpdir, 'test_1.qml') with open(test_file_1, 'wt'): pass - test_file_2 = os.path.join(tmpdir, 'test_2.cpp') + test_file_2 = os.path.join(tmpdir, 'test_2.qml') with open(test_file_2, 'wt'): pass - test_file_3 = os.path.join(tmpdir, 'test_3.qml') - with open(test_file_3, 'wt'): - pass - test_file_4 = os.path.join(tmpdir, 'test_4.cpp') - with open(test_file_4, 'wt'): - pass - args = ['--library=qt', '-j2', test_file_1, test_file_2, test_file_3, test_file_4] + args = ['--library=qt', '-j2', test_file_1, test_file_2] exitcode, stdout, stderr = cppcheck(args) assert exitcode == 0, stdout if stdout else stderr file_num = 1 - lines = [] - for line in stdout.splitlines(): - if re.match('{}/4 files checked [0-9]+% done'.format(file_num), line): - file_num += 1 - else: - lines.append(line) - assert file_num == 5 + lines = stdout.splitlines() assert sorted(lines) == [ + '1/2 files checked 0% done', + '2/2 files checked 0% done', 'Checking {} ...'.format(test_file_1), - 'Checking {} ...'.format(test_file_2), - 'Checking {} ...'.format(test_file_3), - 'Checking {} ...'.format(test_file_4) + 'Checking {} ...'.format(test_file_2) ] assert stderr == '' From 9833ff963b18a6d37db381e2afe26b8d502c5e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 13:17:44 +0100 Subject: [PATCH 09/14] test is about testing progress messages --- test/cli/other_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index e6c170a98e8..2fa5a841ac1 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1057,7 +1057,7 @@ def test_markup(tmpdir): assert_cppcheck(args, ec_exp=0, err_exp=[], out_exp=out_lines) -def test_markup_j(tmpdir): +def test_progress_markup_j(tmpdir): test_file_1 = os.path.join(tmpdir, 'test_1.qml') with open(test_file_1, 'wt'): pass From 34d53fdbc15ea20833ecc3d964b85c1717eef755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 13:25:18 +0100 Subject: [PATCH 10/14] test --- test/cli/other_test.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 2fa5a841ac1..a97e1065e37 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -6,7 +6,6 @@ import pytest import glob import json -import re import subprocess import shutil @@ -1057,25 +1056,35 @@ def test_markup(tmpdir): assert_cppcheck(args, ec_exp=0, err_exp=[], out_exp=out_lines) -def test_progress_markup_j(tmpdir): +def test_markup_j(tmpdir): test_file_1 = os.path.join(tmpdir, 'test_1.qml') with open(test_file_1, 'wt'): pass - test_file_2 = os.path.join(tmpdir, 'test_2.qml') + test_file_2 = os.path.join(tmpdir, 'test_2.cpp') with open(test_file_2, 'wt'): pass + test_file_3 = os.path.join(tmpdir, 'test_3.qml') + with open(test_file_3, 'wt'): + pass + test_file_4 = os.path.join(tmpdir, 'test_4.cpp') + with open(test_file_4, 'wt'): + pass - args = ['--library=qt', '-j2', test_file_1, test_file_2] + args = ['--library=qt', '-j2', test_file_1, test_file_2, test_file_3, test_file_4] exitcode, stdout, stderr = cppcheck(args) assert exitcode == 0, stdout if stdout else stderr - file_num = 1 lines = stdout.splitlines() + assert sorted(lines) == [ - '1/2 files checked 0% done', - '2/2 files checked 0% done', + '1/4 files checked 0% done', + '2/4 files checked 0% done', + '3/4 files checked 0% done', + '4/4 files checked 0% done', 'Checking {} ...'.format(test_file_1), - 'Checking {} ...'.format(test_file_2) + 'Checking {} ...'.format(test_file_2), + 'Checking {} ...'.format(test_file_3), + 'Checking {} ...'.format(test_file_4) ] assert stderr == '' From ab71c6b66413825df10612aec981278bc5f35698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 15:48:23 +0100 Subject: [PATCH 11/14] test --- cli/executor.cpp | 2 +- test/cli/other_test.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/executor.cpp b/cli/executor.cpp index 31578399e35..8ef1de84a90 100644 --- a/cli/executor.cpp +++ b/cli/executor.cpp @@ -65,7 +65,7 @@ void Executor::reportStatus(std::size_t fileindex, std::size_t filecount, std::s { if (filecount > 1) { std::ostringstream oss; - const unsigned long percentDone = (sizetotal > 0) ? (100 * sizedone) / sizetotal : 0; + const unsigned long percentDone = (sizetotal > 0) ? (100 * sizedone) / sizetotal : (100 * fileindex / filecount); oss << fileindex << '/' << filecount << " files checked " << percentDone << "% done"; diff --git a/test/cli/other_test.py b/test/cli/other_test.py index a97e1065e37..07519e6c9f0 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1077,10 +1077,10 @@ def test_markup_j(tmpdir): lines = stdout.splitlines() assert sorted(lines) == [ - '1/4 files checked 0% done', - '2/4 files checked 0% done', - '3/4 files checked 0% done', - '4/4 files checked 0% done', + '1/4 files checked 25% done', + '2/4 files checked 50% done', + '3/4 files checked 75% done', + '4/4 files checked 100% done', 'Checking {} ...'.format(test_file_1), 'Checking {} ...'.format(test_file_2), 'Checking {} ...'.format(test_file_3), From 05f1b0d1d5538289e26292ec970ee10e6f6c11b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 16:04:09 +0100 Subject: [PATCH 12/14] test --- test/cli/other_test.py | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/test/cli/other_test.py b/test/cli/other_test.py index 07519e6c9f0..0031affe3ce 100644 --- a/test/cli/other_test.py +++ b/test/cli/other_test.py @@ -1016,13 +1016,13 @@ def test_file_order(tmpdir): lines = stdout.splitlines() assert lines == [ 'Checking {} ...'.format(test_file_c), - '1/4 files checked 0% done', + '1/4 files checked 25% done', 'Checking {} ...'.format(test_file_d), - '2/4 files checked 0% done', + '2/4 files checked 50% done', 'Checking {} ...'.format(test_file_b), - '3/4 files checked 0% done', + '3/4 files checked 75% done', 'Checking {} ...'.format(test_file_a), - '4/4 files checked 0% done' + '4/4 files checked 100% done' ] assert stderr == '' @@ -1044,13 +1044,13 @@ def test_markup(tmpdir): args = ['--library=qt', test_file_1, test_file_2, test_file_3, test_file_4, '-j1'] out_lines = [ 'Checking {} ...'.format(test_file_2), - '1/4 files checked 0% done', + '1/4 files checked 25% done', 'Checking {} ...'.format(test_file_4), - '2/4 files checked 0% done', + '2/4 files checked 50% done', 'Checking {} ...'.format(test_file_1), - '3/4 files checked 0% done', + '3/4 files checked 75% done', 'Checking {} ...'.format(test_file_3), - '4/4 files checked 0% done' + '4/4 files checked 100% done' ] assert_cppcheck(args, ec_exp=0, err_exp=[], out_exp=out_lines) @@ -1207,11 +1207,11 @@ def test_file_duplicate_2(tmpdir): lines = stdout.splitlines() assert lines == [ 'Checking {} ...'.format(test_file_c), - '1/3 files checked 0% done', + '1/3 files checked 33% done', 'Checking {} ...'.format(test_file_a), - '2/3 files checked 0% done', + '2/3 files checked 66% done', 'Checking {} ...'.format(test_file_b), - '3/3 files checked 0% done' + '3/3 files checked 100% done' ] assert stderr == '' @@ -1239,28 +1239,28 @@ def test_file_duplicate_3(tmpdir): if sys.platform == 'win32': assert lines == [ 'Checking {} ...'.format('a.c'), - '1/6 files checked 0% done', + '1/6 files checked 16% done', 'Checking {} ...'.format('a.c'), - '2/6 files checked 0% done', + '2/6 files checked 33% done', 'Checking {} ...'.format('a.c'), - '3/6 files checked 0% done', + '3/6 files checked 50% done', 'Checking {} ...'.format(test_file_a), - '4/6 files checked 0% done', + '4/6 files checked 66% done', 'Checking {} ...'.format(test_file_a), - '5/6 files checked 0% done', + '5/6 files checked 83% done', 'Checking {} ...'.format(test_file_a), - '6/6 files checked 0% done' + '6/6 files checked 100% done' ] else: assert lines == [ 'Checking {} ...'.format('a.c'), - '1/4 files checked 0% done', + '1/4 files checked 25% done', 'Checking {} ...'.format('a.c'), - '2/4 files checked 0% done', + '2/4 files checked 50% done', 'Checking {} ...'.format(test_file_a), - '3/4 files checked 0% done', + '3/4 files checked 75% done', 'Checking {} ...'.format(test_file_a), - '4/4 files checked 0% done' + '4/4 files checked 100% done' ] assert stderr == '' @@ -1292,17 +1292,17 @@ def test_file_duplicate_4(tmpdir): # TODO: only a single file should be checked assert lines == [ 'Checking {} ...'.format('a.c'), - '1/6 files checked 0% done', + '1/6 files checked 16% done', 'Checking {} ...'.format('a.c'), - '2/6 files checked 0% done', + '2/6 files checked 33% done', 'Checking {} ...'.format('a.c'), - '3/6 files checked 0% done', + '3/6 files checked 50% done', 'Checking {} ...'.format(test_file_a), - '4/6 files checked 0% done', + '4/6 files checked 66% done', 'Checking {} ...'.format(test_file_a), - '5/6 files checked 0% done', + '5/6 files checked 83% done', 'Checking {} ...'.format(test_file_a), - '6/6 files checked 0% done' + '6/6 files checked 100% done' ] assert stderr == '' @@ -1657,7 +1657,7 @@ def test_filelist(tmpdir): ] assert len(expected), len(lines) for i in range(1, len(expected)+1): - lines.remove('{}/{} files checked 0% done'.format(i, len(expected))) + lines.remove('{}/{} files checked {}% done'.format(i, len(expected), int(100 * i // len(expected)))) assert lines == expected From d2952c231f2526ec6a9f4872a28cdebe38ca7183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 16:23:42 +0100 Subject: [PATCH 13/14] moreprojects --- test/cli/more-projects_test.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/cli/more-projects_test.py b/test/cli/more-projects_test.py index e9940d17b72..03dc00ed0f3 100644 --- a/test/cli/more-projects_test.py +++ b/test/cli/more-projects_test.py @@ -574,13 +574,13 @@ def test_project_file_order(tmpdir): lines = stdout.splitlines() assert lines == [ 'Checking {} ...'.format(test_file_c), - '1/4 files checked 0% done', + '1/4 files checked 25% done', 'Checking {} ...'.format(test_file_d), - '2/4 files checked 0% done', + '2/4 files checked 50% done', 'Checking {} ...'.format(test_file_b), - '3/4 files checked 0% done', + '3/4 files checked 75% done', 'Checking {} ...'.format(test_file_a), - '4/4 files checked 0% done' + '4/4 files checked 100% done' ] assert stderr == '' @@ -648,11 +648,11 @@ def test_project_file_duplicate_2(tmpdir): lines = stdout.splitlines() assert lines == [ 'Checking {} ...'.format(test_file_c), - '1/3 files checked 0% done', + '1/3 files checked 33% done', 'Checking {} ...'.format(test_file_a), - '2/3 files checked 0% done', + '2/3 files checked 66% done', 'Checking {} ...'.format(test_file_b), - '3/3 files checked 0% done' + '3/3 files checked 100% done' ] assert stderr == '' @@ -696,18 +696,18 @@ def test_project_file_duplicate_3(tmpdir): if sys.platform == 'win32': assert lines == [ 'Checking {} ...'.format(test_file_a), - '1/3 files checked 0% done', + '1/3 files checked 33% done', 'Checking {} ...'.format(test_file_a), - '2/3 files checked 0% done', + '2/3 files checked 66% done', 'Checking {} ...'.format(test_file_a), - '3/3 files checked 0% done' + '3/3 files checked 100% done' ] else: assert lines == [ 'Checking {} ...'.format(test_file_a), - '1/2 files checked 0% done', + '1/2 files checked 50% done', 'Checking {} ...'.format(test_file_a), - '2/2 files checked 0% done' + '2/2 files checked 100% done' ] assert stderr == '' @@ -764,11 +764,11 @@ def test_project_file_duplicate_4(tmpdir): # TODO: only a single file should be checked assert lines == [ 'Checking {} ...'.format(test_file_a), - '1/3 files checked 0% done', + '1/3 files checked 33% done', 'Checking {} ...'.format(test_file_a), - '2/3 files checked 0% done', + '2/3 files checked 66% done', 'Checking {} ...'.format(test_file_a), - '3/3 files checked 0% done' + '3/3 files checked 100% done' ] assert stderr == '' From 11b61782892c3547a2a588296f97f3c751ddf29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 14 Nov 2025 17:37:02 +0100 Subject: [PATCH 14/14] cleanup --- cli/processexecutor.cpp | 4 +--- cli/threadexecutor.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cli/processexecutor.cpp b/cli/processexecutor.cpp index a1b5dd2e5d4..7efd4106db1 100644 --- a/cli/processexecutor.cpp +++ b/cli/processexecutor.cpp @@ -407,9 +407,7 @@ unsigned int ProcessExecutor::check() fileCount++; processedsize += size; if (!mSettings.quiet) - Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), - mFileSettings.empty() ? processedsize : fileCount, - mFileSettings.empty() ? totalfilesize : mFileSettings.size()); + Executor::reportStatus(fileCount, mFiles.size() + mFileSettings.size(), processedsize, totalfilesize); close(*rp); rp = rpipes.erase(rp); diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp index 65ea40fbc32..b1bc75731ff 100644 --- a/cli/threadexecutor.cpp +++ b/cli/threadexecutor.cpp @@ -153,7 +153,7 @@ class ThreadData mProcessedSize += fileSize; mProcessedFiles++; if (!mSettings.quiet) - logForwarder.reportStatus(mProcessedFiles, mTotalFiles, mTotalFileSize>0 ? mProcessedSize : mProcessedFiles, mTotalFileSize>0 ? mTotalFileSize: mTotalFiles); + logForwarder.reportStatus(mProcessedFiles, mTotalFiles, mProcessedSize, mTotalFileSize); } private: