]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
t/httpd-corner: fix test on missing curl-config(1)
authorEric Wong <e@80x24.org>
Fri, 12 Sep 2025 21:28:49 +0000 (21:28 +0000)
committerEric Wong <e@80x24.org>
Sat, 13 Sep 2025 19:26:21 +0000 (19:26 +0000)
We were misusing our internal context-dependent `require_cmd',
which requires the caller to call `skip' explicitly when a
return value is desired.  So add a new `skip' call for testers
without curl-config(1).  Furthermore, the `SKIP' label was
incorrectly placed for Test::More::skip to use, so create an
explicit block for it.

Reported-by: Jonathan Corbet <corbet@lwn.net>
Link: https://public-inbox.org/meta/878qikobes.fsf@trenco.lwn.net/
t/httpd-corner.t

index cf67ad28b9b78eef845714bfc6250c14d9aca5c5..ac40a7087f5c7ad4aa44f239c2b4995ebd3c1812 100644 (file)
@@ -231,8 +231,10 @@ if ('test rejected trailers') {
 # I don't trust myself to read RFCs properly and need a 3rd-party client:
 my $tup = "t/trailer-up-$Config{archname}";
 my @tup_h_st = stat 't/trailer-up.h' or die "stat('t/trailer-up.h'): $!";
-SKIP: if (!-e $tup || (stat(_))[10] < $tup_h_st[10]) {
-       my $curl_config = require_cmd 'curl-config', 1;
+SKIP: {
+if (!-e $tup || (stat(_))[10] < $tup_h_st[10]) {
+       my $curl_config = require_cmd('curl-config', 1) or
+               skip 'curl-config missing', 1;
        my %ccfg;
        for my $f (qw(version cc cflags libs)) {
                chomp($ccfg{$f} = xqx [ $curl_config, "--$f" ]);
@@ -251,6 +253,7 @@ SKIP: if (!-e $tup || (stat(_))[10] < $tup_h_st[10]) {
        xsys(\@build) and skip "@build failed: \$?=$?", 1;
        rename "$tup.$<.$$.tmp", $tup;
        stat $tup; # for _ below:
+}
 } # SKIP
 if (-x _) {
        my %opt = (0 => \'i', 1 => \(my $o = ''), 2 => \(my $e = ''));