Skip to content

Commit 904e7ec

Browse files
committed
tests: replace remaining CR bytes with the new macro %CR
There is no more mixed-newline file in the repository after this patch. Except for`.bat` and `.sln` files (4 in total), all files use LF newlines. Also: - `spacecheck.pl`: drop mixed-EOL exception for test data. - runtests: add option `-w` to check if test data has stray CR bytes in them. - build: enable the option above in test targets, except the CI-specific one where `spacecheck.pl` does this job already. - tested OK (with expected failures) in CI with stray CRs added. - cmake: enable option `-a` for the `tests` target. To continue testing after a failed test. Follow-up to 63e9721 curl#19313 Follow-up to 6cf3d7b curl#19318 Follow-up to 4d2a05d curl#19284 Closes curl#19347
1 parent 672886f commit 904e7ec

123 files changed

Lines changed: 2045 additions & 2009 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/scripts/spacecheck.pl

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
"^tests/data/test",
3535
);
3636

37-
my @mixed_eol = (
38-
"^tests/data/test",
39-
);
40-
4137
my @need_crlf = (
4238
"\\.(bat|sln)\$",
4339
);
@@ -109,8 +105,7 @@ sub eol_detect {
109105

110106
my $eol = eol_detect($content);
111107

112-
if($eol eq "" &&
113-
!fn_match($filename, @mixed_eol)) {
108+
if($eol eq "") {
114109
push @err, "content: has mixed EOL types";
115110
}
116111

@@ -120,8 +115,7 @@ sub eol_detect {
120115
}
121116

122117
if($eol ne "lf" && $content ne "" &&
123-
!fn_match($filename, @need_crlf) &&
124-
!fn_match($filename, @mixed_eol)) {
118+
!fn_match($filename, @need_crlf)) {
125119
push @err, "content: must use LF EOL for this file type";
126120
}
127121

docs/runtests.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ Enable verbose output. Speaks more than by default. If used in conjunction
289289
with parallel testing, it is difficult to associate the logs with the specific
290290
test being run.
291291

292+
## `-w`
293+
294+
Verify test data.
295+
292296
## `-vc \<curl\>`
293297

294298
Provide a path to a custom curl binary to run when verifying that the servers

docs/tests/FILEFORMAT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ For example, to insert the word hello 100 times:
7878

7979
## Whitespace
8080

81+
To force CRLF newline, add this macro to the end of the line:
82+
83+
%CR - carriage return
84+
8185
To add significant whitespace characters at the end of the line, or to empty
8286
lines:
8387

tests/CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ configure_file(
120120
"${CMAKE_CURRENT_SOURCE_DIR}/configurehelp.pm.in"
121121
"${CMAKE_CURRENT_BINARY_DIR}/configurehelp.pm" @ONLY)
122122

123-
curl_add_runtests(tests "") # Avoid 'test', which is a reserved target name in CMake
124-
curl_add_runtests(test-quiet "-a -s")
125-
curl_add_runtests(test-am "-a -am")
126-
curl_add_runtests(test-full "-a -p -r")
123+
curl_add_runtests(tests "-a -w") # Avoid 'test', which is a reserved target name in CMake
124+
curl_add_runtests(test-quiet "-a -w -s")
125+
curl_add_runtests(test-am "-a -w -am")
126+
curl_add_runtests(test-full "-a -w -p -r")
127127
# ~flaky means that it ignores results of tests using the flaky keyword
128-
curl_add_runtests(test-nonflaky "-a -p ~flaky ~timing-dependent")
128+
curl_add_runtests(test-nonflaky "-a -w -p ~flaky ~timing-dependent")
129129
curl_add_runtests(test-ci "-a -p ~flaky ~timing-dependent -r --retry=5 -j20 --buildinfo")
130-
curl_add_runtests(test-torture "-a -t -j20")
131-
curl_add_runtests(test-event "-a -e")
130+
curl_add_runtests(test-torture "-a -w -t -j20")
131+
curl_add_runtests(test-event "-a -w -e")
132132

133133
curl_add_pytests(curl-pytest "-n auto")
134134
curl_add_pytests(curl-pytest-ci "-n auto -v")

tests/Makefile.am

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ TEST_COMMON += !documentation
118118
endif
119119

120120
TEST = srcdir=$(srcdir) @PERL@ $(PERLFLAGS) $(srcdir)/runtests.pl $(TEST_COMMON)
121-
TEST_Q = -a -s
122-
TEST_AM = -a -am
123-
TEST_F = -a -p -r
124-
TEST_T = -a -t -j20
125-
TEST_E = -a -e
121+
TEST_Q = -a -w -s
122+
TEST_AM = -a -w -am
123+
TEST_F = -a -w -p -r
124+
TEST_T = -a -w -t -j20
125+
TEST_E = -a -w -e
126126

127127
# ~<keyword> means that it will run all tests matching the keyword, but will
128128
# ignore their results (since these ones are likely to fail for no good reason)
129-
TEST_NF = -a -p ~flaky ~timing-dependent
129+
TEST_NF = -a -w -p ~flaky ~timing-dependent
130130

131-
# special CI target derived from nonflaky with CI-specific flags
132-
TEST_CI = $(TEST_NF) -r --retry=5 -j20 --buildinfo
131+
# special target for CI use
132+
TEST_CI = -a -p ~flaky ~timing-dependent -r --retry=5 -j20 --buildinfo
133133

134134
PYTEST = pytest
135135
endif

tests/data/test1008

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ daniel
5454

5555
# then this is returned when we get proxy-auth
5656
<data1000>
57-
HTTP/1.1 200 OK swsbounce
57+
HTTP/1.1 200 OK swsbounce%CR
5858
Server: no
59-
59+
%CR
6060
Nice proxy auth sir!
6161
</data1000>
6262

6363
<datacheck>
64-
HTTP/1.1 407 Authorization Required to proxy me my dear
65-
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==
66-
Transfer-Encoding: chunked
67-
68-
HTTP/1.1 200 Things are fine in proxy land
69-
Server: Microsoft-IIS/5.0
70-
Content-Type: text/html; charset=iso-8859-1
71-
64+
HTTP/1.1 407 Authorization Required to proxy me my dear%CR
65+
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==%CR
66+
Transfer-Encoding: chunked%CR
67+
%CR
68+
HTTP/1.1 200 Things are fine in proxy land%CR
69+
Server: Microsoft-IIS/5.0%CR
70+
Content-Type: text/html; charset=iso-8859-1%CR
71+
%CR
7272
HTTP/1.1 200 OK
7373
Date: Tue, 09 Nov 2010 14:49:00 GMT
7474
Content-Length: 7

tests/data/test1021

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,26 @@ daniel
5454

5555
# then this is returned when we get proxy-auth
5656
<data1000>
57-
HTTP/1.1 200 OK swsbounce
57+
HTTP/1.1 200 OK swsbounce%CR
5858
Server: no
59-
59+
%CR
6060
Nice proxy auth sir!
6161
</data1000>
6262

6363
<datacheck>
64-
HTTP/1.1 407 Authorization Required to proxy me my dear swsclose
65-
Proxy-Authenticate: NTLM
66-
Content-Length: 16
67-
Connection: close
68-
69-
HTTP/1.1 407 Authorization Required to proxy me my dear
70-
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==
71-
Content-Length: 28
72-
73-
HTTP/1.1 200 Things are fine in proxy land
74-
Server: Microsoft-IIS/5.0
75-
Content-Type: text/html; charset=iso-8859-1
76-
64+
HTTP/1.1 407 Authorization Required to proxy me my dear swsclose%CR
65+
Proxy-Authenticate: NTLM%CR
66+
Content-Length: 16%CR
67+
Connection: close%CR
68+
%CR
69+
HTTP/1.1 407 Authorization Required to proxy me my dear%CR
70+
Proxy-Authenticate: NTLM TlRMTVNTUAACAAAAAgACADAAAACGggEAc51AYVDgyNcAAAAAAAAAAG4AbgAyAAAAQ0MCAAQAQwBDAAEAEgBFAEwASQBTAEEAQgBFAFQASAAEABgAYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAwAsAGUAbABpAHMAYQBiAGUAdABoAC4AYwBjAC4AaQBjAGUAZABlAHYALgBuAHUAAAAAAA==%CR
71+
Content-Length: 28%CR
72+
%CR
73+
HTTP/1.1 200 Things are fine in proxy land%CR
74+
Server: Microsoft-IIS/5.0%CR
75+
Content-Type: text/html; charset=iso-8859-1%CR
76+
%CR
7777
HTTP/1.1 200 OK
7878
Date: Tue, 09 Nov 2010 14:49:00 GMT
7979
Content-Length: 7

tests/data/test1040

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ Content-Length: 0
3030
012345678
3131
012345678
3232
012345678
33-
HTTP/1.1 416 Invalid range
34-
Connection: close
35-
Content-Length: 0
36-
33+
HTTP/1.1 416 Invalid range%CR
34+
Connection: close%CR
35+
Content-Length: 0%CR
36+
%CR
3737
</datacheck>
3838

3939
</reply>

tests/data/test1042

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ Content-Type: text/plain
4242
012345678
4343
012345678
4444
012345678
45-
HTTP/1.1 200 OK
46-
Connection: close
47-
Content-Length: 100
48-
Content-Type: text/plain
49-
45+
HTTP/1.1 200 OK%CR
46+
Connection: close%CR
47+
Content-Length: 100%CR
48+
Content-Type: text/plain%CR
49+
%CR
5050
</datacheck>
5151
</reply>
5252

tests/data/test1043

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ Content-Range: bytes 40-99/100
3232
012345678
3333
012345678
3434
012345678
35-
HTTP/1.1 206 Partial Content
36-
Date: Mon, 13 Nov 2007 13:41:09 GMT
37-
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
38-
Accept-Ranges: bytes
39-
Content-Length: 60
40-
Content-Range: bytes 40-99/100
41-
35+
HTTP/1.1 206 Partial Content%CR
36+
Date: Mon, 13 Nov 2007 13:41:09 GMT%CR
37+
Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT%CR
38+
Accept-Ranges: bytes%CR
39+
Content-Length: 60%CR
40+
Content-Range: bytes 40-99/100%CR
41+
%CR
4242
012345678
4343
012345678
4444
012345678

0 commit comments

Comments
 (0)