test(incremental): a compiler update perturbs VariantId
Two toolchains that differ only in the clang release, as the Flatpak's do across an update, must give one Configuration two variants; so must the same release installed under another prefix. The no-argument form is checked to be the variant under the running toolchain, and BuildDir to be named for it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
b5a366d060
commit
995a40e7dd
1 changed files with 27 additions and 0 deletions
|
|
@ -133,6 +133,33 @@ int main() {
|
||||||
Check(a.BuildDir() != b.BuildDir(), "different VariantId yields different BuildDir");
|
Check(a.BuildDir() != b.BuildDir(), "different VariantId yields different BuildDir");
|
||||||
Check(a.BinDir() != b.BinDir(), "different VariantId yields different BinDir");
|
Check(a.BinDir() != b.BinDir(), "different VariantId yields different BinDir");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
// The compiler is compile state as much as any flag: a PCM can only
|
||||||
|
// be read by the clang release that wrote it, and nothing in a
|
||||||
|
// project's sources changes when the compiler does. With the
|
||||||
|
// toolchain left out of the id, a project built with clang 22 kept
|
||||||
|
// its PCMs after crafter-build moved to clang 23; the build after
|
||||||
|
// the update found nothing stale, and the first edit failed with
|
||||||
|
// "module file ... uses an older format that is no longer supported"
|
||||||
|
// until the project was cleaned by hand.
|
||||||
|
Configuration cfg = MakeBase();
|
||||||
|
Toolchain older;
|
||||||
|
older.clangxx = "/app/bin/clang++";
|
||||||
|
older.clangVersion = "clang version 22.1.8";
|
||||||
|
Toolchain newer = older;
|
||||||
|
newer.clangVersion = "clang version 23.1.2";
|
||||||
|
Check(cfg.VariantId(older) != cfg.VariantId(newer), "a compiler update at the same path perturbs VariantId");
|
||||||
|
Check(cfg.VariantId(older) == cfg.VariantId(older), "VariantId under one toolchain is deterministic");
|
||||||
|
|
||||||
|
// Two installs of one release are still two toolchains: their
|
||||||
|
// libc++ need not be the same build.
|
||||||
|
Toolchain elsewhere = older;
|
||||||
|
elsewhere.clangxx = "/usr/bin/clang++";
|
||||||
|
Check(cfg.VariantId(older) != cfg.VariantId(elsewhere), "the same release installed elsewhere perturbs VariantId");
|
||||||
|
|
||||||
|
Check(cfg.VariantId() == cfg.VariantId(GetToolchain()), "VariantId() is the variant under the running toolchain");
|
||||||
|
Check(cfg.BuildDir().filename() == cfg.VariantId(GetToolchain()), "BuildDir is named for the running toolchain's variant");
|
||||||
|
}
|
||||||
|
|
||||||
if (Failures > 0) {
|
if (Failures > 0) {
|
||||||
std::println(std::cerr, "{} assertions failed", Failures);
|
std::println(std::cerr, "{} assertions failed", Failures);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue