1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

test972: verify the json output with jsonlint

Make sure one of the azure jobs has jsonlint installed so that the test
runs there.

Ref: #6905
This commit is contained in:
Daniel Stenberg 2021-04-16 23:53:22 +02:00
parent 2f78be51eb
commit 6fc805d0c1
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 68 additions and 1 deletions

View File

@ -57,6 +57,7 @@ stages:
matrix:
default:
name: default
install: jsonlint
configure: --enable-debug
disable_ipv6:
name: w/o IPv6

View File

@ -116,6 +116,7 @@ test936 test937 test938 test939 test940 test941 test942 test943 test944 \
test945 test946 test947 test948 test949 test950 test951 test952 test953 \
test954 test955 test956 test957 test958 test959 test960 test961 test962 \
test963 test964 test965 test966 test967 test968 test969 test970 test971 \
test972 \
\
test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \
test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \

65
tests/data/test972 Normal file
View File

@ -0,0 +1,65 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Tue, 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: 445
Connection: close
Content-Type: text/html
Funny-head: yesyes
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum
</data>
</reply>
#
# Client-side
<client>
<precheck>
/usr/bin/which jsonlint-php >log/%TESTNUMBER-check
</precheck>
<server>
http
</server>
<features>
debug
proxy
</features>
<setenv>
CURL_TIME=13
CURL_DEBUG_SIZE=4019
CURL_VERSION=curl-unit-test-fake-version
</setenv>
<name>
Verify JSON output
</name>
<command option="no-include">
http://%HOSTIP:%HTTPPORT/%TESTNUMBER -s --write-out '%{json}' -o log/out972 | jsonlint-php -q
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<protocol>
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
User-Agent: curl/%VERSION
Accept: */*
</protocol>
</verify>
</testcase>

View File

@ -3781,7 +3781,7 @@ sub singletest {
$cmd = join(" ", @p);
}
my @o = `$cmd 2>/dev/null`;
my @o = `$cmd 2>log/precheck-$testnum`;
if($o[0]) {
$why = $o[0];
chomp $why;