cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: advice for building test suite with libcurl

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
Date: Wed, 28 Jan 2015 12:39:40 +0100

Raphael Bauduin <rblists_at_gmail.com> wrote:

> I'm building a small network test suite using libcurl. The code for every
> test is quite similar, all setting multiple CURLOPT_*,
> possibly with different options set to different values for each test.
> Due to the similarity of the code structure, I thought about defining the
> tests in a config file (currently testing with libconfig).
> This would enable me to have one code performing all tests, and also replace
[...]
> And my question is how do you advise me to solve the translation from a
> string to its symbol value,
> eg from "CURLOPT_URL" to CURLOPT_URL ( get_symbol_value_from_name in the
> pseudo code)?
>
> One possibility is defining a mapping from the string to the symbol,
> possibly with the help of a macro:
[...]
> Is this the way to go? Is there a way to define a mapping for all curl
> options? Or is there something in libcurl's code that can help me?

I'm not saying using libcurl directly is wrong, but Privoxy (HTTP proxy)
is mainly tested with privoxy-regression-test which is a Perl script that
calls curl:
http://ijbswa.cvs.sourceforge.net/viewvc/ijbswa/current/tools/privoxy-log-parser.pl?view=markup
(Scroll down to see the perldoc documentation)

While privoxy-regression-test is written to test Privoxy,
it does not require Privoxy to work and some of it's tests can
also be used to verify the behaviour of other proxies and webservers
(for example to confirm that redirects work as expected).

curl obviously doesn't expose all libcurl features, but for Privoxy's
purposes it works rather well. To further increase the test coverage I
started to leverage curl's test suite, but so far trying to upstream
the required patches has failed.

Fabian

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2015-01-28