]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/server: do not fall back to original data file in `test2fopen()`
authorViktor Szakats <commit@vsz.me>
Sun, 9 Nov 2025 18:37:28 +0000 (19:37 +0100)
committerViktor Szakats <commit@vsz.me>
Sun, 9 Nov 2025 20:14:41 +0000 (21:14 +0100)
Before this patch servers were loading the original data source file
(from `tests/data/test*`) if they failed to open the preprocessed data
file.

It was causing issues in many (most?) tests, because original data files
are not preprocessed, thus may be incomplete and/or come with wrong
newline characters. It's also causing difficult to diagnose issues when
a test accidentally references another test's data, which by chance
makes the test pass initially, until either that or the executed test
data gets an update, and breaking it, as seen in #19329.

Historically, the fallback existed first, then the preprocessed copy.
The fallback is no longer used by tests (except by stray accidents).

Fix it by dropping the fallback logic and relying on the preprocessed
data file saved there by the runtests framework.

Also fix two remaining test data cross-references:
- test1565: reference own server input data instead of test1's.
- test3014: reference own server input data instead of test1439's.
  Ref: #19398

Follow-up to aaf9522a2c28e5142c7f5640da4e24b65b47dc53 #19329

Closes #19429

tests/data/test1565
tests/data/test3014
tests/server/util.c

index 15374bf7e6231e7492ec1679d97f2077cdd6b191..42bbcdf6f750cc4fb51bfa1a33d17b0b1dfb0cc5 100644 (file)
@@ -34,7 +34,7 @@ lib%TESTNUMBER
 wakeup from another thread
 </name>
 <command>
-http://%HOSTIP:%HTTPPORT/1
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER
 </command>
 </client>
 
index e1e6471a4a8d87f162d711889629db281099e3c7..10ad554da3c92a9a37bc244fd4ebbcb17fea768b 100644 (file)
@@ -29,7 +29,7 @@ http
 Check if %{num_headers} returns correct number of headers
 </name>
 <command>
-http://%HOSTIP:%HTTPPORT/1439 --write-out '%{num_headers}'
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER --write-out '%{num_headers}'
 </command>
 </client>
 
@@ -46,7 +46,7 @@ testdata
 4
 </stdout>
 <protocol crlf="headers">
-GET /1439 HTTP/1.1
+GET /%TESTNUMBER HTTP/1.1
 Host: %HOSTIP:%HTTPPORT
 User-Agent: curl/%VERSION
 Accept: */*
index 5abd30873834800ac2074deb225722350ba36122..0e34f4ab21a8d31ae9bbe08b31a3c5082b127200 100644 (file)
@@ -200,12 +200,6 @@ FILE *test2fopen(long testno, const char *logdir2)
   /* first try the alternative, preprocessed, file */
   snprintf(filename, sizeof(filename), "%s/test%ld", logdir2, testno);
   stream = fopen(filename, "rb");
-  if(stream)
-    return stream;
-
-  /* then try the source version */
-  snprintf(filename, sizeof(filename), "%s/data/test%ld", srcpath, testno);
-  stream = fopen(filename, "rb");
 
   return stream;
 }