tests/server: do not fall back to original data file in test2fopen()

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 aaf9522a2c #19329

Closes #19429
This commit is contained in:
Viktor Szakats 2025-11-09 19:37:28 +01:00
parent 28ff2b260e
commit c6f1b0ff49
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
3 changed files with 3 additions and 9 deletions

View file

@ -34,7 +34,7 @@ lib%TESTNUMBER
wakeup from another thread
</name>
<command>
http://%HOSTIP:%HTTPPORT/1
http://%HOSTIP:%HTTPPORT/%TESTNUMBER
</command>
</client>

View 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: */*

View 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;
}