tests: do skipped tests properly
authorDan Winship <danw@gnome.org>
Wed, 20 Feb 2013 00:21:35 +0000 (19:21 -0500)
committerDan Winship <danw@gnome.org>
Wed, 20 Feb 2013 00:21:35 +0000 (19:21 -0500)
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
tests/Makefile.am
tests/auth-test.c
tests/forms-test.c
tests/proxy-test.c
tests/pull-api.c
tests/range-test.c
tests/server-auth-test.c
tests/xmlrpc-server-test.c
tests/xmlrpc-test.c

index 1b12081..d6c97ee 100644 (file)
@@ -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)
index 57ec0f4..55dd327 100644 (file)
@@ -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)                \
index 334033b..2c443d6 100644 (file)
@@ -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
index 1d254b1..3b6e5c1 100644 (file)
@@ -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
index 1ac3855..075289d 100644 (file)
@@ -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
index 512d176..070c209 100644 (file)
@@ -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
index 09e95f1..e7d01d2 100644 (file)
@@ -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
index 757e065..33cff45 100644 (file)
@@ -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
index 75f6c91..421348b 100644 (file)
@@ -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
index 7a29d0e..3c3f76f 100644 (file)
@@ -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