]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests: support setting/using blank content env variables
authorDaniel Stenberg <daniel@haxx.se>
Mon, 5 Feb 2024 16:04:28 +0000 (17:04 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 7 Feb 2024 12:45:59 +0000 (13:45 +0100)
- test450: remove --config from the keywords
- test2080: change return code
- test428: add --config as a keyword
- test428: disable on Windows due to CI problems

tests/FILEFORMAT.md
tests/data/test2080
tests/data/test428
tests/data/test450
tests/runner.pm

index 5a8e7832323561dfc31e6b7e4f4a923f89819047..b594fc113081408bce7b0b35c7c88cd47ddffd61 100644 (file)
@@ -522,9 +522,14 @@ Brief test case description, shown when the test runs.
 ### `<setenv>`
     variable1=contents1
     variable2=contents2
+    variable3
 
 Set the given environment variables to the specified value before the actual
-command is run. They are cleared again after the command has been run.
+command is run. They are restored back to their former values again after the
+command has been run.
+
+If the variable name has no assignment, no `=`, then that variable is just
+deleted.
 
 ### `<command [option="no-output/no-include/force-output/binary-trace"] [timeout="secs"][delay="secs"][type="perl/shell"]>`
 Command line to run.
index 7f08385b6f3e4626a0346347861893bfa2d8de14..c3792f43de0c73f74ebc8bbfe31ed70d9e6260c2 100644 (file)
Binary files a/tests/data/test2080 and b/tests/data/test2080 differ
index c06f2f9dff15b3e6a8340882f897fd7bf23f84fc..fbb714f5c87578ac55940741c2c1d00f13248594 100644 (file)
@@ -3,6 +3,7 @@
 <keywords>
 HTTP
 variables
+--config
 </keywords>
 </info>
 
@@ -28,6 +29,14 @@ Funny-head: yesyes
 #
 # Client-side
 <client>
+
+# For unknown reasons, a number of CI jobs on Appveyor keep returning NULL to
+# getenv() for the blank environment variable which makes the test fail.
+# Unfortunately, this makes me disable the test completely on Windows.
+
+<features>
+!win32
+</features>
 <server>
 http
 </server>
index a6fa641036d6d603af1bdbebda74270cb5197e2d..5dcfb85ce67c30397909dd777654afd957f637d4 100644 (file)
@@ -2,7 +2,6 @@
 <info>
 <keywords>
 HTTP
---config
 variables
 </keywords>
 </info>
index c0fb40cb3db9e688f5c2bc4b5e2acbc35b8e8000..645905e5f692e86259a68c4d4cbadf718755f4d4 100644 (file)
@@ -648,15 +648,15 @@ sub singletest_setenv {
     my @setenv = getpart("client", "setenv");
     foreach my $s (@setenv) {
         chomp $s;
-        if($s =~ /([^=]*)=(.*)/) {
+        if($s =~ /([^=]*)(.*)/) {
             my ($var, $content) = ($1, $2);
             # remember current setting, to restore it once test runs
             $oldenv{$var} = ($ENV{$var})?"$ENV{$var}":'notset';
-            # set new value
-            if(!$content) {
-                delete $ENV{$var} if($ENV{$var});
-            }
-            else {
+
+            if($content =~ /^=(.*)/) {
+                # assign it
+                $content = $1;
+
                 if($var =~ /^LD_PRELOAD/) {
                     if(exe_ext('TOOL') && (exe_ext('TOOL') eq '.exe')) {
                         logmsg "Skipping LD_PRELOAD due to lack of OS support\n" if($verbose);
@@ -670,6 +670,11 @@ sub singletest_setenv {
                 $ENV{$var} = "$content";
                 logmsg "setenv $var = $content\n" if($verbose);
             }
+            else {
+                # remove it
+                delete $ENV{$var} if($ENV{$var});
+            }
+
         }
     }
     if($proxy_address) {