libsoup r1173 - in trunk: . tests
- From: danw svn gnome org
- To: svn-commits-list gnome org
- Subject: libsoup r1173 - in trunk: . tests
- Date: Wed, 1 Oct 2008 20:54:09 +0000 (UTC)
Author: danw
Date: Wed Oct 1 20:54:09 2008
New Revision: 1173
URL: http://svn.gnome.org/viewvc/libsoup?rev=1173&view=rev
Log:
* tests/xmlrpc-test.c (main): add a new -s flag to indicate that
it's being run from inside xmlrpc-server-test.
(test_echo): if we aren't running inside xmlrpc-server-test, and
the response strings don't match the request strings, then compare
them to echo_strings_broken instead; a bug in php-xmlrpc manifests
when using libxml2 >= 2.7.1, resulting in incorrect responses. :-/
* tests/xmlrpc-server-test.c (do_xmlrpc_tests): Pass -s to
xmlrpc-test
Modified:
trunk/ChangeLog
trunk/tests/xmlrpc-server-test.c
trunk/tests/xmlrpc-test.c
Modified: trunk/tests/xmlrpc-server-test.c
==============================================================================
--- trunk/tests/xmlrpc-server-test.c (original)
+++ trunk/tests/xmlrpc-server-test.c Wed Oct 1 20:54:09 2008
@@ -262,7 +262,7 @@
static void
do_xmlrpc_tests (SoupURI *uri)
{
- char *argv[7];
+ char *argv[8];
int arg, out;
gboolean ok;
GPid pid;
@@ -270,19 +270,20 @@
GIOChannel *child_out;
argv[0] = "./xmlrpc-test";
- argv[1] = "-u";
- argv[2] = soup_uri_to_string (uri, FALSE);
+ argv[1] = "-s";
+ argv[2] = "-u";
+ argv[3] = soup_uri_to_string (uri, FALSE);
for (arg = 0; arg < debug_level && arg < 3; arg++)
- argv[arg + 3] = "-d";
- argv[arg + 3] = NULL;
+ argv[arg + 4] = "-d";
+ argv[arg + 4] = NULL;
ok = g_spawn_async_with_pipes (NULL, argv, NULL,
G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, &pid,
NULL, &out, NULL,
&error);
- g_free (argv[2]);
+ g_free (argv[3]);
if (!ok) {
printf ("Could not run xmlrpc-test: %s\n", error->message);
Modified: trunk/tests/xmlrpc-test.c
==============================================================================
--- trunk/tests/xmlrpc-test.c (original)
+++ trunk/tests/xmlrpc-test.c Wed Oct 1 20:54:09 2008
@@ -15,6 +15,7 @@
static SoupSession *session;
static const char *default_uri = "http://localhost:47524/xmlrpc-server.php";
static const char *uri = NULL;
+static gboolean server_test = FALSE;
static const char *const value_type[] = {
"BAD",
@@ -318,12 +319,20 @@
};
#define N_ECHO_STRINGS G_N_ELEMENTS (echo_strings)
+static const char *const echo_strings_broken[] = {
+ "This is a test",
+ " so is this",
+ "and so is this",
+ "amp; so is lt;thisgt;"
+};
+
static gboolean
test_echo (void)
{
GValueArray *originals, *echoes;
GValue retval;
int i;
+ gboolean php_bug = FALSE;
debug_printf (1, "echo (array of string -> array of string): ");
@@ -359,13 +368,20 @@
for (i = 0; i < echoes->n_values; i++) {
if (strcmp (echo_strings[i], g_value_get_string (&echoes->values[i])) != 0) {
- debug_printf (1, " WRONG! Mismatch at %d\n", i + 1);
- g_value_array_free (echoes);
- return FALSE;
+ if (!server_test && strcmp (echo_strings_broken[i], g_value_get_string (&echoes->values[i])) == 0)
+ php_bug = TRUE;
+ else {
+ debug_printf (1, " WRONG! Mismatch at %d\n", i + 1);
+ g_value_array_free (echoes);
+ return FALSE;
+ }
}
}
- debug_printf (1, "OK!\n");
+ if (php_bug)
+ debug_printf (1, "WRONG, but it's php's fault\n");
+ else
+ debug_printf (1, "OK!\n");
g_value_array_free (echoes);
return TRUE;
}
@@ -431,16 +447,18 @@
return do_bad_xmlrpc ("<methodCall><methodName>sum</methodName><params><param><value><int>1</int></value></param></params></methodCall>");
}
-static GOptionEntry uri_entry[] = {
+static GOptionEntry xmlrpc_entries[] = {
{ "uri", 'u', 0, G_OPTION_ARG_STRING, &uri,
"Alternate URI for server", NULL },
+ { "server-test", 's', 0, G_OPTION_ARG_NONE, &server_test,
+ "If this is being run from xmlrpc-server-test", NULL },
{ NULL }
};
int
main (int argc, char **argv)
{
- test_init (argc, argv, uri_entry);
+ test_init (argc, argv, xmlrpc_entries);
if (!uri) {
apache_init ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]