[libgnome-keyring/gnome-3-0] Better testing configure options.



commit 0a596f934d3478a323333b36fcf1265de715f7f0
Author: Stef Walter <stefw collabora co uk>
Date:   Sun Apr 24 17:14:19 2011 +0200

    Better testing configure options.
    
      * --enable-tests=yes/no/full
      * With 'full' various testable behavior is fine tuned or used.

 Makefile.am                              |    4 ++--
 configure.in                             |   23 ++++++++++++++---------
 docs/reference/gnome-keyring/Makefile.am |    3 ++-
 egg/tests/Makefile.am                    |    2 --
 egg/tests/test-dh.c                      |    6 ++++++
 egg/tests/test-secmem.c                  |    3 +++
 library/gkr-misc.c                       |    2 +-
 library/gkr-operation.c                  |    4 ++--
 library/tests/Makefile.am                |    2 --
 9 files changed, 30 insertions(+), 19 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 710af78..145f566 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,8 +15,8 @@ EXTRA_DIST = \
 
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-gtk-doc \
-	--enable-tests \
-	--disable-debug
+	--enable-tests=yes \
+	--enable-debug=yes
 
 DISTCLEANFILES = \
 	intltool-extract \
diff --git a/configure.in b/configure.in
index c5aaaee..19f840b 100644
--- a/configure.in
+++ b/configure.in
@@ -185,21 +185,26 @@ fi
 # Tests and Unit Tests
 
 AC_ARG_ENABLE(tests,
-              AC_HELP_STRING([--enable-tests],
-              [Build test tools, unit tests, and -Werror]))
+        AC_HELP_STRING([--enable-tests=yes/no/full],
+        [Build tests and testing tools. default: yes]))
 
 AC_MSG_CHECKING([build test tools, unit tests, and -Werror])
-if test "$enable_tests" = "yes"; then
-	AC_DEFINE_UNQUOTED(WITH_TESTS, 1, [Build with unit test support])
-	AC_MSG_RESULT(yes)
+
+if test "$enable_tests" = "full"; then
+	tests_status="full"
 	CFLAGS="$CFLAGS -Werror"
-	tests_status="yes"
-else
-	AC_MSG_RESULT(no)
+	TEST_MODE="thorough"
+	AC_DEFINE_UNQUOTED(WITH_TESTABLE, 1, [Build extra hooks for more testable code])
+elif test "$enable_tests" = "no"; then
 	tests_status="no"
+else
+	TEST_MODE="quick"
+	tests_status="yes"
 fi
 
-AM_CONDITIONAL(WITH_TESTS, test "$enable_tests" = "yes")
+AC_MSG_RESULT($tests_status)
+AC_SUBST(TEST_MODE)
+AM_CONDITIONAL(WITH_TESTS, test "$enable_tests" != "no")
 
 AC_PATH_PROG(GNOME_KEYRING_DAEMON_PATH, gnome-keyring-daemon, "gnome-keyring-daemon")
 AC_DEFINE_UNQUOTED(GNOME_KEYRING_DAEMON_PATH, "$GNOME_KEYRING_DAEMON_PATH", [Path to gnome-keyring-daemon])
diff --git a/docs/reference/gnome-keyring/Makefile.am b/docs/reference/gnome-keyring/Makefile.am
index 39bcc07..9a09acd 100644
--- a/docs/reference/gnome-keyring/Makefile.am
+++ b/docs/reference/gnome-keyring/Makefile.am
@@ -97,7 +97,8 @@ EXTRA_DIST +=
 # Files not to distribute
 # for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
 # for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
-DISTCLEANFILES = tmpl/gnome-keyring-unused.sgml
+DISTCLEANFILES = \
+	tmpl/gnome-keyring-unused.sgml
 
 # Comment this out if you want your docs-status tested during 'make check'
 #TESTS_ENVIRONMENT = cd $(srcsrc)
diff --git a/egg/tests/Makefile.am b/egg/tests/Makefile.am
index 240fad0..499cba5 100644
--- a/egg/tests/Makefile.am
+++ b/egg/tests/Makefile.am
@@ -19,6 +19,4 @@ test: ${TEST_PROGS}
 
 check-local: test
 
-if WITH_TESTS
 all-local: $(check_PROGRAMS)
-endif
diff --git a/egg/tests/test-dh.c b/egg/tests/test-dh.c
index 4a62fd1..ed74e7c 100644
--- a/egg/tests/test-dh.c
+++ b/egg/tests/test-dh.c
@@ -46,6 +46,9 @@ test_dh_perform (void)
 	gboolean ret;
 	gsize n1, n2;
 
+	if (g_test_quick ())
+		return;
+
 	/* Load up the parameters */
 	if (!egg_dh_default_params ("ietf-ike-grp-modp-768", &p, &g))
 		g_assert_not_reached ();
@@ -83,6 +86,9 @@ test_dh_short_pair (void)
 	gcry_mpi_t x1, X1;
 	gboolean ret;
 
+	if (g_test_quick ())
+		return;
+
 	/* Load up the parameters */
 	ret = egg_dh_default_params ("ietf-ike-grp-modp-1024", &p, &g);
 	g_assert (ret);
diff --git a/egg/tests/test-secmem.c b/egg/tests/test-secmem.c
index f908f19..663ad29 100644
--- a/egg/tests/test-secmem.c
+++ b/egg/tests/test-secmem.c
@@ -154,6 +154,9 @@ test_multialloc (void)
 	gsize size;
 	int i, action, index;
 
+	if (g_test_quick ())
+		return;
+
 	/* A predetermined seed to get a predetermined pattern */
 	g_random_set_seed (15);
 	memory = g_ptr_array_new ();
diff --git a/library/gkr-misc.c b/library/gkr-misc.c
index ba2b6b6..5f20bcd 100644
--- a/library/gkr-misc.c
+++ b/library/gkr-misc.c
@@ -48,7 +48,7 @@
 const gchar*
 gkr_service_name (void)
 {
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
 	const gchar *service = g_getenv ("GNOME_KEYRING_TEST_SERVICE");
 	if (service && service[0])
 		return service;
diff --git a/library/gkr-operation.c b/library/gkr-operation.c
index 829890f..b345d79 100644
--- a/library/gkr-operation.c
+++ b/library/gkr-operation.c
@@ -377,7 +377,7 @@ send_with_pending (GkrOperation *op)
 	g_assert (op->request);
 	g_assert (!op->pending);
 
-#if WITH_TESTS
+#if WITH_TESTABLE
 	timeout = INT_MAX;
 #endif
 
@@ -485,7 +485,7 @@ gkr_operation_block_and_unref (GkrOperation *op)
 
 	g_return_val_if_fail (op, BROKEN);
 
-#if WITH_TESTS
+#if WITH_TESTABLE
 	timeout = INT_MAX;
 #endif
 
diff --git a/library/tests/Makefile.am b/library/tests/Makefile.am
index 0909356..1f15d44 100644
--- a/library/tests/Makefile.am
+++ b/library/tests/Makefile.am
@@ -21,8 +21,6 @@ check_PROGRAMS = \
 test: $(TEST_PROGS)
 	gtester -k --verbose $(TEST_PROGS)
 
-if WITH_TESTS
 all-local: $(check_PROGRAMS)
-endif
 
 check-local: test



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]