build: sync tests unity builds between cmake and autotools

Instead of relying on CMake's built-in unity feature, use `mk-unity.pl`,
as already done with autotools. It simplified the build, shortens logs
and makes debugging easier because of the fewer build variations.
It also allows testing / fixing with cmake and those automatically apply
to autotools builds too. cmake builds can be much-much faster, esp.
when working the builds themselves.

It also enables "unity" in old cmake versions. Basically every test
target is a single generated .c source.

Also:
- drop a `lib` unity workaround for libtests with autotools after fixing
  the issue in libtests itself. It drops a few exceptions and makes
  libcurl build faster (in autotools unity).
- fix another `lib` autotools unity issue and drop the workaround for it
  from `mk-unity.pl`. `srcdir` was missing from the header path.
- simplify `mk-unity.pl` command-lines, drop exclusions.

Follow-up to 2c27a67daa #17590

Closes #17628
This commit is contained in:
Viktor Szakats 2025-06-15 21:54:20 +02:00
parent 3186a20483
commit ee06673296
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
9 changed files with 48 additions and 45 deletions

View file

@ -91,10 +91,10 @@ foreach my $src (@src) {
if($src =~ /([a-z0-9]+)\.c$/ && !exists $exclude{$src}) {
my $name = $1;
my $fn = $src;
if($srcdir ne "" && (exists $include{$src} || $embed) && -e "$srcdir/$fn") {
$fn = $srcdir . "/" . $fn;
}
if($embed) {
if($srcdir ne "" && -e "$srcdir/$fn") {
$fn = $srcdir . "/" . $fn;
}
my $content = do { local $/; open my $fh, '<', $fn or die $!; <$fh> };
print $content;
}