mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
testsuite: use binary output mode for custom curl test tools
Do not try to convert line-endings to CRLF on Windows by setting stdout to binary mode, just like the curl tool does if --ascii is not specified. This should prevent corrupted stdout line-ending output like CRCRLF. In order to make the previously naive text-aware tests work with binary mode on Windows, text-mode is disabled for them if it is not actually part of the test case and line-endings are corrected.
This commit is contained in:
parent
69745aaa45
commit
75f00de55c
@ -24,7 +24,7 @@ http://%HOSTIP:%HTTPPORT/path/1508
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/stdout1508" mode="text">
|
||||
<file name="log/stdout1508">
|
||||
We are done
|
||||
</file>
|
||||
</verify>
|
||||
|
@ -9,7 +9,7 @@ multi
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
Adding handle 0
|
||||
Handle 0 Completed with status 0
|
||||
Adding handle 1
|
||||
|
@ -9,7 +9,7 @@ multi
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
Adding handle 0
|
||||
Handle 0 Completed with status 0
|
||||
Adding handle 1
|
||||
|
@ -9,7 +9,7 @@ multi
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
Adding handle 0
|
||||
Handle 0 Completed with status 0
|
||||
Adding handle 1
|
||||
|
@ -9,7 +9,7 @@ multi
|
||||
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
Adding handle 0
|
||||
Handle 0 Completed with status 0
|
||||
Adding handle 1
|
||||
|
@ -8,7 +8,7 @@ HTTP GET
|
||||
#
|
||||
# Server-side
|
||||
<reply name="1">
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
@ -45,7 +45,7 @@ http://%HOSTIP:%HTTPPORT/500 log/ip500
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/ip500" mode="text">
|
||||
<file name="log/ip500">
|
||||
IP: %HOSTIP
|
||||
</file>
|
||||
<protocol>
|
||||
|
@ -7,7 +7,7 @@ FILE
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
foo
|
||||
bar swsclose
|
||||
bar
|
||||
|
@ -72,7 +72,7 @@ http://%HOSTIP:%HTTPPORT/506
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
GLOBAL_INIT
|
||||
SHARE_INIT
|
||||
CURLSHOPT_LOCKFUNC
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
|
@ -28,7 +28,7 @@ nothing
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
seen custom_calloc()
|
||||
seen custom_malloc()
|
||||
seen custom_realloc()
|
||||
|
@ -9,7 +9,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
|
@ -9,7 +9,7 @@ HTTP GET
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsclose
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: yes
|
||||
|
@ -8,7 +8,7 @@ HTTP HEAD
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
|
@ -8,7 +8,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsclose
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
|
@ -9,7 +9,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsclose
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
|
@ -25,7 +25,7 @@ nothing
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
0: Sun, 06 Nov 1994 08:49:37 GMT => 784111777
|
||||
1: Sunday, 06-Nov-94 08:49:37 GMT => 784111777
|
||||
2: Sun Nov 6 08:49:37 1994 => 784111777
|
||||
|
@ -9,7 +9,7 @@ HTTP GET
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsbounce
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
|
@ -53,7 +53,7 @@ Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
hello
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -57,7 +57,7 @@ Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
hello
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -8,7 +8,7 @@ multi
|
||||
</info>
|
||||
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 404 Badness
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
|
@ -9,7 +9,7 @@ multi
|
||||
</info>
|
||||
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 404 Badness
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
|
@ -8,7 +8,7 @@ FTP
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
file contents
|
||||
</data>
|
||||
|
||||
|
@ -28,7 +28,7 @@ curl_easy_escape
|
||||
# There's no MTDM in the protocol here since this code doesn't ask for the
|
||||
# time/date of the file
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
%9C%26K%3DI%04%A1%01%E0%D8%7C%20%B7%EFS%29%FA%1DW%E1
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -9,7 +9,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK swsclose
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
|
Binary file not shown.
@ -58,7 +58,7 @@ Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
hello
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -58,7 +58,7 @@ Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
hello
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -9,7 +9,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
|
@ -25,7 +25,7 @@ nothing
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
All curl_mprintf() unsigned short tests OK!
|
||||
All curl_mprintf() signed short tests OK!
|
||||
All curl_mprintf() unsigned int tests OK!
|
||||
|
@ -34,7 +34,7 @@ nothing
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/memdump" mode="text">
|
||||
<file name="log/memdump">
|
||||
MEM lib558.c: malloc()
|
||||
MEM lib558.c: free()
|
||||
MEM escape.c: malloc()
|
||||
|
@ -59,7 +59,7 @@ Accept: */*
|
||||
Proxy-Connection: Keep-Alive
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
hello
|
||||
</stdout>
|
||||
</verify>
|
||||
|
@ -8,7 +8,7 @@ HTTP GET
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
@ -44,7 +44,7 @@ http://%HOSTIP:%HTTPPORT/566 log/ip566
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/ip566" mode="text">
|
||||
<file name="log/ip566">
|
||||
CL: 0
|
||||
</file>
|
||||
<protocol>
|
||||
|
@ -83,7 +83,7 @@ rtsp://%HOSTIP:%RTSPPORT/571 log/protofile.txt
|
||||
</client>
|
||||
|
||||
<verify>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
RTP: message size 10, channel 1
|
||||
RTP: message size 500, channel 0
|
||||
RTP: message size 196, channel 0
|
||||
|
@ -82,7 +82,7 @@ EPSV
|
||||
RETR someothertext.txt
|
||||
QUIT
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
This file should have permissions 444
|
||||
This file should have permissions 666
|
||||
This file should have permissions 777
|
||||
|
@ -100,7 +100,7 @@ EPSV
|
||||
RETR someothertext.txt
|
||||
QUIT
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
This file should have permissions 444
|
||||
This file should have permissions 666
|
||||
This file should have permissions 777
|
||||
|
@ -34,7 +34,7 @@ ftp://%HOSTIP:%FTPPORT/fully_simulated/UNIX/*
|
||||
<errorcode>
|
||||
0
|
||||
</errorcode>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
=============================================================
|
||||
Remains: 14
|
||||
Filename: .
|
||||
|
@ -8,7 +8,7 @@ HTTP POST
|
||||
#
|
||||
# Server-side
|
||||
<reply name="1">
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake
|
||||
@ -45,7 +45,7 @@ http://%HOSTIP:%HTTPPORT/500 log/ip578
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/ip578" mode="text">
|
||||
<file name="log/ip578">
|
||||
PASSED, UL data matched data size
|
||||
</file>
|
||||
</verify>
|
||||
|
@ -72,7 +72,7 @@ http://%HOSTIP:%HTTPPORT/579 log/ip579
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<file name="log/ip579" mode="text">
|
||||
<file name="log/ip579">
|
||||
Progress callback called with UL 0 out of 0
|
||||
Progress callback called with UL 0 out of -1
|
||||
Progress callback called with UL 8 out of -1
|
||||
|
@ -76,7 +76,7 @@ Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
<stdout mode="text">
|
||||
<stdout>
|
||||
HTTP/1.1 200 OK
|
||||
Server: test-server/fake
|
||||
Content-Length: 4
|
||||
|
@ -12,7 +12,7 @@ curl_easy_reset
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data mode="text">
|
||||
<data>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Content-Length: 6
|
||||
|
@ -22,7 +22,15 @@
|
||||
#include "test.h"
|
||||
|
||||
#ifdef HAVE_LOCALE_H
|
||||
#include <locale.h> /* for setlocale() */
|
||||
# include <locale.h> /* for setlocale() */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h> /* for setmode() */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
# include <fcntl.h> /* for setmode() */
|
||||
#endif
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
@ -98,6 +106,14 @@ int main(int argc, char **argv)
|
||||
{
|
||||
char *URL;
|
||||
|
||||
#ifdef O_BINARY
|
||||
# ifdef __HIGHC__
|
||||
_setmode(stdout, O_BINARY);
|
||||
# else
|
||||
setmode(fileno(stdout), O_BINARY);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
memory_tracking_init();
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user