]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
squid-conf-tests: Ignore tests with mismatching autoconf macro (#1648)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Mon, 19 Feb 2024 11:09:23 +0000 (11:09 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Tue, 20 Feb 2024 02:38:40 +0000 (02:38 +0000)
The 'skip-unless-autoconf-defines' directive should be able to
distinguish autoconf macro values, such as '0' (not defined) from '1'
(defined) ones.  For example, --disable-ipv6 configuration option
defines USE_IPV6 as '0'. This change allows IPv6 tests activation,
addressing a TODO.

test-suite/squidconf/bad-acl-src-dupe.conf
test-suite/squidconf/bad-acl-src-dupe.conf.instructions
test-suite/test-squid-conf.sh

index 4162883e77ce5afd0748ac779e972dc60a34d864..f35c59eea8cbf01b4dad447d75c036f016351cb2 100644 (file)
@@ -18,8 +18,7 @@ acl test25 dst 127.0.0.0-127.0.0.128/32  127.0.0.128-127.1.0.255
 acl test36 dst 127.0.0.1-127.0.0.128  127.0.0.0-127.1.0.0/16
 acl test37 dst 127.1.0.0-127.2.0.0/16 127.1.0.1-127.1.0.128
 
-# TODO: make configurable depending on USE_IPV6
-# acl test41 src bad::1 bad::0-bad::f
-# acl test42 src dead::0-dead::0 dead::0
-# acl test43 src bad::0/64 bad::0/128
-# acl test44 src beef::0/16 beef:bad::/64
+acl test41 src bad::1 bad::0-bad::f
+acl test42 src dead::0-dead::0 dead::0
+acl test43 src bad::0/64 bad::0/128
+acl test44 src beef::0/16 beef:bad::/64
index 717b1eae8b036471505250916e29e2830ea1cf2f..9ab48bf9505c29d0adc671758147dee693285991 100644 (file)
@@ -1,3 +1,4 @@
+skip-unless-autoconf-defines USE_IPV6 1
 expect-messages <<END
 WARNING: Ignoring earlier 127.0.0.1 because it is covered by 127.0.0.0-127.0.0.255
     advice: Remove value 127.0.0.1 from the ACL
@@ -32,21 +33,20 @@ WARNING: Ignoring earlier 127.0.0.1-127.0.0.128 because it is covered by 127.0.0
 WARNING: Ignoring 127.1.0.1-127.1.0.128 because it is already covered by 127.1.0.0-127.2.0.0/16
     advice: Remove value 127.1.0.1-127.1.0.128 from the ACL
     acl name: test37
-END
 
-# TODO: skip-unless-autoconf-defines USE_IPV6 1
-# WARNING: Ignoring earlier bad::1 because it is covered by bad::-bad::f
-#     advice: Remove value bad::1 from the ACL
-#     acl name: test41
-#
-# WARNING: Ignoring dead:: because it is already covered by dead::-dead::
-#     advice: Remove value dead:: from the ACL
-#     acl name: test42
-#
-# WARNING: Ignoring bad:: because it is already covered by bad::/64
-#     advice: Remove value bad:: from the ACL
-#     acl name: test43
-#
-# WARNING: Ignoring beef:bad::/64 because it is already covered by beef::/16
-#     advice: Remove value beef:bad::/64 from the ACL
-#     acl name: test44
+WARNING: Ignoring earlier bad::1 because it is covered by bad::-bad::f
+    advice: Remove value bad::1 from the ACL
+    acl name: test41
+
+WARNING: Ignoring dead:: because it is already covered by dead::-dead::
+    advice: Remove value dead:: from the ACL
+    acl name: test42
+
+WARNING: Ignoring bad:: because it is already covered by bad::/64
+    advice: Remove value bad:: from the ACL
+    acl name: test43
+
+WARNING: Ignoring beef:bad::/64 because it is already covered by beef::/16
+    advice: Remove value beef:bad::/64 from the ACL
+    acl name: test44
+END
index 5dd9d139fa066a2fb35d88b750f22600db85a76c..8cdbc0e95b04759eb18a6d8744311eed3fe41a45 100755 (executable)
@@ -204,12 +204,7 @@ then
         then
             # Skip test unless the given macro is #defined in autoconf.h
             defineName=$p1
-
-            if test -n "$p2"
-            then
-                echo "$here: ERROR: Bad $instructionName instruction: Unexpected second parameter: $p2";
-                exit 1;
-            fi
+            defineValue=$p2
 
             autoconfHeader="$top_builddir/include/autoconf.h"
             if ! grep -q -w "$defineName" $autoconfHeader
@@ -229,6 +224,16 @@ then
                 echo "$here: ERROR: Cannot determine status of $defineName macro";
                 exit 1;
             fi
+
+            if test -n "$defineValue"
+            then
+                if ! grep -q "# *define *\b$defineName *$defineValue\b" $autoconfHeader
+                then
+                    echo "$here: WARNING: Skipping $configFile test because $defineName is not $defineValue in $autoconfHeader";
+                    exit 0;
+                fi
+            fi
+
         else
             echo "$here: ERROR: Unknown test-squid-conf.sh instruction name: $instructionName";
             exit 1;