curl-and-python

Re: Test suite dependencies

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 3 Mar 2013 23:27:50 +0100 (CET)

On Sun, 3 Mar 2013, Oleg Pudeyev wrote:

> If you don't mind then, given this test:
>
> https://github.com/p/pycurl/blob/master/tests/test_ftp.py
>
> How should I check that QUOTE command is executed, using curl's ftpserver?

curl has a complete test system and setup. You run tests by their numbers, and
you use a start script to do so. That script reads test information from an
XML(-like) file and then starts the necessary servers etc and then also passes
on the necessary instructions to the server so that it will serve the test as
intended. The script then runs the command as instructed in the test file and
then it compares outputs, protocol dumps, checks for memory leaks and more.

To see how the most simple FTP LIST test case looks like, see
https://github.com/bagder/curl/blob/master/tests/data/test100

The runtests.pl man page is here: http://curl.haxx.se/dev/runtests.html, the
test case file format is documented here:
https://github.com/bagder/curl/blob/master/tests/FILEFORMAT

> My initial (and current) goal is to create a coherent test suite from
> existing test code. Baby steps and all that.

I don't think using the curl test suite can be considered a baby step =)

> Do you have any suggestions for how pycurl->libcurl translation should be
> checked?

My thinking is that you'd write a test stub library that provides libcurl's
API (like perhaps called testpycurl), but for all function calls the lib would
only output its given arguments in some kind of sensible manner and return
valid return codes.

The test code would then make sure that the pycurl code would equal a correct
sequence of libcurl calls that "makes sense" according to the docs and that
has been proven to work (perhaps by curl's own test suite). So as long as all
tests makes "legal" libcurl sequences, they should be working and there should
be corresponding test cases for them among the curl tests...

It was only an idea. Maybe it doesn't work.

-- 
  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-03-03