Commit graph Crafter.Build/tests/StaticLibSourceRemoved
Author SHA1 Message Date
c82b2bb18c
test(build): a source that leaves a static library leaves its archive
StaticLibSourceRemoved builds a static library and a program on it, on
a fresh copy of its fixture outside the checkout. The library has three
sources: lib/first.cpp and lib/second.cpp each define Value(), returning
1 and 2, and lib/extra.cpp defines a function nothing calls. It is
built three times, by configurations of one name and directory: from
the first and the extra source, from the first alone, and from the
second in the first's place, as the project of a renamed source lists
it. The program prints 1, 1 and 2, and `llvm-ar t` lists the archive's
members as first_impl.o and extra_impl.o, then first_impl.o, then
second_impl.o.

While the second and the third build run, a thread of the test looks
for the archive again and again and has to find it every time: the new
archive is moved into the place of the old one, where a build that
removed the old one first would leave whatever links the library at
that moment without it.

Before the fix the second build's archive listed first_impl.o and
extra_impl.o, and the third's those two and second_impl.o, with a
program that printed 1.
2026-11-19 09:20:32 +01:00