tests: add six Metalink test cases

This commit is contained in:
Yang Tse 2012-06-21 18:30:23 +02:00
parent 53423673ca
commit b193ba8a02
8 changed files with 619 additions and 1 deletions

View File

@ -5,3 +5,4 @@
594
1209
1211
2010

View File

@ -92,7 +92,8 @@ test1371 test1372 test1373 test1374 test1375 test1376 test1377 test1378 \
test1379 test1380 test1381 test1382 test1383 test1384 test1385 test1386 \
test1387 test1388 test1389 test1390 test1391 test1392 test1393 \
test1400 test1401 test1402 test1403 test1404 test1405 test1406 test1407 \
test2000 test2001 test2002 test2003 test2004 test2005
test2000 test2001 test2002 test2003 test2004 test2005 test2006 test2007 \
test2008 test2009 test2010 test2011
EXTRA_DIST = $(TESTCASES) DISABLED

109
tests/data/test2006 Normal file
View File

@ -0,0 +1,109 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 14:49:01 GMT
Server: test-server/fake
Content-Length: 42
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2006; charset=funny; option=strange
Funny-head: yesyes
Some data delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
# This relies on the debug feature to allow us to set directory to store the
# -O output in, using the CURL_TESTDIR variable. This test might use it upon
# failure only, successful execution won't actually use it.
<features>
debug
file
Metalink
</features>
<server>
http
</server>
<name>
Metalink local XML file, HTTP resource, using -O -D file
</name>
<setenv>
CURL_TESTDIR=%PWD/log
</setenv>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2006.metalink -O -D log/heads2006
</command>
# local metalink file written before test command runs
<file name="log/test2006.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2006">
<verification>
<hash type="md5">we-only-check-the-strongest-hash-provided</hash>
<hash type="sha256">319cb6be756734b7ff689628ca3265580cdae6a0e38f42d4ac612ff4fba143b0</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2006</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2006 log/name2006
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2006 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2006">
Some data delivered from an HTTP resource
</file1>
<file2 name="log/heads2006">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 14:49:01 GMT
Server: test-server/fake
Content-Length: 42
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2006; charset=funny; option=strange
Funny-head: yesyes
</file2>
<file3 name="log/stdout2006">
</file3>
<file4 name="log/stderr2006">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2006: OK
</file4>
<stripfile4>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile4>
</verify>
</testcase>

110
tests/data/test2007 Normal file
View File

@ -0,0 +1,110 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
-J
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 14:50:02 GMT
Server: test-server/fake
Content-Length: 42
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2007; charset=funny; option=strange
Funny-head: yesyes
Something delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
# This relies on the debug feature to allow us to set directory to store the
# -O and -J output in, using the CURL_TESTDIR variable. This test might use
# it upon failure only, successful execution won't actually use it.
<features>
debug
file
Metalink
</features>
<server>
http
</server>
<name>
Metalink local XML file, HTTP resource, using -O -J -D file
</name>
<setenv>
CURL_TESTDIR=%PWD/log
</setenv>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2007.metalink -J -O -D log/heads2007
</command>
# local metalink file written before test command runs
<file name="log/test2007.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2007">
<verification>
<hash type="md5">we-only-check-the-strongest-hash-provided</hash>
<hash type="sha256">52899e30f80e3490632d505653204e1fb5b02bda141048704ce9a0ed00b8a3f5</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2007</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2007 log/name2007
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2007 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2007">
Something delivered from an HTTP resource
</file1>
<file2 name="log/heads2007">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 14:50:02 GMT
Server: test-server/fake
Content-Length: 42
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2007; charset=funny; option=strange
Funny-head: yesyes
</file2>
<file3 name="log/stdout2007">
</file3>
<file4 name="log/stderr2007">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2007: OK
</file4>
<stripfile4>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile4>
</verify>
</testcase>

102
tests/data/test2008 Normal file
View File

@ -0,0 +1,102 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 15:23:48 GMT
Server: test-server/fake
Content-Length: 43
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2008; charset=funny; option=strange
Funny-head: yesyes
Some stuff delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
<features>
file
Metalink
</features>
<server>
http
</server>
<name>
Metalink local XML file, HTTP resource, using -o fname -D file
</name>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2008.metalink -o log/outfile2008 -D log/heads2008
</command>
# local metalink file written before test command runs
<file name="log/test2008.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2008">
<verification>
<hash type="md5">we-only-check-the-strongest-hash-provided</hash>
<hash type="sha256">711b1b566b536c5baae9b36f2f5c1830a7c8ff126d1afa2febc5b59f8d0aab54</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2008</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2008 log/name2008 log/outfile2008
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2008 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2008">
Some stuff delivered from an HTTP resource
</file1>
<file2 name="log/heads2008">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 15:23:48 GMT
Server: test-server/fake
Content-Length: 43
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2008; charset=funny; option=strange
Funny-head: yesyes
</file2>
<file3 name="log/stdout2008">
</file3>
<file4 name="log/stderr2008">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2008: OK
</file4>
<stripfile4>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile4>
</verify>
</testcase>

103
tests/data/test2009 Normal file
View File

@ -0,0 +1,103 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
-J
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 16:27:17 GMT
Server: test-server/fake
Content-Length: 46
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2009; charset=funny; option=strange
Funny-head: yesyes
Some contents delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
<features>
file
Metalink
</features>
<server>
http
</server>
<name>
Metalink local XML file, HTTP resource, using -o fname -J -D file
</name>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2009.metalink -J -o log/outfile2009 -D log/heads2009
</command>
# local metalink file written before test command runs
<file name="log/test2009.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2009">
<verification>
<hash type="md5">we-only-check-the-strongest-hash-provided</hash>
<hash type="sha256">e4c5b83384ba7d5f8e201d61747a14f29baacd7dfadce0fbd56661db4bba72b2</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2009</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2009 log/name2009 log/outfile2009
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2009 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2009">
Some contents delivered from an HTTP resource
</file1>
<file2 name="log/heads2009">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 16:27:17 GMT
Server: test-server/fake
Content-Length: 46
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2009; charset=funny; option=strange
Funny-head: yesyes
</file2>
<file3 name="log/stdout2009">
</file3>
<file4 name="log/stderr2009">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2009: OK
</file4>
<stripfile4>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile4>
</verify>
</testcase>

102
tests/data/test2010 Normal file
View File

@ -0,0 +1,102 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 17:37:27 GMT
Server: test-server/fake
Content-Length: 41
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2010; charset=funny; option=strange
Funny-head: yesyes
Contents delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
<features>
file
Metalink
</features>
<server>
http
</server>
<name>
Metalink local XML file, HTTP resource, using -o fname -i -D file
</name>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2010.metalink -i -o log/outfile2010 -D log/heads2010
</command>
# local metalink file written before test command runs
<file name="log/test2010.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2010">
<verification>
<hash type="md5">we-only-check-the-strongest-hash-provided</hash>
<hash type="sha256">6b6d97e5688bc46d75da9236631d8e7f2e5b0991941a95a0cc0533c05dcd07e2</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2010</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2010 log/name2010 log/outfile2010
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2010 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2010">
Contents delivered from an HTTP resource
</file1>
<file2 name="log/heads2010">
HTTP/1.1 200 OK
Date: Thu, 21 Jun 2012 17:37:27 GMT
Server: test-server/fake
Content-Length: 41
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2010; charset=funny; option=strange
Funny-head: yesyes
</file2>
<file3 name="log/stdout2010">
</file3>
<file4 name="log/stderr2010">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2010: OK
</file4>
<stripfile4>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile4>
</verify>
</testcase>

90
tests/data/test2011 Normal file
View File

@ -0,0 +1,90 @@
<testcase>
<info>
<keywords>
Metalink
HTTP
HTTP GET
</keywords>
</info>
#
# Server-side
<reply>
<data nocheck="yes">
HTTP/1.1 200 OK
Date: Wed, 20 Jun 2012 14:49:00 GMT
Server: test-server/fake
Content-Length: 37
Connection: close
Content-Type: text/html
Content-Disposition: filename=name2011; charset=funny; option=strange
Funny-head: yesyes
Data delivered from an HTTP resource
</data>
</reply>
#
# Client-side
<client>
<server>
http
</server>
<features>
file
Metalink
</features>
<name>
Metalink local XML file, HTTP resource, hash mismatch
</name>
<command option="no-output,no-include">
--metalink file://%PWD/log/test2011.metalink
</command>
# local metalink file written before test command runs
<file name="log/test2011.metalink">
<?xml version="1.0" encoding="utf-8"?>
<metalink version="3.0" xmlns="http://www.metalinker.org/">
<files>
<file name="log/download2011">
<verification>
<hash type="sha256">badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb</hash>
</verification>
<resources maxconnections="1">
<url type="http" preference="90">http://%HOSTIP:%HTTPPORT/2011</url>
</resources>
</file>
</files>
</metalink>
</file>
<postcheck>
perl %SRCDIR/libtest/notexists.pl log/2011 log/name2011
</postcheck>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /2011 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
</protocol>
<file1 name="log/download2011">
Data delivered from an HTTP resource
</file1>
<file2 name="log/stdout2011">
</file2>
<file3 name="log/stderr2011">
Metalink: Metalink XML file was parsed successfully
Metalink: Validating sha-256 checksum (This may take some time)...
Metalink: log/download2011: FAILED
</file3>
<stripfile3>
$_ = '' if ($_ !~ /^Metalink: /)
</stripfile3>
</verify>
</testcase>