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:
Marc Hoersken 2014-02-01 00:58:58 +01:00
Родитель 69745aaa45
Коммит 75f00de55c
41 изменённых файлов: 232 добавлений и 216 удалений

Просмотреть файл

@ -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,18 +8,18 @@ HTTP GET
#
# Server-side
<reply name="1">
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
@ -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,13 +2,13 @@
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
hello
</data>
</reply>

Просмотреть файл

@ -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,13 +9,13 @@ HTTP POST
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
hello
</data>
</reply>

Просмотреть файл

@ -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,18 +8,18 @@ HTTP HEAD
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
</data>
</reply>

Просмотреть файл

@ -8,12 +8,12 @@ HTTP POST
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
<data>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
OK
</data>
</reply>

Просмотреть файл

@ -9,12 +9,12 @@ HTTP POST
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
<data>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
OK
</data>
</reply>

Просмотреть файл

@ -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,34 +9,34 @@ HTTP GET
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK swsbounce
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 8
<data>
HTTP/1.1 200 OK swsbounce
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 8
content
</data>
<data1>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 9
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 9
content2
</data1>
<datacheck>
HTTP/1.1 200 OK swsbounce
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 8
HTTP/1.1 200 OK swsbounce
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 8
content
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 9
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 9
content2
</datacheck>
</reply>

Просмотреть файл

@ -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,23 +8,23 @@ multi
</info>
<reply>
<data mode="text">
HTTP/1.1 404 Badness
Date: Thu, 09 Nov 2010 14:49:00 GMT
ETag: "21025-dc7-39462498"
Content-Length: 6
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 404 Badness
Date: Thu, 09 Nov 2010 14:49:00 GMT
ETag: "21025-dc7-39462498"
Content-Length: 6
Content-Type: text/html
Funny-head: yesyes
hejsan
</data>
<data1>
HTTP/1.1 200 Fine
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 13
Connection: close
Content-Type: text/html
HTTP/1.1 200 Fine
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 13
Connection: close
Content-Type: text/html
fine content
</data1>

Просмотреть файл

@ -9,23 +9,23 @@ multi
</info>
<reply>
<data mode="text">
HTTP/1.1 404 Badness
Date: Thu, 09 Nov 2010 14:49:00 GMT
ETag: "21025-dc7-39462498"
Content-Length: 6
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 404 Badness
Date: Thu, 09 Nov 2010 14:49:00 GMT
ETag: "21025-dc7-39462498"
Content-Length: 6
Content-Type: text/html
Funny-head: yesyes
hejsan
</data>
<data1>
HTTP/1.1 200 Fine
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 13
Connection: close
Content-Type: text/html
HTTP/1.1 200 Fine
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 13
Connection: close
Content-Type: text/html
fine content
</data1>

Просмотреть файл

@ -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,12 +9,12 @@ HTTP POST
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
<data>
HTTP/1.1 200 OK swsclose
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Content-Length: 3
OK
</data>
</reply>

Двоичные данные
tests/data/test545

Двоичный файл не отображается.

Просмотреть файл

@ -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,13 +9,13 @@ HTTP POST
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake swsclose
Connection: close
Content-Type: text/html
hello
</data>
</reply>

Просмотреть файл

@ -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,18 +8,18 @@ HTTP GET
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 0
Connection: close
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 0
Connection: close
Content-Type: text/html
Funny-head: yesyes
</data>
</reply>
@ -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,18 +8,18 @@ HTTP POST
#
# Server-side
<reply name="1">
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Server: test-server/fake
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
ETag: "21025-dc7-39462498"
Accept-Ranges: bytes
Content-Length: 6
Connection: close
Content-Type: text/html
Funny-head: yesyes
-foo-
</data>
</reply>
@ -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

Просмотреть файл

@ -11,31 +11,31 @@ multi
# Silly division of the first request is solely to appease the server which expects n_data_items == n_requests
<reply>
<data1>
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
584
</data1>
<data2>
HTTP/1.1 200 OK
HTTP/1.1 200 OK
</data2>
<data3>
Server: test-server/fake
Server: test-server/fake
</data3>
<data4>
Content-Length: 0
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 5
Content-Length: 0
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 5
585
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
586
</data4>
</reply>
@ -76,26 +76,26 @@ Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<stdout mode="text">
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
<stdout>
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
584
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 0
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 5
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 0
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 5
585
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
HTTP/1.1 200 OK
Server: test-server/fake
Content-Length: 4
586
</stdout>
</verify>

Просмотреть файл

@ -12,31 +12,31 @@ curl_easy_reset
#
# Server-side
<reply>
<data mode="text">
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
<data>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
-foo-
</data>
# since the request runs twice
<datacheck>
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
-foo-
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
HTTP/1.1 200 OK
Date: Thu, 09 Nov 2010 14:49:00 GMT
Content-Length: 6
Connection: close
Content-Type: text/html
-foo-
</datacheck>

Просмотреть файл

@ -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();
/*