ftp tests: provide LIST responses in the test file itself

Previously LIST always returned a fixed hardcoded list that the ftp
server code knew about, mostly since the server didn't get any test case
number in the LIST scenario. Starting now, doing a CWD to a directory
named test-[number] will make the test server remember that number and
consider it a test case so that a subsequent LIST command will send the
<data> section of that test case back.

It allows LIST tests to be made more similar to how all other tests
work.

Test 100 was updated to provide its own directory listing.
This commit is contained in:
Daniel Stenberg
2014-01-04 23:39:30 +01:00
parent 5220c1d692
commit 5c0eae136b
3 changed files with 36 additions and 11 deletions

View File

@@ -11,11 +11,11 @@ LIST
<reply>
# When doing LIST, we get the default list output hard-coded in the test
# FTP server
<datacheck>
<data>
total 20
drwxr-xr-x 8 98 98 512 Oct 22 13:06 .
drwxr-xr-x 8 98 98 512 Oct 22 13:06 ..
drwxr-xr-x 2 98 98 512 May 2 1996 .NeXT
drwxr-xr-x 2 98 98 512 May 2 1996 curl-releases
-r--r--r-- 1 0 1 35 Jul 16 1996 README
lrwxrwxrwx 1 0 1 7 Dec 9 1999 bin -> usr/bin
dr-xr-xr-x 2 0 1 512 Oct 1 1997 dev
@@ -23,7 +23,7 @@ drwxrwxrwx 2 98 98 512 May 29 16:04 download.html
dr-xr-xr-x 2 0 1 512 Nov 30 1995 etc
drwxrwxrwx 2 98 1 512 Oct 30 14:33 pub
dr-xr-xr-x 5 0 1 512 Oct 1 1997 usr
</datacheck>
</data>
</reply>
#
@@ -36,7 +36,7 @@ ftp
FTP dir list PASV
</name>
<command>
ftp://%HOSTIP:%FTPPORT/
ftp://%HOSTIP:%FTPPORT/test-100/
</command>
</client>
@@ -47,6 +47,7 @@ ftp://%HOSTIP:%FTPPORT/
USER anonymous
PASS ftp@example.com
PWD
CWD test-100
EPSV
TYPE A
LIST