]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
test972: verify the json output with jsonlint 6906/head
authorDaniel Stenberg <daniel@haxx.se>
Fri, 16 Apr 2021 21:53:22 +0000 (23:53 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 17 Apr 2021 09:03:40 +0000 (11:03 +0200)
Make sure one of the azure jobs has jsonlint installed so that the test
runs there.

Ref: #6905

.azure-pipelines.yml
tests/data/Makefile.inc
tests/data/test972 [new file with mode: 0644]
tests/runtests.pl

index 6f0a582ac6efc81199561ac7b3bad0df521b6119..8f7288854776b40636fccf4c68c23f7b81ab5b2b 100644 (file)
@@ -57,6 +57,7 @@ stages:
       matrix:
         default:
           name: default
+          install: jsonlint
           configure: --enable-debug
         disable_ipv6:
           name: w/o IPv6
index 02ac45efdec13b99dd05a96633a36b90cbf17d91..c4a8e25bc0b4b60fa89bfe93ba33d9032bb69f5c 100644 (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 \
diff --git a/tests/data/test972 b/tests/data/test972
new file mode 100644 (file)
index 0000000..971f1fa
--- /dev/null
@@ -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\r
+Host: %HOSTIP:%HTTPPORT\r
+User-Agent: curl/%VERSION\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>
index 40315aab4187b74a6eb037256685f9aa65d811ca..c2d9289f311cbf7c7c263e26f72b9e88b97f9046 100755 (executable)
@@ -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;