diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-04-17 09:58:42 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-04-18 22:46:04 +0200 |
commit | d009bc2e565844db030d7098624b39b2903a808d (patch) | |
tree | 1ccef4e0c1a22960befd8bd413d6fc34e264e806 /tests/server/fake_ntlm.c | |
parent | 5e2f4a33fe663c2ae8cc92c02193a7261c524867 (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/fake_ntlm.c')
-rw-r--r-- | tests/server/fake_ntlm.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tests/server/fake_ntlm.c b/tests/server/fake_ntlm.c index c6e36b6f6..c9211f7ea 100644 --- a/tests/server/fake_ntlm.c +++ b/tests/server/fake_ntlm.c @@ -6,7 +6,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2010, Mandy Wu, <mandy.wu@intel.com> - * Copyright (C) 2011 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 2011 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -112,7 +112,6 @@ int main(int argc, char *argv[]) char buf[1024]; char logfilename[256]; FILE *stream; - char *filename; int error; char *type1_input = NULL, *type3_input = NULL; char *type1_output = NULL, *type3_output = NULL; @@ -186,12 +185,10 @@ int main(int argc, char *argv[]) path = env; } - filename = test2file(testnum); - stream = fopen(filename, "rb"); + stream = test2fopen(testnum); 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 %ld", testnum); exit(1); } @@ -205,13 +202,11 @@ int main(int argc, char *argv[]) } } - stream = fopen(filename, "rb"); + stream = test2fopen(testnum); 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 %ld", testnum); - exit(1); } else { size = 0; @@ -225,11 +220,10 @@ int main(int argc, char *argv[]) while(fgets(buf, sizeof(buf), stdin)) { if(strcmp(buf, type1_input) == 0) { - stream = fopen(filename, "rb"); + stream = test2fopen(testnum); 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 %ld", testnum); exit(1); } @@ -247,11 +241,10 @@ int main(int argc, char *argv[]) fflush(stdout); } else if(strncmp(buf, type3_input, strlen(type3_input)) == 0) { - stream = fopen(filename, "rb"); + stream = test2fopen(testnum); 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 %ld", testnum); exit(1); } |