From dfe9dfac225facbeb8ae2d219f5ba350b33bbba5 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Wed, 18 Nov 2026 16:27:24 -0800 Subject: [PATCH 1/2] test(ci): reproduce PCH-dependent module cache keys (Refs #5165) --- ci/test_libobs_modules_cache.py | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/ci/test_libobs_modules_cache.py b/ci/test_libobs_modules_cache.py index eb83bdc74f..93617d9ccb 100644 --- a/ci/test_libobs_modules_cache.py +++ b/ci/test_libobs_modules_cache.py @@ -20,6 +20,7 @@ import importlib.util import json import shutil +import subprocess import tempfile import unittest from pathlib import Path @@ -31,6 +32,9 @@ SPEC.loader.exec_module(mods) CC = shutil.which("cc") or shutil.which("gcc") or shutil.which("clang") +GCC = CC and "Free Software Foundation" in subprocess.run( + [CC, "--version"], capture_output=True, text=True, check=True +).stdout def fake_tree(base: Path, build_name: str, launcher: str | None = None, target_suffix: str = "") -> tuple[Path, Path]: @@ -87,6 +91,51 @@ def test_launcher_and_probe_name_do_not_change_the_key(self): _, probed = fake_tree(self.tmp, "b2", launcher="zccache", target_suffix="-keyprobe") self.assertEqual(self.keys(plain, source), self.keys(probed, source)) + def pch_tree(self): + source, build = fake_tree(self.tmp, "b") + header = source / "libobs" / "pch-only.h" + header.write_text("#define PCH_VALUE 1\n") + pch = source / "libobs" / "pch.h" + pch.write_text('#include "pch-only.h"\n') + database = build / "compile_commands.json" + entries = json.loads(database.read_text()) + entries[1]["arguments"][1:1] = ["-fpch-preprocess", "-include", str(pch)] + database.write_text(json.dumps(entries)) + return source, build, header, pch + + def compile_pch(self, source, build, pch): + subprocess.run( + [CC, f"-I{source}/libobs", f"-I{build}/config", "-O2", "-x", "c-header", str(pch), "-o", str(pch) + ".gch"], + capture_output=True, text=True, check=True, + ) + + @unittest.skipUnless(GCC, "requires GCC PCH dependency behavior") + def test_building_a_pch_does_not_change_the_key(self): + source, build, _, pch = self.pch_tree() + before = self.keys(build, source) + self.compile_pch(source, build, pch) + self.assertEqual(before, self.keys(build, source)) + + @unittest.skipUnless(GCC, "requires GCC PCH dependency behavior") + def test_a_built_pch_does_not_hide_header_edits(self): + source, build, header, pch = self.pch_tree() + self.compile_pch(source, build, pch) + before = self.keys(build, source) + header.write_text("#define PCH_VALUE 2\n") + after = self.keys(build, source) + self.assertNotEqual(before["graphics"], after["graphics"]) + self.assertEqual(before["core"], after["core"]) + + @unittest.skipUnless(GCC, "requires GCC preprocessing flag") + def test_pch_preprocessing_flag_does_not_change_the_key(self): + source, build, _, _ = self.pch_tree() + hosted = self.keys(build, source) + database = build / "compile_commands.json" + entries = json.loads(database.read_text()) + entries[1]["arguments"].remove("-fpch-preprocess") + database.write_text(json.dumps(entries)) + self.assertEqual(hosted, self.keys(build, source)) + MANIFESTS = { # libobs-rust -> obs-a (normal) -> obs-b (build, via the workspace); From d1db0e6b933bc77236ee2695a89eb6d8aba1449d Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Wed, 18 Nov 2026 16:28:02 -0800 Subject: [PATCH 2/2] ci: scan PCH headers consistently for module cache keys (Refs #5165) Ci-Attestation: {"at":1795048655,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":258,"stamp":"3d39937beb764431b16f2d8873b498f9","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048655,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":258,"stamp":"fe182a3935492b5fed75e1803705f1ff","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048655,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":258,"stamp":"c118d0e18be122da99a7fa5eef4c74f5","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048655,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":258,"stamp":"61239f9c9d845a02cc6f10ff1c3d12d9","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048394,"gate":"general/all/client-lint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"fded6c9c04db2938b7b0fcf68a89596c","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048655,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":258,"stamp":"16d16509c4da0e318341c2710cb5f881","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048396,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"162e91c018d04d92e9567832752aac8c","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048396,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"89d71be8b70688da7d1c46673ff644ef","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"94f401528848eacdb3efc493a5e530e0","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"7ee8c8e6e29d78a4e58cb95e47b17246","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"10f0da03cd5c0bd270d4645685947013","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"e8b16debc7a8f557103abc17ebb48afd","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"1468d27790717abfd4fb6063a5f8d8e7","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"7c95216187c868f2ffd73c556565909e","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"350a382996ac898e17d522df7054d63a","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"15071aa363f83bb4d78394bc5f041c12","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"150c59e0baf410f522850319c65f2ae9","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795048395,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"7dadac353cc1a5aa2ebe2eb97be131e006cd54be2299aa1055d35e6ef4233725","lane":"client-lint","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":22,"stamp":"1344f99c2119c3c03fb97643f17cdf39","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Ci-Attestation: {"at":1795049097,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"cd7f345db38e1a95831552b5879e0760802b67a363852f8068cc5ef1b34b7294","lane":"client-test-x86_64-unknown-linux-gnu","parents":["dfe9dfac225facbeb8ae2d219f5ba350b33bbba5"],"secs":441,"stamp":"62726ccda774cca9258d02e5a72e424f","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144","v":1,"via":"run"} Client-Checks: {"checks":{"base":"a62bfe717d5d9610a5136ca211273e66a1ae1f84","coverage":"all-tracked-applicable-files","diff":["ci/libobs_modules.py","ci/test_libobs_modules_cache.py"],"head":"95dea74c77b381786fb672a0ee0a49fb4f053e37","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"25bca37e28e14ac712462d671ac47ce85ca6f99de2c0b0b06e79a4915c7b86f3","tree":"33d3da3f6ccc8b8296871d492ea91c11bc42a144"}} --- ci/libobs_modules.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/libobs_modules.py b/ci/libobs_modules.py index d1a6b9b03d..55911510fd 100644 --- a/ci/libobs_modules.py +++ b/ci/libobs_modules.py @@ -98,7 +98,11 @@ def compile_args(args: list[str]) -> list[str]: if arg in ("-o", "-MF", "-MT", "-MQ"): skip = True continue - if arg in ("-c", "-MD", "-MMD") or arg.startswith(("-o", "/Fo", "/Fd", "-MF")): + # GCC's ccache integration adds this preprocessing-output flag. It + # does not change objects, but lets -M load a built PCH and omit its + # headers: restore (before the PCH exists) and store then disagree. + # Always scan the textual header closure, including when a PCH exists. + if arg in ("-c", "-MD", "-MMD", "-fpch-preprocess") or arg.startswith(("-o", "/Fo", "/Fd", "-MF")): continue out.append(arg) return out