From: Dan Winship Date: Wed, 20 Feb 2013 00:21:35 +0000 (-0500) Subject: tests: do skipped tests properly X-Git-Tag: 2.41.91~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3af28bc8e78a7f281b68c36ffe515b5c8a17e507;p=platform%2Fupstream%2Flibsoup.git tests: do skipped tests properly automake interprets exit code 77 as meaning "skipped", so have the various apache-dependent, php-dependent, and curl-dependent tests do that, and compile them unconditionally. (Although, to avoid "unused" warnings, we end up #ifdeffing out the whole file.) --- diff --git a/configure.ac b/configure.ac index 1b12081..d6c97ee 100644 --- a/configure.ac +++ b/configure.ac @@ -288,29 +288,27 @@ if test "$have_apache" = 1; then MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php5" fi AC_MSG_RESULT($have_php) + AC_SUBST(IF_HAVE_PHP) if test "$have_php" = yes; then - AC_MSG_CHECKING([for xmlrpc-php]) + AC_MSG_CHECKING([for php-xmlrpc]) if $PHP --rf xmlrpc_server_create | grep -q "does not exist"; then - have_xmlrpc_php=no + have_php_xmlrpc=no MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES php-xmlrpc" else - have_xmlrpc_php=yes + have_php_xmlrpc=yes + AC_DEFINE(HAVE_PHP_XMLRPC, 1, [Have php-xmlrpc]) fi - AC_MSG_RESULT($have_xmlrpc_php) + AC_MSG_RESULT($have_php_xmlrpc) fi fi -AC_SUBST(IF_HAVE_PHP) -AM_CONDITIONAL(HAVE_XMLRPC_PHP, test "$have_xmlrpc_php" = yes) - AC_PATH_PROG(CURL, curl, no) if test "$CURL" != no; then AC_DEFINE(HAVE_CURL, 1, [Whether or not curl can be used for tests]) else MISSING_REGRESSION_TEST_PACKAGES="$MISSING_REGRESSION_TEST_PACKAGES curl" fi -AM_CONDITIONAL(HAVE_CURL, test "$CURL" != no) GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0` AC_SUBST(GLIB_COMPILE_RESOURCES) diff --git a/tests/Makefile.am b/tests/Makefile.am index 57ec0f4..55dd327 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -11,40 +11,38 @@ LIBS = \ $(LIBGNUTLS_LIBS) \ $(GLIB_LIBS) -TESTS = \ - cache-test \ - chunk-test \ - coding-test \ - connection-test \ - context-test \ - continue-test \ - cookies-test \ - date \ - header-parsing \ - misc-test \ - multipart-test \ - ntlm-test \ - redirect-test \ - requester-test \ - resource-test \ - session-test \ - sniffing-test \ - socket-test \ - ssl-test \ - streaming-test \ - timeout-test \ - tld-test \ - uri-parsing - -if HAVE_APACHE -TESTS += auth-test proxy-test pull-api range-test -endif -if HAVE_CURL -TESTS += forms-test server-auth-test -endif -if HAVE_XMLRPC_PHP -TESTS += xmlrpc-test xmlrpc-server-test -endif +TESTS = \ + auth-test \ + cache-test \ + chunk-test \ + coding-test \ + connection-test \ + context-test \ + continue-test \ + cookies-test \ + date \ + forms-test \ + header-parsing \ + misc-test \ + multipart-test \ + ntlm-test \ + proxy-test \ + pull-api \ + range-test \ + redirect-test \ + requester-test \ + resource-test \ + session-test \ + server-auth-test \ + sniffing-test \ + socket-test \ + ssl-test \ + streaming-test \ + timeout-test \ + tld-test \ + uri-parsing \ + xmlrpc-server-test \ + xmlrpc-test noinst_PROGRAMS = \ $(TESTS) \ diff --git a/tests/auth-test.c b/tests/auth-test.c index 334033b..2c443d6 100644 --- a/tests/auth-test.c +++ b/tests/auth-test.c @@ -2,6 +2,8 @@ #include "test-utils.h" +#ifdef HAVE_APACHE + static GMainLoop *loop; typedef struct { @@ -1201,3 +1203,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_APACHE */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/forms-test.c b/tests/forms-test.c index 1d254b1..3b6e5c1 100644 --- a/tests/forms-test.c +++ b/tests/forms-test.c @@ -5,6 +5,8 @@ #include "test-utils.h" +#ifdef HAVE_CURL + static struct { const char *title, *name; const char *result; @@ -451,3 +453,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_CURL */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/proxy-test.c b/tests/proxy-test.c index 1ac3855..075289d 100644 --- a/tests/proxy-test.c +++ b/tests/proxy-test.c @@ -2,6 +2,8 @@ #include "test-utils.h" +#ifdef HAVE_APACHE + typedef struct { const char *explanation; const char *url; @@ -394,3 +396,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_APACHE */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/pull-api.c b/tests/pull-api.c index 512d176..070c209 100644 --- a/tests/pull-api.c +++ b/tests/pull-api.c @@ -2,6 +2,8 @@ #include "test-utils.h" +#ifdef HAVE_APACHE + static SoupBuffer *correct_response; static void @@ -527,3 +529,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_APACHE */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/range-test.c b/tests/range-test.c index 09e95f1..e7d01d2 100644 --- a/tests/range-test.c +++ b/tests/range-test.c @@ -2,6 +2,8 @@ #include "test-utils.h" +#ifdef HAVE_APACHE + SoupBuffer *full_response; int total_length; char *test_response; @@ -370,3 +372,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_APACHE */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/server-auth-test.c b/tests/server-auth-test.c index 757e065..33cff45 100644 --- a/tests/server-auth-test.c +++ b/tests/server-auth-test.c @@ -5,6 +5,8 @@ #include "test-utils.h" +#ifdef HAVE_CURL + static struct { gboolean client_sent_basic, client_sent_digest; gboolean server_requested_basic, server_requested_digest; @@ -361,3 +363,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_CURL */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/xmlrpc-server-test.c b/tests/xmlrpc-server-test.c index 75f6c91..421348b 100644 --- a/tests/xmlrpc-server-test.c +++ b/tests/xmlrpc-server-test.c @@ -5,6 +5,8 @@ #include "test-utils.h" +#ifdef HAVE_PHP_XMLRPC + #ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS #endif @@ -345,3 +347,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_PHP_XMLRPC */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif diff --git a/tests/xmlrpc-test.c b/tests/xmlrpc-test.c index 7a29d0e..3c3f76f 100644 --- a/tests/xmlrpc-test.c +++ b/tests/xmlrpc-test.c @@ -5,6 +5,8 @@ #include "test-utils.h" +#ifdef HAVE_PHP_XMLRPC + #ifdef G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS #endif @@ -552,3 +554,13 @@ main (int argc, char **argv) test_cleanup (); return errors != 0; } + +#else /* HAVE_PHP_XMLRPC */ + +int +main (int argc, char **argv) +{ + return 77; /* SKIP */ +} + +#endif