summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-04-16 23:53:22 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-04-17 11:03:40 +0200
commit6fc805d0c1f82363836f1c6199cebdd3c41cbc5b (patch)
tree78252ae0c34285c55d30bbc4684a55b929dc470b
parent2f78be51ebe8578bce5469924cedf7ac8bc06a85 (diff)
downloadcurl-bagder/test-json.tar.gz
test972: verify the json output with jsonlintbagder/test-json
Make sure one of the azure jobs has jsonlint installed so that the test runs there. Ref: #6905
-rw-r--r--.azure-pipelines.yml1
-rw-r--r--tests/data/Makefile.inc1
-rw-r--r--tests/data/test97265
-rwxr-xr-xtests/runtests.pl2
4 files changed, 68 insertions, 1 deletions
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 6f0a582ac..8f7288854 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -57,6 +57,7 @@ stages:
matrix:
default:
name: default
+ install: jsonlint
configure: --enable-debug
disable_ipv6:
name: w/o IPv6
diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc
index 02ac45efd..c4a8e25bc 100644
--- a/tests/data/Makefile.inc
+++ b/tests/data/Makefile.inc
@@ -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 \
diff --git a/tests/data/test972 b/tests/data/test972
new file mode 100644
index 000000000..971f1faf6
--- /dev/null
+++ b/tests/data/test972
@@ -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>
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 40315aab4..c2d9289f3 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -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;