aboutsummaryrefslogtreecommitdiff
path: root/tests/server/rtspd.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-17 09:58:42 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-18 22:46:04 +0200
commitd009bc2e565844db030d7098624b39b2903a808d (patch)
tree1ccef4e0c1a22960befd8bd413d6fc34e264e806 /tests/server/rtspd.c
parent5e2f4a33fe663c2ae8cc92c02193a7261c524867 (diff)
tests: introduce preprocessed test cases
The runtests script now always performs variable replacement on the entire test source file before the test gets executed, and saves the updated version in a temporary file (log/test[num]) so that all test case readers/servers can use that version (if present) and thus enjoy the powers of test case variable substitution. This is necessary to allow complete port number freedom. Test 309 is updated to work with a non-fixed port number thanks to this.
Diffstat (limited to 'tests/server/rtspd.c')
-rw-r--r--tests/server/rtspd.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index c784fc8ca..2d95d8359 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -247,8 +247,6 @@ static int ProcessRequest(struct httprequest *req)
/* get the number after it */
if(ptr) {
FILE *stream;
- char *filename;
-
if((strlen(doc) + strlen(request)) < 200)
msnprintf(logbuf, sizeof(logbuf), "Got request: %s %s %s/%d.%d",
request, doc, prot_str, prot_major, prot_minor);
@@ -288,13 +286,11 @@ static int ProcessRequest(struct httprequest *req)
req->testno, req->partno);
logmsg("%s", logbuf);
- filename = test2file(req->testno);
+ stream = test2fopen(req->testno);
- stream = fopen(filename, "rb");
if(!stream) {
int error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
- logmsg("Error opening file: %s", filename);
logmsg("Couldn't open test file %ld", req->testno);
req->open = FALSE; /* closes connection */
return 1; /* done */
@@ -849,17 +845,13 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
count = strlen(buffer);
}
else {
- char *filename = test2file(req->testno);
+ FILE *stream = test2fopen(req->testno);
char partbuf[80]="data";
- FILE *stream;
if(0 != req->partno)
msnprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
-
- stream = fopen(filename, "rb");
if(!stream) {
error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
- logmsg("Error opening file: %s", filename);
logmsg("Couldn't open test file");
return 0;
}
@@ -879,11 +871,10 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
}
/* re-open the same file again */
- stream = fopen(filename, "rb");
+ stream = test2fopen(req->testno);
if(!stream) {
error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
- logmsg("Error opening file: %s", filename);
logmsg("Couldn't open test file");
free(ptr);
return 0;