From c6f1b0ff49268817101ac1734f43074fcc8775b2 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 9 Nov 2025 19:37:28 +0100 Subject: [PATCH] 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 aaf9522a2c28e5142c7f5640da4e24b65b47dc53 #19329 Closes #19429 --- tests/data/test1565 | 2 +- tests/data/test3014 | 4 ++-- tests/server/util.c | 6 ------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/data/test1565 b/tests/data/test1565 index 15374bf7e6..42bbcdf6f7 100644 --- a/tests/data/test1565 +++ b/tests/data/test1565 @@ -34,7 +34,7 @@ lib%TESTNUMBER wakeup from another thread -http://%HOSTIP:%HTTPPORT/1 +http://%HOSTIP:%HTTPPORT/%TESTNUMBER diff --git a/tests/data/test3014 b/tests/data/test3014 index e1e6471a4a..10ad554da3 100644 --- a/tests/data/test3014 +++ b/tests/data/test3014 @@ -29,7 +29,7 @@ http Check if %{num_headers} returns correct number of headers -http://%HOSTIP:%HTTPPORT/1439 --write-out '%{num_headers}' +http://%HOSTIP:%HTTPPORT/%TESTNUMBER --write-out '%{num_headers}' @@ -46,7 +46,7 @@ testdata 4 -GET /1439 HTTP/1.1 +GET /%TESTNUMBER HTTP/1.1 Host: %HOSTIP:%HTTPPORT User-Agent: curl/%VERSION Accept: */* diff --git a/tests/server/util.c b/tests/server/util.c index 5abd308738..0e34f4ab21 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -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; } -- 2.47.3