]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test1165: check if `curl_config.h.cmake` lists all `DISABLED` options
authorViktor Szakats <commit@vsz.me>
Sun, 1 Sep 2024 14:55:53 +0000 (16:55 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 1 Sep 2024 16:44:02 +0000 (18:44 +0200)
Also fix issues:
- cmake: fix `CURL_DISABLE_HTTP_AUTH` option
- cmake: fix `CURL_DISABLE_SHUFFLE_DNS` option

Fixes:
```
Present in CMakeLists.txt, not propagated via curl_config.h.cmake: CURL_DISABLE_HTTP_AUTH
Present in CMakeLists.txt, not propagated via curl_config.h.cmake: CURL_DISABLE_SHUFFLE_DNS
```
Ref: https://github.com/curl/curl/actions/runs/10655027540/job/29532054141?pr=14754#step:11:2090

Closes #14754

lib/curl_config.h.cmake
tests/test1165.pl

index 984727fddb789ed4ab77187576dfc9f313c83e83..cba9984552740c3090fa55e3e93c84f554022d72 100644 (file)
@@ -89,6 +89,9 @@
 /* disables HTTP */
 #cmakedefine CURL_DISABLE_HTTP 1
 
+/* disabled all HTTP authentication methods */
+#cmakedefine CURL_DISABLE_HTTP_AUTH 1
+
 /* disables IMAP */
 #cmakedefine CURL_DISABLE_IMAP 1
 
 /* disables RTSP */
 #cmakedefine CURL_DISABLE_RTSP 1
 
+/* disabled shuffle DNS feature */
+#cmakedefine CURL_DISABLE_SHUFFLE_DNS 1
+
 /* disables SMB */
 #cmakedefine CURL_DISABLE_SMB 1
 
index 4045ef59b448cccb08429c06c4cdf69e66743bf6..d26a97f733f1734e4c49cbf13a213a6933639604 100755 (executable)
@@ -31,6 +31,8 @@ use warnings;
 my %disable;
 # the DISABLE options that can be set by CMakeLists.txt
 my %disable_cmake;
+# the DISABLE options propagated via curl_config.h.cmake
+my %disable_cmake_config_h;
 # the DISABLE options that are used in C files
 my %file;
 # the DISABLE options that are documented
@@ -64,13 +66,13 @@ sub scan_configure {
 }
 
 sub scanconf_cmake {
-    my ($f)=@_;
+    my ($hashr, $f)=@_;
     open S, "<$f";
     while(<S>) {
         if(/(CURL_DISABLE_[A-Z0-9_]+)/g) {
             my ($sym)=($1);
             if(not $sym =~ /^(CURL_DISABLE_INSTALL|CURL_DISABLE_TESTS|CURL_DISABLE_SRP)$/) {
-                $disable_cmake{$sym} = 1;
+                $hashr->{$sym} = 1;
             }
         }
     }
@@ -78,7 +80,11 @@ sub scanconf_cmake {
 }
 
 sub scan_cmake {
-    scanconf_cmake("$root/CMakeLists.txt");
+    scanconf_cmake(\%disable_cmake, "$root/CMakeLists.txt");
+}
+
+sub scan_cmake_config_h {
+    scanconf_cmake(\%disable_cmake_config_h, "$root/lib/curl_config.h.cmake");
 }
 
 sub scan_file {
@@ -127,6 +133,7 @@ sub scan_docs {
 
 scan_configure();
 scan_cmake();
+scan_cmake_config_h();
 scan_sources();
 scan_docs();
 
@@ -156,6 +163,14 @@ for my $s (sort keys %disable_cmake) {
     }
 }
 
+# Check the CMakeLists.txt symbols for use in curl_config.h.cmake
+for my $s (sort keys %disable_cmake) {
+    if(!$disable_cmake_config_h{$s}) {
+        printf "Present in CMakeLists.txt, not propagated via curl_config.h.cmake: %s\n", $s;
+        $error++;
+    }
+}
+
 # Check the code symbols for use in configure
 for my $s (sort keys %file) {
     if(!$disable{$s}) {