mirror of
https://github.com/curl/curl.git
synced 2025-04-18 16:30:45 +08:00
parent
8a298119f1
commit
0bdb95ecbf
@ -73,6 +73,8 @@ LD_PRELOAD=%PWD/libtest/.libs/libhostname.so
|
||||
CURL_NTLM_WB_FILE=%PWD/server/fake_ntlm
|
||||
# set source directory so fake_ntlm can find the test files
|
||||
CURL_NTLM_AUTH_SRCDIR=%SRCDIR
|
||||
# set source directory so fake_ntlm can find the test and log files
|
||||
CURL_NTLM_LOGDIR=%LOGDIR
|
||||
# set the test number
|
||||
CURL_NTLM_AUTH_TESTNUM=%TESTNUMBER
|
||||
</setenv>
|
||||
|
@ -39,7 +39,8 @@
|
||||
/* include memdebug.h last */
|
||||
#include "memdebug.h"
|
||||
|
||||
#define LOGFILE "log/fake_ntlm%ld.log"
|
||||
#define LOGFILE "%s/fake_ntlm%ld.log"
|
||||
const char *logdir = "log";
|
||||
|
||||
const char *serverlogfile;
|
||||
|
||||
@ -159,6 +160,11 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
env = getenv("CURL_NTLM_LOGDIR");
|
||||
if(env) {
|
||||
logdir = env;
|
||||
}
|
||||
|
||||
env = getenv("CURL_NTLM_AUTH_TESTNUM");
|
||||
if(env) {
|
||||
char *endptr;
|
||||
@ -175,7 +181,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
/* logmsg cannot be used until this file name is set */
|
||||
msnprintf(logfilename, sizeof(logfilename), LOGFILE, testnum);
|
||||
msnprintf(logfilename, sizeof(logfilename), LOGFILE, logdir, testnum);
|
||||
serverlogfile = logfilename;
|
||||
|
||||
logmsg("fake_ntlm (user: %s) (proto: %s) (domain: %s) (cached creds: %s)",
|
||||
@ -187,7 +193,7 @@ int main(int argc, char *argv[])
|
||||
path = env;
|
||||
}
|
||||
|
||||
stream = test2fopen(testnum);
|
||||
stream = test2fopen(testnum, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
@ -204,7 +210,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
stream = test2fopen(testnum);
|
||||
stream = test2fopen(testnum, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
@ -222,7 +228,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
while(fgets(buf, sizeof(buf), stdin)) {
|
||||
if(strcmp(buf, type1_input) == 0) {
|
||||
stream = test2fopen(testnum);
|
||||
stream = test2fopen(testnum, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
@ -243,7 +249,7 @@ int main(int argc, char *argv[])
|
||||
fflush(stdout);
|
||||
}
|
||||
else if(strncmp(buf, type3_input, strlen(type3_input)) == 0) {
|
||||
stream = test2fopen(testnum);
|
||||
stream = test2fopen(testnum, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
|
@ -646,7 +646,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
|
||||
/* there's a QoS byte (two bits) after the topic */
|
||||
|
||||
logmsg("SUBSCRIBE to '%s' [%d]", topic, packet_id);
|
||||
stream = test2fopen(testno);
|
||||
stream = test2fopen(testno, logdir);
|
||||
error = getpart(&data, &datalen, "reply", "data", stream);
|
||||
if(!error) {
|
||||
if(!config.publish_before_suback) {
|
||||
|
@ -290,7 +290,7 @@ static int ProcessRequest(struct httprequest *req)
|
||||
req->testno, req->partno);
|
||||
logmsg("%s", logbuf);
|
||||
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
|
||||
if(!stream) {
|
||||
int error = errno;
|
||||
@ -858,7 +858,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
||||
count = strlen(buffer);
|
||||
}
|
||||
else {
|
||||
FILE *stream = test2fopen(req->testno);
|
||||
FILE *stream = test2fopen(req->testno, logdir);
|
||||
char partbuf[80]="data";
|
||||
if(0 != req->partno)
|
||||
msnprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
|
||||
@ -884,7 +884,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
||||
}
|
||||
|
||||
/* re-open the same file again */
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
|
@ -264,7 +264,7 @@ static int parse_servercmd(struct httprequest *req)
|
||||
FILE *stream;
|
||||
int error;
|
||||
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
req->close = FALSE;
|
||||
req->connmon = FALSE;
|
||||
|
||||
@ -1092,7 +1092,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
||||
|
||||
logmsg("Send response test%ld section <%s>", req->testno, partbuf);
|
||||
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
@ -1114,7 +1114,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
|
||||
}
|
||||
|
||||
/* re-open the same file again */
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
|
@ -1019,7 +1019,7 @@ static int parse_servercmd(struct testcase *req)
|
||||
FILE *stream;
|
||||
int error;
|
||||
|
||||
stream = test2fopen(req->testno);
|
||||
stream = test2fopen(req->testno, logdir);
|
||||
if(!stream) {
|
||||
error = errno;
|
||||
logmsg("fopen() failed with error: %d %s", error, strerror(error));
|
||||
@ -1130,7 +1130,7 @@ static int validate_access(struct testcase *test,
|
||||
|
||||
(void)parse_servercmd(test);
|
||||
|
||||
stream = test2fopen(testno);
|
||||
stream = test2fopen(testno, logdir);
|
||||
|
||||
if(0 != partno)
|
||||
msnprintf(partbuf, sizeof(partbuf), "data%ld", partno);
|
||||
|
@ -202,12 +202,12 @@ void win32_cleanup(void)
|
||||
/* set by the main code to point to where the test dir is */
|
||||
const char *path = ".";
|
||||
|
||||
FILE *test2fopen(long testno)
|
||||
FILE *test2fopen(long testno, const char *logdir)
|
||||
{
|
||||
FILE *stream;
|
||||
char filename[256];
|
||||
/* first try the alternative, preprocessed, file */
|
||||
msnprintf(filename, sizeof(filename), ALTTEST_DATA_PATH, ".", testno);
|
||||
msnprintf(filename, sizeof(filename), ALTTEST_DATA_PATH, logdir, testno);
|
||||
stream = fopen(filename, "rb");
|
||||
if(stream)
|
||||
return stream;
|
||||
|
@ -30,7 +30,7 @@ void logmsg(const char *msg, ...);
|
||||
long timediff(struct timeval newer, struct timeval older);
|
||||
|
||||
#define TEST_DATA_PATH "%s/data/test%ld"
|
||||
#define ALTTEST_DATA_PATH "%s/log/test%ld"
|
||||
#define ALTTEST_DATA_PATH "%s/test%ld"
|
||||
|
||||
#define SERVERLOGS_LOCK "serverlogs.lock"
|
||||
|
||||
@ -57,7 +57,7 @@ void win32_cleanup(void);
|
||||
#endif /* WIN32 */
|
||||
|
||||
/* fopens the test case file */
|
||||
FILE *test2fopen(long testno);
|
||||
FILE *test2fopen(long testno, const char *logdir);
|
||||
|
||||
int wait_ms(int timeout_ms);
|
||||
curl_off_t our_getpid(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user