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.
This commit is contained in:
parent
2138015178
commit
c82b2bb18c
6 changed files with 196 additions and 0 deletions
4
tests/StaticLibSourceRemoved/fixture/lib/first.cpp
Normal file
4
tests/StaticLibSourceRemoved/fixture/lib/first.cpp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-only
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
|
||||
|
||||
int Value() { return 1; }
|
||||
Loading…
Reference in a new issue