From 3af28bc8e78a7f281b68c36ffe515b5c8a17e507 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Tue, 19 Feb 2013 19:21:35 -0500 Subject: 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.) --- configure.ac | 14 +++++----- tests/Makefile.am | 66 ++++++++++++++++++++++------------------------ tests/auth-test.c | 12 +++++++++ tests/forms-test.c | 12 +++++++++ tests/proxy-test.c | 12 +++++++++ tests/pull-api.c | 12 +++++++++ tests/range-test.c | 12 +++++++++ tests/server-auth-test.c | 12 +++++++++ tests/xmlrpc-server-test.c | 12 +++++++++ tests/xmlrpc-test.c | 12 +++++++++ 10 files changed, 134 insertions(+), 42 deletions(-) diff --git a/configure.ac b/configure.ac index 1b120812..d6c97ee4 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 57ec0f4b..55dd3273 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 334033b3..2c443d63 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 1d254b12..3b6e5c16 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 1ac38557..075289dc 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 512d1768..070c2099 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 09e95f12..e7d01d21 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 757e065a..33cff45a 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 75f6c911..421348b1 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 7a29d0e9..3c3f76fe 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 -- cgit v1.2.3