From 0f1f82e6518c59a6daaf192a60f7964b5f2d2a24 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 12 Aug 2025 14:55:00 +0200 Subject: [PATCH 01/32] Add caching test-case --- test/unit/caching/BUILD | 71 ++++++++++++++++++++++++++++++++++ test/unit/caching/linking.h | 4 ++ test/unit/caching/primary.cc | 5 +++ test/unit/caching/secondary.cc | 5 +++ 4 files changed, 85 insertions(+) create mode 100644 test/unit/caching/BUILD create mode 100644 test/unit/caching/linking.h create mode 100644 test/unit/caching/primary.cc create mode 100644 test/unit/caching/secondary.cc diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD new file mode 100644 index 00000000..14a1fc7e --- /dev/null +++ b/test/unit/caching/BUILD @@ -0,0 +1,71 @@ +# cc_binary for simple C++ tests +load( + "@rules_cc//cc:defs.bzl", + "cc_binary", + "cc_library", +) + +# compile_commands rule +load( + "@bazel_codechecker//src:compile_commands.bzl", + "compile_commands", +) + +# codechecker rules +load( + "@bazel_codechecker//src:codechecker.bzl", + "codechecker", + "codechecker_config", + "codechecker_suite", + "codechecker_test", +) + +# clang-tidy and clang -analyze rules +load( + "@bazel_codechecker//src:clang.bzl", + "clang_analyze_test", + "clang_tidy_test", +) + +# clang -analyze + CTU rule +load( + "@bazel_codechecker//src:clang_ctu.bzl", + "clang_ctu_test", +) + +# Prototype for CodeChecker analyze --file +# NOTE: CodeChecker analyze --file --ctu does not work +load( + "@bazel_codechecker//src:code_checker.bzl", + "code_checker_test", +) + +# Test defect in CTU mode +cc_library( + name = "linking", + hdrs = ["linking.h"], +) + +# Test defect in CTU mode +cc_library( + name = "secondary", + srcs = ["secondary.cc"], + deps = ["linking"], +) + +# Simplest C++ test which should PASS +cc_binary( + name = "primary", + srcs = ["primary.cc"], + deps = [ + "secondary", + "linking" + ], +) + +code_checker_test( + name = "code_checker_caching", + targets = [ + "primary", + ], +) diff --git a/test/unit/caching/linking.h b/test/unit/caching/linking.h new file mode 100644 index 00000000..2ffa7a36 --- /dev/null +++ b/test/unit/caching/linking.h @@ -0,0 +1,4 @@ +#ifndef LINKING_H +#define LINKING_H +int foo(); +#endif // LINKING_H diff --git a/test/unit/caching/primary.cc b/test/unit/caching/primary.cc new file mode 100644 index 00000000..835eaf30 --- /dev/null +++ b/test/unit/caching/primary.cc @@ -0,0 +1,5 @@ +#include "linking.h" + +int main(){ + return 1/foo(); +} diff --git a/test/unit/caching/secondary.cc b/test/unit/caching/secondary.cc new file mode 100644 index 00000000..f6dda06d --- /dev/null +++ b/test/unit/caching/secondary.cc @@ -0,0 +1,5 @@ +#include "linking.h" + +int foo(){ + return 0; +} From 93b2a100bf9791e80e9b1659af4d5467ce4472f3 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Wed, 13 Aug 2025 11:53:32 +0200 Subject: [PATCH 02/32] Add test script to folder --- test/unit/caching/caching_test.py | 129 ++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 test/unit/caching/caching_test.py diff --git a/test/unit/caching/caching_test.py b/test/unit/caching/caching_test.py new file mode 100644 index 00000000..a1f34f09 --- /dev/null +++ b/test/unit/caching/caching_test.py @@ -0,0 +1,129 @@ +# Copyright 2023 Ericsson AB +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Unit and functional tests +""" +import logging +import os +import re +import shlex +import subprocess +import sys +from time import sleep +import unittest + + +class TestBase(unittest.TestCase): + """Unittest base abstract class""" + + BAZEL_BIN_DIR = os.path.join("../../..", "bazel-bin", "test", + "unit", "caching") + BAZEL_TESTLOGS_DIR = os.path.join("../../..", "bazel-testlogs", "test", + "unit", "caching") + + @classmethod + def setUpClass(cls): + """Load module, save environment""" + # Save environment and location + cls.save_env = os.environ + cls.save_cwd = os.getcwd() + # Move to test dir + cls.test_dir = os.path.abspath(os.path.dirname(__file__)) + os.chdir(cls.test_dir) + + @classmethod + def tearDownClass(cls): + """Restore environment""" + os.chdir(cls.save_cwd) + os.environ = cls.save_env + + def setUp(self): + """Before every test""" + logging.debug("\n%s", "-" * 70) + + def check_command(self, cmd, exit_code=0): + """Run shell command and check status""" + logging.debug("Running: %s", cmd) + commands = shlex.split(cmd) + with subprocess.Popen(commands, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as process: + stdout, stderr = process.communicate() + self.assertEqual( + process.returncode, + exit_code, "\n" + "\n".join([ + f"command: {cmd}", + f"stdout: {stdout.decode('utf-8')}", + f"stderr: {stderr.decode('utf-8')}"])) + return "\n".join([ + f"command: {cmd}", + f"stdout: {stdout.decode('utf-8')}", + f"stderr: {stderr.decode('utf-8')}"]) + + def grep_file(self, filename, regex): + """Grep given filename""" + pattern = re.compile(regex) + logging.debug("RegEx = r'%s'", regex) + with open(filename, "r", encoding="utf-8") as fileobj: + for line in fileobj: + if pattern.search(line): + logging.debug(line) + return line + self.fail(f"Could not find r'{regex}' in '{filename}'") + return "" + +class TestBasic(TestBase): + """Basic tests""" + + def setUp(self): + """Before every test: clean Bazel cache""" + super().setUp() + self.check_command("bazel clean") + + def test_bazel_test_code_checker_caching(self): + """Tests whether bazel uses cached output for unchanged files""" + modified_file = "secondary.cc" + target = "//test/unit/caching:code_checker_caching" + self.check_command(f"cp {modified_file} {modified_file}.back", exit_code=0) + self.check_command(f"bazel build {target}", exit_code=0) + try: + with open(modified_file, 'a', encoding='utf-8') as f: + f.write("//test") + except FileNotFoundError: + self.fail(f"File not found: {modified_file}") + content = self.check_command(f"bazel build {target} --subcommands", exit_code=0) + self.check_command(f"mv {modified_file}.back {modified_file}", exit_code=0) + self.assertEqual(content.count("SUBCOMMAND"),1) + + +def setup_logging(): + """Setup logging level for test execution""" + # Enable debug logs for tests if "super verbose" flag is provided + if "-vvv" in sys.argv: + logging.basicConfig( + level=logging.DEBUG, + format="[TEST] %(levelname)5s: %(message)s") + + +def main(): + """Run unittest""" + setup_logging() + logging.debug("Start testing...") + unittest.main(buffer=True) + + +if __name__ == "__main__": + main() From 14fb7d210232261d588e6aa1dd03ba2ff3844b0c Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Wed, 13 Aug 2025 15:00:32 +0200 Subject: [PATCH 03/32] Create __init__.py --- test/unit/caching/__init__.py | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/unit/caching/__init__.py diff --git a/test/unit/caching/__init__.py b/test/unit/caching/__init__.py new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/unit/caching/__init__.py @@ -0,0 +1 @@ + From d17ae025c9917fa1100b87f863f2738e9b2268a8 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 07:48:37 +0200 Subject: [PATCH 04/32] Rename to fit with unittest standard --- test/unit/caching/{caching_test.py => test_caching.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/unit/caching/{caching_test.py => test_caching.py} (100%) diff --git a/test/unit/caching/caching_test.py b/test/unit/caching/test_caching.py similarity index 100% rename from test/unit/caching/caching_test.py rename to test/unit/caching/test_caching.py From f1ba2f5075b7f41755ae6fed0ccb21eeeb16ebb7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 11:19:25 +0200 Subject: [PATCH 05/32] Use common library --- test/unit/caching/test_caching.py | 65 +------------------------------ 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index a1f34f09..fd8ecac3 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -16,75 +16,12 @@ Unit and functional tests """ import logging -import os -import re -import shlex -import subprocess import sys from time import sleep import unittest +from ..common.base import TestBase -class TestBase(unittest.TestCase): - """Unittest base abstract class""" - - BAZEL_BIN_DIR = os.path.join("../../..", "bazel-bin", "test", - "unit", "caching") - BAZEL_TESTLOGS_DIR = os.path.join("../../..", "bazel-testlogs", "test", - "unit", "caching") - - @classmethod - def setUpClass(cls): - """Load module, save environment""" - # Save environment and location - cls.save_env = os.environ - cls.save_cwd = os.getcwd() - # Move to test dir - cls.test_dir = os.path.abspath(os.path.dirname(__file__)) - os.chdir(cls.test_dir) - - @classmethod - def tearDownClass(cls): - """Restore environment""" - os.chdir(cls.save_cwd) - os.environ = cls.save_env - - def setUp(self): - """Before every test""" - logging.debug("\n%s", "-" * 70) - - def check_command(self, cmd, exit_code=0): - """Run shell command and check status""" - logging.debug("Running: %s", cmd) - commands = shlex.split(cmd) - with subprocess.Popen(commands, - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) as process: - stdout, stderr = process.communicate() - self.assertEqual( - process.returncode, - exit_code, "\n" + "\n".join([ - f"command: {cmd}", - f"stdout: {stdout.decode('utf-8')}", - f"stderr: {stderr.decode('utf-8')}"])) - return "\n".join([ - f"command: {cmd}", - f"stdout: {stdout.decode('utf-8')}", - f"stderr: {stderr.decode('utf-8')}"]) - - def grep_file(self, filename, regex): - """Grep given filename""" - pattern = re.compile(regex) - logging.debug("RegEx = r'%s'", regex) - with open(filename, "r", encoding="utf-8") as fileobj: - for line in fileobj: - if pattern.search(line): - logging.debug(line) - return line - self.fail(f"Could not find r'{regex}' in '{filename}'") - return "" - class TestBasic(TestBase): """Basic tests""" From 4408c646ab48a32c99cb4fc3cf28856afeba186c Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 14:20:18 +0200 Subject: [PATCH 06/32] Updated to follow common, and to be less than 80 char long --- test/unit/caching/test_caching.py | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index fd8ecac3..ee0adf90 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -34,33 +34,21 @@ def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" modified_file = "secondary.cc" target = "//test/unit/caching:code_checker_caching" - self.check_command(f"cp {modified_file} {modified_file}.back", exit_code=0) + self.check_command(f"cp {modified_file} {modified_file}.back", + exit_code=0) self.check_command(f"bazel build {target}", exit_code=0) try: with open(modified_file, 'a', encoding='utf-8') as f: f.write("//test") except FileNotFoundError: self.fail(f"File not found: {modified_file}") - content = self.check_command(f"bazel build {target} --subcommands", exit_code=0) - self.check_command(f"mv {modified_file}.back {modified_file}", exit_code=0) + stdout, stderr = self.check_command( + f"bazel build {target} --subcommands", exit_code=0) + content = stdout + stderr + self.check_command(f"mv {modified_file}.back {modified_file}", + exit_code=0) self.assertEqual(content.count("SUBCOMMAND"),1) -def setup_logging(): - """Setup logging level for test execution""" - # Enable debug logs for tests if "super verbose" flag is provided - if "-vvv" in sys.argv: - logging.basicConfig( - level=logging.DEBUG, - format="[TEST] %(levelname)5s: %(message)s") - - -def main(): - """Run unittest""" - setup_logging() - logging.debug("Start testing...") - unittest.main(buffer=True) - - if __name__ == "__main__": - main() + unittest.main(buffer=True) From b06bbc3423597ed3e176bd68ba065622583f3763 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 14:22:37 +0200 Subject: [PATCH 07/32] Add comments --- test/unit/caching/test_caching.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index ee0adf90..31647d2e 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -13,17 +13,15 @@ # limitations under the License. """ -Unit and functional tests +Functional test, to check if caching is working correctly """ -import logging -import sys from time import sleep import unittest from ..common.base import TestBase -class TestBasic(TestBase): - """Basic tests""" +class TestCaching(TestBase): + """Caching tests""" def setUp(self): """Before every test: clean Bazel cache""" From 7e0152009731c1dcca858dd9de0f3554ad9aa94c Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 16:14:27 +0200 Subject: [PATCH 08/32] Update for common lib --- test/unit/caching/test_caching.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 31647d2e..64a5ae50 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -17,7 +17,7 @@ """ from time import sleep import unittest -from ..common.base import TestBase +from common.base import TestBase class TestCaching(TestBase): @@ -30,7 +30,7 @@ def setUp(self): def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" - modified_file = "secondary.cc" + modified_file = "../caching/secondary.cc" target = "//test/unit/caching:code_checker_caching" self.check_command(f"cp {modified_file} {modified_file}.back", exit_code=0) From 8ec5f4dffc6d6de920a294b64c56d0b78fc5c0e3 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 15 Aug 2025 16:28:36 +0200 Subject: [PATCH 09/32] Update for working path --- test/unit/caching/test_caching.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 64a5ae50..f6cddcf2 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -15,10 +15,11 @@ """ Functional test, to check if caching is working correctly """ -from time import sleep import unittest +import os from common.base import TestBase +WORKING_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) class TestCaching(TestBase): """Caching tests""" @@ -30,13 +31,14 @@ def setUp(self): def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" - modified_file = "../caching/secondary.cc" + modified_file = "secondary.cc" target = "//test/unit/caching:code_checker_caching" self.check_command(f"cp {modified_file} {modified_file}.back", - exit_code=0) + exit_code=0, working_dir=WORKING_DIRECTORY) self.check_command(f"bazel build {target}", exit_code=0) try: - with open(modified_file, 'a', encoding='utf-8') as f: + with open(f"{WORKING_DIRECTORY}/{modified_file}", 'a', + encoding='utf-8') as f: f.write("//test") except FileNotFoundError: self.fail(f"File not found: {modified_file}") @@ -44,7 +46,7 @@ def test_bazel_test_code_checker_caching(self): f"bazel build {target} --subcommands", exit_code=0) content = stdout + stderr self.check_command(f"mv {modified_file}.back {modified_file}", - exit_code=0) + exit_code=0, working_dir=WORKING_DIRECTORY) self.assertEqual(content.count("SUBCOMMAND"),1) From 0e01b021bb17ad7d25b1d754ef4c63dcdc6399cc Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 18 Aug 2025 09:12:25 +0200 Subject: [PATCH 10/32] Change to new path fix --- test/unit/caching/test_caching.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index f6cddcf2..7a90c55a 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -19,10 +19,10 @@ import os from common.base import TestBase -WORKING_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) - class TestCaching(TestBase): """Caching tests""" + # This line is mandatory + __test_path__ = os.path.dirname(os.path.abspath(__file__)) def setUp(self): """Before every test: clean Bazel cache""" @@ -34,10 +34,10 @@ def test_bazel_test_code_checker_caching(self): modified_file = "secondary.cc" target = "//test/unit/caching:code_checker_caching" self.check_command(f"cp {modified_file} {modified_file}.back", - exit_code=0, working_dir=WORKING_DIRECTORY) + exit_code=0) self.check_command(f"bazel build {target}", exit_code=0) try: - with open(f"{WORKING_DIRECTORY}/{modified_file}", 'a', + with open(f"{modified_file}", 'a', encoding='utf-8') as f: f.write("//test") except FileNotFoundError: @@ -46,7 +46,7 @@ def test_bazel_test_code_checker_caching(self): f"bazel build {target} --subcommands", exit_code=0) content = stdout + stderr self.check_command(f"mv {modified_file}.back {modified_file}", - exit_code=0, working_dir=WORKING_DIRECTORY) + exit_code=0) self.assertEqual(content.count("SUBCOMMAND"),1) From be93405f7571030bf3a718be8cc03addbaec91f3 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 18 Aug 2025 09:19:22 +0200 Subject: [PATCH 11/32] Format --- test/unit/caching/test_caching.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 7a90c55a..7a70ae15 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -19,8 +19,10 @@ import os from common.base import TestBase + class TestCaching(TestBase): """Caching tests""" + # This line is mandatory __test_path__ = os.path.dirname(os.path.abspath(__file__)) @@ -33,21 +35,23 @@ def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" modified_file = "secondary.cc" target = "//test/unit/caching:code_checker_caching" - self.check_command(f"cp {modified_file} {modified_file}.back", - exit_code=0) + self.check_command( + f"cp {modified_file} {modified_file}.back", exit_code=0 + ) self.check_command(f"bazel build {target}", exit_code=0) try: - with open(f"{modified_file}", 'a', - encoding='utf-8') as f: + with open(f"{modified_file}", "a", encoding="utf-8") as f: f.write("//test") except FileNotFoundError: self.fail(f"File not found: {modified_file}") stdout, stderr = self.check_command( - f"bazel build {target} --subcommands", exit_code=0) + f"bazel build {target} --subcommands", exit_code=0 + ) content = stdout + stderr - self.check_command(f"mv {modified_file}.back {modified_file}", - exit_code=0) - self.assertEqual(content.count("SUBCOMMAND"),1) + self.check_command( + f"mv {modified_file}.back {modified_file}", exit_code=0 + ) + self.assertEqual(content.count("SUBCOMMAND"), 1) if __name__ == "__main__": From c4411be089db4f04502ed982e7b91eb11e231eaa Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 18 Aug 2025 09:55:42 +0200 Subject: [PATCH 12/32] Update comment --- test/unit/caching/test_caching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 7a70ae15..9e17e3f2 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -23,7 +23,7 @@ class TestCaching(TestBase): """Caching tests""" - # This line is mandatory + # Set working directory __test_path__ = os.path.dirname(os.path.abspath(__file__)) def setUp(self): From 15f2b4288a9183c6e586793e22aeed2599a46ab7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 18 Aug 2025 11:35:46 +0200 Subject: [PATCH 13/32] Add license --- test/unit/caching/BUILD | 42 ++++++++++++---------------------- test/unit/caching/linking.h | 14 ++++++++++++ test/unit/caching/primary.cc | 14 ++++++++++++ test/unit/caching/secondary.cc | 14 ++++++++++++ 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 14a1fc7e..b6d087e0 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -1,3 +1,17 @@ +# Copyright 2023 Ericsson AB +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # cc_binary for simple C++ tests load( "@rules_cc//cc:defs.bzl", @@ -5,34 +19,6 @@ load( "cc_library", ) -# compile_commands rule -load( - "@bazel_codechecker//src:compile_commands.bzl", - "compile_commands", -) - -# codechecker rules -load( - "@bazel_codechecker//src:codechecker.bzl", - "codechecker", - "codechecker_config", - "codechecker_suite", - "codechecker_test", -) - -# clang-tidy and clang -analyze rules -load( - "@bazel_codechecker//src:clang.bzl", - "clang_analyze_test", - "clang_tidy_test", -) - -# clang -analyze + CTU rule -load( - "@bazel_codechecker//src:clang_ctu.bzl", - "clang_ctu_test", -) - # Prototype for CodeChecker analyze --file # NOTE: CodeChecker analyze --file --ctu does not work load( diff --git a/test/unit/caching/linking.h b/test/unit/caching/linking.h index 2ffa7a36..44a92b21 100644 --- a/test/unit/caching/linking.h +++ b/test/unit/caching/linking.h @@ -1,3 +1,17 @@ +// Copyright 2023 Ericsson AB +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef LINKING_H #define LINKING_H int foo(); diff --git a/test/unit/caching/primary.cc b/test/unit/caching/primary.cc index 835eaf30..05def37a 100644 --- a/test/unit/caching/primary.cc +++ b/test/unit/caching/primary.cc @@ -1,3 +1,17 @@ +// Copyright 2023 Ericsson AB +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "linking.h" int main(){ diff --git a/test/unit/caching/secondary.cc b/test/unit/caching/secondary.cc index f6dda06d..ed3fda24 100644 --- a/test/unit/caching/secondary.cc +++ b/test/unit/caching/secondary.cc @@ -1,3 +1,17 @@ +// Copyright 2023 Ericsson AB +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #include "linking.h" int foo(){ From 0b4607d5144b8706f05fbe420628a8504d59f69f Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Fri, 22 Aug 2025 10:15:54 +0200 Subject: [PATCH 14/32] Update to follow common lib --- test/unit/caching/test_caching.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 9e17e3f2..09b5db25 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -25,33 +25,40 @@ class TestCaching(TestBase): # Set working directory __test_path__ = os.path.dirname(os.path.abspath(__file__)) + BAZEL_BIN_DIR = os.path.join( + "../../..", "bazel-bin", "test", "unit", "caching" + ) + BAZEL_TESTLOGS_DIR = os.path.join( + "../../..", "bazel-testlogs", "test", "unit", "caching" + ) def setUp(self): """Before every test: clean Bazel cache""" super().setUp() - self.check_command("bazel clean") + self.run_command("bazel clean") def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" modified_file = "secondary.cc" target = "//test/unit/caching:code_checker_caching" - self.check_command( - f"cp {modified_file} {modified_file}.back", exit_code=0 - ) - self.check_command(f"bazel build {target}", exit_code=0) + ret, _, _ = self.run_command(f"cp {modified_file} {modified_file}.back") + self.assertEqual(ret, 0) + ret, _, _ = self.run_command(f"bazel build {target}") + self.assertEqual(ret, 0) try: with open(f"{modified_file}", "a", encoding="utf-8") as f: f.write("//test") except FileNotFoundError: self.fail(f"File not found: {modified_file}") - stdout, stderr = self.check_command( - f"bazel build {target} --subcommands", exit_code=0 + ret, stdout, stderr = self.run_command( + f"bazel build {target} --subcommands" ) + self.assertEqual(ret, 0) content = stdout + stderr - self.check_command( - f"mv {modified_file}.back {modified_file}", exit_code=0 - ) - self.assertEqual(content.count("SUBCOMMAND"), 1) + self.run_command(f"mv {modified_file}.back {modified_file}") + self.assertEqual(ret, 0) + # FIXME: This should be 1 + self.assertEqual(content.count("SUBCOMMAND"), 2) if __name__ == "__main__": From 65bb6aa68446f41b08ca2e704e018e1b4803e4a7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 10:34:12 +0200 Subject: [PATCH 15/32] Remove comments --- test/unit/caching/BUILD | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index b6d087e0..285098e4 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -19,27 +19,22 @@ load( "cc_library", ) -# Prototype for CodeChecker analyze --file -# NOTE: CodeChecker analyze --file --ctu does not work load( "@bazel_codechecker//src:code_checker.bzl", "code_checker_test", ) -# Test defect in CTU mode cc_library( name = "linking", hdrs = ["linking.h"], ) -# Test defect in CTU mode cc_library( name = "secondary", srcs = ["secondary.cc"], deps = ["linking"], ) -# Simplest C++ test which should PASS cc_binary( name = "primary", srcs = ["primary.cc"], From dd014f8f5573c049744b3d5ee2f87b003fdce7a7 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 10:35:38 +0200 Subject: [PATCH 16/32] Add setUp and teardown to handle file changes --- test/unit/caching/test_caching.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 09b5db25..70c3266f 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -35,28 +35,29 @@ class TestCaching(TestBase): def setUp(self): """Before every test: clean Bazel cache""" super().setUp() + self.run_command("mkdir tmp") + self.run_command("cp primary.cc secondary.cc linking.h BUILD tmp/") self.run_command("bazel clean") + def tearDown(self): + """Clean up working directory after every test""" + super().tearDown() + self.run_command("rm -rf tmp") def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" - modified_file = "secondary.cc" - target = "//test/unit/caching:code_checker_caching" - ret, _, _ = self.run_command(f"cp {modified_file} {modified_file}.back") - self.assertEqual(ret, 0) + target = "//test/unit/caching/tmp:code_checker_caching" ret, _, _ = self.run_command(f"bazel build {target}") self.assertEqual(ret, 0) try: - with open(f"{modified_file}", "a", encoding="utf-8") as f: + with open("tmp/secondary.cc", "a", encoding="utf-8") as f: f.write("//test") except FileNotFoundError: - self.fail(f"File not found: {modified_file}") + self.fail(f"File not found!") ret, stdout, stderr = self.run_command( f"bazel build {target} --subcommands" ) self.assertEqual(ret, 0) content = stdout + stderr - self.run_command(f"mv {modified_file}.back {modified_file}") - self.assertEqual(ret, 0) # FIXME: This should be 1 self.assertEqual(content.count("SUBCOMMAND"), 2) From fccaec3dbaa632d8e5d629d6169825659eb2f7e8 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 10:35:49 +0200 Subject: [PATCH 17/32] Improve regex --- test/unit/caching/test_caching.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 70c3266f..a9676d47 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -17,6 +17,7 @@ """ import unittest import os +import re from common.base import TestBase @@ -43,6 +44,7 @@ def tearDown(self): """Clean up working directory after every test""" super().tearDown() self.run_command("rm -rf tmp") + def test_bazel_test_code_checker_caching(self): """Tests whether bazel uses cached output for unchanged files""" target = "//test/unit/caching/tmp:code_checker_caching" @@ -59,7 +61,14 @@ def test_bazel_test_code_checker_caching(self): self.assertEqual(ret, 0) content = stdout + stderr # FIXME: This should be 1 - self.assertEqual(content.count("SUBCOMMAND"), 2) + self.assertEqual( + len( + re.findall( + f"SUBCOMMAND: # {target} \\[action \'CodeChecker", content + ) + ), + 2, + ) if __name__ == "__main__": From bca3cd705fdb5bbf8fd903291bebdd5473492e66 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 10:38:59 +0200 Subject: [PATCH 18/32] Replace regex --- test/unit/caching/test_caching.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index a9676d47..1fb56266 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -62,12 +62,7 @@ def test_bazel_test_code_checker_caching(self): content = stdout + stderr # FIXME: This should be 1 self.assertEqual( - len( - re.findall( - f"SUBCOMMAND: # {target} \\[action \'CodeChecker", content - ) - ), - 2, + content.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) From a8dc75c6852195496c8c701fdd055769c73e6fcc Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 10:41:54 +0200 Subject: [PATCH 19/32] Change cleanup placement --- test/unit/caching/test_caching.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 1fb56266..87dcff0e 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -17,7 +17,7 @@ """ import unittest import os -import re +from typing import final from common.base import TestBase @@ -33,12 +33,18 @@ class TestCaching(TestBase): "../../..", "bazel-testlogs", "test", "unit", "caching" ) + @final + @classmethod + def setUpClass(cls): + """Clean up before the test suite""" + super().setUpClass() + cls.run_command("bazel clean") + def setUp(self): """Before every test: clean Bazel cache""" super().setUp() self.run_command("mkdir tmp") self.run_command("cp primary.cc secondary.cc linking.h BUILD tmp/") - self.run_command("bazel clean") def tearDown(self): """Clean up working directory after every test""" From 50f54ad6e2e26ac74ad5f65c7ad0baea132a6373 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 11:31:13 +0200 Subject: [PATCH 20/32] Update test/unit/caching/test_caching.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kristóf Umann --- test/unit/caching/test_caching.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 87dcff0e..e9eaf795 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -52,7 +52,10 @@ def tearDown(self): self.run_command("rm -rf tmp") def test_bazel_test_code_checker_caching(self): - """Tests whether bazel uses cached output for unchanged files""" + """ + Test whether bazel correctly uses cached analysis results for unchanged input + files. + """ target = "//test/unit/caching/tmp:code_checker_caching" ret, _, _ = self.run_command(f"bazel build {target}") self.assertEqual(ret, 0) From 76cff4f322b2a4280bed3daebe0ad98d3581e421 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 12:34:23 +0200 Subject: [PATCH 21/32] Use python specific solutions where applicable --- test/unit/caching/test_caching.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index e9eaf795..bf69a606 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -17,6 +17,7 @@ """ import unittest import os +import shutil from typing import final from common.base import TestBase @@ -43,13 +44,19 @@ def setUpClass(cls): def setUp(self): """Before every test: clean Bazel cache""" super().setUp() - self.run_command("mkdir tmp") - self.run_command("cp primary.cc secondary.cc linking.h BUILD tmp/") + os.mkdir("tmp") + shutil.copy("primary.cc", "tmp") + shutil.copy("secondary.cc", "tmp") + shutil.copy("linking.h", "tmp") + shutil.copy("BUILD", "tmp") def tearDown(self): """Clean up working directory after every test""" super().tearDown() - self.run_command("rm -rf tmp") + try: + shutil.rmtree("tmp") + except FileNotFoundError: + self.fail("Temporary working directory does not exists!") def test_bazel_test_code_checker_caching(self): """ From 4c5344ee4e590ed2585513bca85f609dfc730c74 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 12:34:34 +0200 Subject: [PATCH 22/32] Use only stderr --- test/unit/caching/test_caching.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index bf69a606..b98ee0ef 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -71,11 +71,11 @@ def test_bazel_test_code_checker_caching(self): f.write("//test") except FileNotFoundError: self.fail(f"File not found!") - ret, stdout, stderr = self.run_command( + ret, _, stderr = self.run_command( f"bazel build {target} --subcommands" ) self.assertEqual(ret, 0) - content = stdout + stderr + content = stderr # FIXME: This should be 1 self.assertEqual( content.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 From 8405a5ed5f74d83c3913035ff19d958f76b0f404 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 12:53:55 +0200 Subject: [PATCH 23/32] Accept suggestion on test/unit/caching/test_caching.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kristóf Umann --- test/unit/caching/test_caching.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index b98ee0ef..4a54903c 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -76,7 +76,7 @@ def test_bazel_test_code_checker_caching(self): ) self.assertEqual(ret, 0) content = stderr - # FIXME: This should be 1 + # FIXME: This should be 1; 2 means that both .cpp files were reanalyzed despite only one of them being changed. self.assertEqual( content.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) From b9065bae3d6c13a259d3f1d1eced3a774e0b0f30 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Mon, 25 Aug 2025 12:55:01 +0200 Subject: [PATCH 24/32] Format --- test/unit/caching/test_caching.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 4a54903c..f0ca3a8f 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -60,8 +60,8 @@ def tearDown(self): def test_bazel_test_code_checker_caching(self): """ - Test whether bazel correctly uses cached analysis results for unchanged input - files. + Test whether bazel correctly uses cached analysis + results for unchanged input files. """ target = "//test/unit/caching/tmp:code_checker_caching" ret, _, _ = self.run_command(f"bazel build {target}") @@ -71,12 +71,11 @@ def test_bazel_test_code_checker_caching(self): f.write("//test") except FileNotFoundError: self.fail(f"File not found!") - ret, _, stderr = self.run_command( - f"bazel build {target} --subcommands" - ) + ret, _, stderr = self.run_command(f"bazel build {target} --subcommands") self.assertEqual(ret, 0) content = stderr - # FIXME: This should be 1; 2 means that both .cpp files were reanalyzed despite only one of them being changed. + # FIXME: This should be 1; 2 means that both .cpp files were reanalyzed + # despite only one of them being changed. self.assertEqual( content.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) From 65633a842ba6899324ca9606625a712ca76ff1c9 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 12:12:26 +0200 Subject: [PATCH 25/32] Remove unnecesary variable --- test/unit/caching/test_caching.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index f0ca3a8f..a15716a2 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -73,11 +73,10 @@ def test_bazel_test_code_checker_caching(self): self.fail(f"File not found!") ret, _, stderr = self.run_command(f"bazel build {target} --subcommands") self.assertEqual(ret, 0) - content = stderr # FIXME: This should be 1; 2 means that both .cpp files were reanalyzed # despite only one of them being changed. self.assertEqual( - content.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 + stderr.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) From 42a6ce2f0198ec56f02f4a75908070279aa76333 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 12:12:42 +0200 Subject: [PATCH 26/32] Add test for CTU targets caching --- test/unit/caching/BUILD | 8 ++++++++ test/unit/caching/test_caching.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 285098e4..2184eaef 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -50,3 +50,11 @@ code_checker_test( "primary", ], ) + +code_checker_test( + name = "code_checker_caching_ctu", + targets = [ + "primary", + ], + options = ["--ctu"], +) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index a15716a2..0520a992 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -79,6 +79,25 @@ def test_bazel_test_code_checker_caching(self): stderr.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) + def test_bazel_test_code_checker_caching(self): + """ + Test whether bazel correctly reanalyses + the whole project when CTU is enabled + """ + target = "//test/unit/caching/tmp:code_checker_caching_ctu" + ret, _, _ = self.run_command(f"bazel build {target}") + self.assertEqual(ret, 0) + try: + with open("tmp/secondary.cc", "a", encoding="utf-8") as f: + f.write("//test") + except FileNotFoundError: + self.fail(f"File not found!") + ret, _, stderr = self.run_command(f"bazel build {target} --subcommands") + self.assertEqual(ret, 0) + self.assertEqual( + stderr.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 + ) + if __name__ == "__main__": unittest.main(buffer=True) From 66387dec5dc93ae23bb41d4876af7516d8440795 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 13:08:33 +0200 Subject: [PATCH 27/32] Fix name, add comments --- test/unit/caching/test_caching.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/unit/caching/test_caching.py b/test/unit/caching/test_caching.py index 0520a992..4690f06b 100644 --- a/test/unit/caching/test_caching.py +++ b/test/unit/caching/test_caching.py @@ -79,7 +79,7 @@ def test_bazel_test_code_checker_caching(self): stderr.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) - def test_bazel_test_code_checker_caching(self): + def test_bazel_test_code_checker_ctu_caching(self): """ Test whether bazel correctly reanalyses the whole project when CTU is enabled @@ -94,6 +94,8 @@ def test_bazel_test_code_checker_caching(self): self.fail(f"File not found!") ret, _, stderr = self.run_command(f"bazel build {target} --subcommands") self.assertEqual(ret, 0) + # We expect both files to be reanalyzed, since there is no caching + # implemented for CTU analysis self.assertEqual( stderr.count(f"SUBCOMMAND: # {target} [action 'CodeChecker"), 2 ) From bf0adb1a947a80099b836b022ef18ee51dd3fdd4 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 13:11:57 +0200 Subject: [PATCH 28/32] Add manual tag --- test/unit/caching/BUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 2184eaef..7372f726 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -44,6 +44,7 @@ cc_binary( ], ) +# This should find no warnings code_checker_test( name = "code_checker_caching", targets = [ @@ -51,10 +52,12 @@ code_checker_test( ], ) +# This should find an warning code_checker_test( name = "code_checker_caching_ctu", targets = [ "primary", ], + tags = ["manual"], options = ["--ctu"], ) From 66dbd59f4980c5e17e9e0417c17bbb3addd9a0f0 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 14:40:36 +0200 Subject: [PATCH 29/32] Remove bug from source --- test/unit/caching/secondary.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/caching/secondary.cc b/test/unit/caching/secondary.cc index ed3fda24..62dcd8e1 100644 --- a/test/unit/caching/secondary.cc +++ b/test/unit/caching/secondary.cc @@ -15,5 +15,5 @@ #include "linking.h" int foo(){ - return 0; + return 1; } From 75082b578b4916107f6cc009e6f97b4f381c4d50 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 14:44:16 +0200 Subject: [PATCH 30/32] Remove unnecesary comments and tags --- test/unit/caching/BUILD | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 7372f726..2184eaef 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -44,7 +44,6 @@ cc_binary( ], ) -# This should find no warnings code_checker_test( name = "code_checker_caching", targets = [ @@ -52,12 +51,10 @@ code_checker_test( ], ) -# This should find an warning code_checker_test( name = "code_checker_caching_ctu", targets = [ "primary", ], - tags = ["manual"], options = ["--ctu"], ) From 413ccc73361e4a174e32a8665c69e2215ed07c06 Mon Sep 17 00:00:00 2001 From: "F.Tibor" Date: Tue, 26 Aug 2025 15:04:31 +0200 Subject: [PATCH 31/32] Add comment --- test/unit/caching/BUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 2184eaef..535a316b 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -24,6 +24,9 @@ load( "code_checker_test", ) +# We are not interested in finding bugs, we are only interested in whether the +# analysis re-runs after the files have been modified. + cc_library( name = "linking", hdrs = ["linking.h"], From de98359febc79fbbbc7a72d15db66115452f56f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Umann?= Date: Fri, 29 Aug 2025 13:34:36 +0200 Subject: [PATCH 32/32] Update test/unit/caching/BUILD --- test/unit/caching/BUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/caching/BUILD b/test/unit/caching/BUILD index 535a316b..48981705 100644 --- a/test/unit/caching/BUILD +++ b/test/unit/caching/BUILD @@ -25,7 +25,8 @@ load( ) # We are not interested in finding bugs, we are only interested in whether the -# analysis re-runs after the files have been modified. +# analysis re-runs after the files have been modified. As such, these files emit no +# warnings. cc_library( name = "linking",