[gnome-keyring/gnome-3-0] Better testing configure options.
- From: Stefan Walter <stefw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-keyring/gnome-3-0] Better testing configure options.
- Date: Sat, 23 Apr 2011 10:23:33 +0000 (UTC)
commit eedfc9755323f68a26c39ff2374a11dbc18ada32
Author: Stef Walter <stefw collabora co uk>
Date: Sat Apr 23 11:43:39 2011 +0200
Better testing configure options.
* --enable-tests=yes/no/full
* With 'full' the testing hooks in gnome-keyring-daemon are built
* Different libraries are built in testable and non-testable versions.
configure.in | 25 ++++++++++++++-----------
daemon/dbus/gkd-dbus-secrets.c | 2 +-
daemon/dbus/gkd-dbus.c | 2 +-
daemon/dbus/tests/Makefile.am | 4 +---
daemon/gkd-main.c | 4 ++--
daemon/gkd-pkcs11.c | 2 +-
egg/tests/Makefile.am | 4 +---
egg/tests/test-dh.c | 7 +++++--
gck/Makefile.am | 21 +++++++++++++--------
gck/gck-mock.h | 6 +-----
gck/gck-test.h | 4 ----
gck/tests/Makefile.am | 13 ++++++-------
gcr/Makefile.am | 13 ++++++++-----
gcr/tests/Makefile.am | 10 ++++------
pkcs11/gkm/tests/Makefile.am | 4 +---
pkcs11/wrap-layer/tests/Makefile.am | 5 ++++-
ui/Makefile.am | 9 +++++++--
ui/gku-prompt.c | 4 ++--
ui/gku-prompt.h | 4 ++--
19 files changed, 74 insertions(+), 69 deletions(-)
---
diff --git a/configure.in b/configure.in
index c9ff6fb..63403f1 100644
--- a/configure.in
+++ b/configure.in
@@ -522,23 +522,26 @@ fi
# Tests and Unit Tests
AC_ARG_ENABLE(tests,
- AC_HELP_STRING([--disable-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" != "no"; then
- AC_DEFINE_UNQUOTED(WITH_TESTS, 1, [Build with internal tests and unit tests])
- AC_MSG_RESULT(yes)
+
+if test "$enable_tests" = "full"; then
+ tests_status="full"
CFLAGS="$CFLAGS -Werror"
- tests_status="yes"
- enable_tests="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"
- enable_tests="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")
# ----------------------------------------------------------------------
# Coverage
diff --git a/daemon/dbus/gkd-dbus-secrets.c b/daemon/dbus/gkd-dbus-secrets.c
index 089d783..98cada7 100644
--- a/daemon/dbus/gkd-dbus-secrets.c
+++ b/daemon/dbus/gkd-dbus-secrets.c
@@ -71,7 +71,7 @@ gkd_dbus_secrets_startup (void)
g_return_val_if_fail (dbus_conn, FALSE);
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
service = g_getenv ("GNOME_KEYRING_TEST_SERVICE");
if (service && service[0])
flags = DBUS_NAME_FLAG_ALLOW_REPLACEMENT | DBUS_NAME_FLAG_REPLACE_EXISTING;
diff --git a/daemon/dbus/gkd-dbus.c b/daemon/dbus/gkd-dbus.c
index 90fad59..551cfe3 100644
--- a/daemon/dbus/gkd-dbus.c
+++ b/daemon/dbus/gkd-dbus.c
@@ -184,7 +184,7 @@ gkd_dbus_singleton_acquire (gboolean *acquired)
/* Try and grab our name */
if (!acquired_asked) {
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
service = g_getenv ("GNOME_KEYRING_TEST_SERVICE");
if (service && service[0])
flags = DBUS_NAME_FLAG_ALLOW_REPLACEMENT | DBUS_NAME_FLAG_REPLACE_EXISTING;
diff --git a/daemon/dbus/tests/Makefile.am b/daemon/dbus/tests/Makefile.am
index 2b612ac..d5f7eb8 100644
--- a/daemon/dbus/tests/Makefile.am
+++ b/daemon/dbus/tests/Makefile.am
@@ -14,10 +14,8 @@ TEST_PROGS = \
check_PROGRAMS = $(TEST_PROGS)
test: $(TEST_PROGS)
- SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+ SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
check-local: test
-if WITH_TESTS
all-local: $(check_PROGRAMS)
-endif
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 8a38783..18e3766 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -803,7 +803,7 @@ main (int argc, char *argv[])
*/
gkd_capability_obtain_capability_and_drop_privileges ();
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
g_setenv ("DBUS_FATAL_WARNINGS", "1", FALSE);
if (!g_getenv ("G_DEBUG"))
g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
@@ -834,7 +834,7 @@ main (int argc, char *argv[])
if (run_version) {
g_print ("gnome-keyring-daemon: %s\n", VERSION);
g_print ("testing: %s\n",
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
"enabled");
#else
"disabled");
diff --git a/daemon/gkd-pkcs11.c b/daemon/gkd-pkcs11.c
index fef29c9..aefe4c1 100644
--- a/daemon/gkd-pkcs11.c
+++ b/daemon/gkd-pkcs11.c
@@ -105,7 +105,7 @@ gkd_pkcs11_initialize (void)
memset (&init_args, 0, sizeof (init_args));
init_args.flags = CKF_OS_LOCKING_OK;
-#if WITH_TESTS
+#if WITH_TESTABLE
{
const gchar *path = g_getenv ("GNOME_KEYRING_TEST_PATH");
if (path && path[0])
diff --git a/egg/tests/Makefile.am b/egg/tests/Makefile.am
index d72bbda..72f0d37 100644
--- a/egg/tests/Makefile.am
+++ b/egg/tests/Makefile.am
@@ -34,13 +34,11 @@ test_asn1_SOURCES = \
check_PROGRAMS = $(TEST_PROGS)
test: $(TEST_PROGS)
- SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+ SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
check-local: test
-if WITH_TESTS
all-local: $(check_PROGRAMS)
-endif
EXTRA_DIST = \
test.asn \
diff --git a/egg/tests/test-dh.c b/egg/tests/test-dh.c
index 13e9c70..58098cc 100644
--- a/egg/tests/test-dh.c
+++ b/egg/tests/test-dh.c
@@ -191,8 +191,11 @@ main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
- g_test_add_func ("/dh/perform", test_perform);
- g_test_add_func ("/dh/short_pair", test_short_pair);
+ if (!g_test_quick ()) {
+ g_test_add_func ("/dh/perform", test_perform);
+ g_test_add_func ("/dh/short_pair", test_short_pair);
+ }
+
g_test_add_func ("/dh/default_768", test_default_768);
g_test_add_func ("/dh/default_1024", test_default_1024);
g_test_add_func ("/dh/default_1536", test_default_1536);
diff --git a/gck/Makefile.am b/gck/Makefile.am
index 13f83eb..fc92886 100644
--- a/gck/Makefile.am
+++ b/gck/Makefile.am
@@ -1,16 +1,13 @@
if WITH_TESTS
TESTS_DIR = tests
-TESTS_SOURCES = gck-mock.c gck-mock.h gck-test.c gck-test.h
-EXPORT_PATT = '^_?gck_*'
+TESTABLE_LIB = libgck-testable.la
else
TESTS_DIR =
-TESTS_SOURCES =
-EXPORT_PATT = '^gck_*'
+TESTABLE_LIB =
endif
-SUBDIRS = . \
- $(TESTS_DIR)
+SUBDIRS = . $(TESTS_DIR)
incdir = $(includedir)/gck
@@ -44,13 +41,12 @@ libgck_la_SOURCES = \
gck-session.c \
gck-slot.c \
gck-uri.c \
- $(TESTS_SOURCES) \
$(BUILT_SOURCES)
libgck_la_LDFLAGS = \
-version-info $(GCK_LT_RELEASE) \
-no-undefined \
- -export-symbols-regex $(EXPORT_PATT)
+ -export-symbols-regex '^gck_*'
libgck_la_LIBADD = \
$(top_builddir)/egg/libegg-hex.la \
@@ -59,6 +55,15 @@ libgck_la_LIBADD = \
$(GIO_LIBS) \
$(GLIB_LIBS)
+noinst_LTLIBRARIES = $(TESTABLE_LIB)
+libgck_testable_la_SOURCES = \
+ gck-mock.c \
+ gck-mock.h \
+ gck-test.c \
+ gck-test.h
+libgck_testable_la_LIBADD = \
+ $(libgck_la_OBJECTS)
+
gck-marshal.h: gck-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=_gck_marshal > $@
diff --git a/gck/gck-mock.h b/gck/gck-mock.h
index db14f36..2b2c8e1 100644
--- a/gck/gck-mock.h
+++ b/gck/gck-mock.h
@@ -29,8 +29,6 @@
#ifndef GCK_MOCK_H
#define GCK_MOCK_H
-#ifdef WITH_TESTS
-
CK_RV gck_mock_C_Initialize (CK_VOID_PTR pInitArgs);
CK_RV gck_mock_validate_and_C_Initialize (CK_VOID_PTR pInitArgs);
@@ -419,6 +417,4 @@ void gck_mock_module_set_pin (const gchar
#define GCK_MOCK_SLOT_ONE_URI "pkcs11:manufacturer=TEST%20MANUFACTURER;serial=TEST%20SERIAL"
-#endif /* WITH_TESTS */
-
-#endif /* TESTMODULE_H_ */
+#endif /* GCK_MOCK_H */
diff --git a/gck/gck-test.h b/gck/gck-test.h
index 6f2e0fc..186d6e5 100644
--- a/gck/gck-test.h
+++ b/gck/gck-test.h
@@ -29,8 +29,6 @@
#ifndef GCK_TEST_H
#define GCK_TEST_H
-#ifdef WITH_TESTS
-
#define gck_assert_cmprv(v1, cmp, v2) \
do { CK_RV __v1 = (v1), __v2 = (v2); \
if (__v1 cmp __v2) ; else \
@@ -63,6 +61,4 @@ void gck_assertion_message_cmpulong (const gchar *domain,
const gchar *cmp,
CK_ULONG arg2);
-#endif /* WITH_TESTS */
-
#endif /* GCK_TEST_H */
diff --git a/gck/tests/Makefile.am b/gck/tests/Makefile.am
index 78b96ba..b06a1e4 100644
--- a/gck/tests/Makefile.am
+++ b/gck/tests/Makefile.am
@@ -6,12 +6,13 @@ INCLUDES = \
$(GLIB_CFLAGS)
LDADD = \
- $(top_builddir)/gck/libgck.la \
+ libmock-test-module.la \
+ $(top_builddir)/gck/libgck-testable.la \
$(top_builddir)/egg/libegg-test.la \
+ $(top_builddir)/egg/libegg-hex.la \
$(GTHREAD_LIBS) \
$(GLIB_LIBS) \
- $(GIO_LIBS) \
- libmock-test-module.la
+ $(GIO_LIBS)
TEST_PROGS = \
test-gck-attributes \
@@ -27,13 +28,11 @@ TEST_PROGS = \
check_PROGRAMS = $(TEST_PROGS)
test: $(TEST_PROGS)
- SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+ SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
check-local: test
-if WITH_TESTS
all-local: $(check_PROGRAMS)
-endif
lib_LTLIBRARIES = libmock-test-module.la
@@ -50,4 +49,4 @@ libmock_test_module_la_SOURCES = \
mock-test-module.c
libmock_test_module_la_LIBADD = \
- $(top_builddir)/gck/libgck.la
+ $(top_builddir)/gck/libgck-testable.la
diff --git a/gcr/Makefile.am b/gcr/Makefile.am
index e68e550..c33d2ee 100644
--- a/gcr/Makefile.am
+++ b/gcr/Makefile.am
@@ -1,14 +1,13 @@
if WITH_TESTS
TESTS_DIR = tests
-EXPORT_PATT = '^_?gcr_*'
+TESTABLE_LIB = libgcr-testable.la
else
TESTS_DIR =
-EXPORT_PATT = '^gcr_*'
+TESTABLE_LIB =
endif
-SUBDIRS = . \
- $(TESTS_DIR)
+SUBDIRS = . $(TESTS_DIR)
# ------------------------------------------------------------------
# UI BUILDER
@@ -99,7 +98,7 @@ libgcr GCR_VERSION_SUFFIX@_la_CFLAGS = \
libgcr GCR_VERSION_SUFFIX@_la_LDFLAGS = \
-version-info $(GCR_LT_RELEASE) \
-no-undefined \
- -export-symbols-regex $(EXPORT_PATT)
+ -export-symbols-regex '^gcr_*'
libgcr GCR_VERSION_SUFFIX@_la_LIBADD = \
$(top_builddir)/egg/libegg.la \
@@ -110,6 +109,10 @@ libgcr GCR_VERSION_SUFFIX@_la_LIBADD = \
$(LIBGCRYPT_LIBS) \
$(GTK_LIBS)
+noinst_LTLIBRARIES = $(TESTABLE_LIB)
+libgcr_testable_la_SOURCES =
+libgcr_testable_la_LIBADD = $(libgcr GCR_VERSION_SUFFIX@_la_OBJECTS)
+
gcr-marshal.h: gcr-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=_gcr_marshal > $@
diff --git a/gcr/tests/Makefile.am b/gcr/tests/Makefile.am
index 3a5290d..544a406 100644
--- a/gcr/tests/Makefile.am
+++ b/gcr/tests/Makefile.am
@@ -10,13 +10,13 @@ INCLUDES = \
$(LIBGCRYPT_CFLAGS)
LDADD = \
- $(top_builddir)/gcr/libgcr GCR_VERSION_SUFFIX@.la \
+ $(top_builddir)/gcr/libgcr-testable.la \
$(top_builddir)/egg/libegg.la \
$(top_builddir)/egg/libegg-entry-buffer.la \
- $(top_builddir)/gck/libgck.la \
+ $(top_builddir)/gck/libgck-testable.la \
$(GTK_LIBS) \
$(GLIB_LIBS) \
- $(LIBGCRYT_LIBS)
+ $(LIBGCRYPT_LIBS)
TEST_PROGS = \
test-certificate \
@@ -29,13 +29,11 @@ TEST_PROGS = \
check_PROGRAMS = $(TEST_PROGS)
test: $(TEST_PROGS)
- SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+ SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
check-local: test
-if WITH_TESTS
all-local: $(check_PROGRAMS)
-endif
EXTRA_DIST = \
files
diff --git a/pkcs11/gkm/tests/Makefile.am b/pkcs11/gkm/tests/Makefile.am
index 91cff0a..c49d4ac 100644
--- a/pkcs11/gkm/tests/Makefile.am
+++ b/pkcs11/gkm/tests/Makefile.am
@@ -59,13 +59,11 @@ test_timer_LDADD = \
check_PROGRAMS = $(TEST_PROGS)
test: $(TEST_PROGS)
- SRCDIR='$(srcdir)' gtester -k --verbose ${TEST_PROGS}
+ SRCDIR='$(srcdir)' gtester -k --verbose -m $(TEST_MODE) --g-fatal-warnings $(TEST_PROGS)
check-local: test
-if WITH_TESTS
all-local: $(check_PROGRAMS)
-endif
asn1-def-test.h: test.asn
$(ASN1PARSER) -o asn1-def-test.h $(srcdir)/test.asn
diff --git a/pkcs11/wrap-layer/tests/Makefile.am b/pkcs11/wrap-layer/tests/Makefile.am
index 0dbc0a6..fb3ee7b 100644
--- a/pkcs11/wrap-layer/tests/Makefile.am
+++ b/pkcs11/wrap-layer/tests/Makefile.am
@@ -15,7 +15,10 @@ TESTING_FILES = \
TESTING_LIBS = \
$(top_builddir)/pkcs11/wrap-layer/libgkm-wrap-layer.la \
$(top_builddir)/pkcs11/gkm/libgkm.la \
- $(top_builddir)/ui/libgku-prompt.la \
+ $(top_builddir)/ui/libgku-prompt-testable.la \
$(top_builddir)/egg/libegg.la
+TESTING_FLAGS = \
+ -DWITH_TESTABLE
+
include $(top_srcdir)/testing/testing.make
\ No newline at end of file
diff --git a/ui/Makefile.am b/ui/Makefile.am
index d4f124f..bff9aea 100644
--- a/ui/Makefile.am
+++ b/ui/Makefile.am
@@ -1,8 +1,10 @@
if WITH_TESTS
TESTS_DIR = tests
+TESTABLE_LIB = libgku-prompt-testable.la
else
TESTS_DIR =
+TESTABLE_LIB =
endif
SUBDIRS = . $(TESTS_DIR)
@@ -27,7 +29,7 @@ ui_DATA = \
# ------------------------------------------------------------------
# DAEMON CODE
-noinst_LTLIBRARIES = libgku-prompt.la
+noinst_LTLIBRARIES = libgku-prompt.la $(TESTABLE_LIB)
BUILT_SOURCES = \
gku-prompt-marshal.c gku-prompt-marshal.h
@@ -41,6 +43,9 @@ libgku_prompt_la_LIBADD = \
$(GLIB_LIBS) \
$(GOBJECT_LIBS)
+libgku_prompt_testable_la_SOURCES = $(libgku_prompt_la_SOURCES)
+libgku_prompt_testable_la_CFLAGS = -DWITH_TESTABLE
+
gku-prompt-marshal.h: gku-prompt-marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=gku_prompt_marshal > $@
@@ -77,7 +82,7 @@ gnome_keyring_prompt GCR_VERSION_SUFFIX@_CFLAGS = \
$(LIBGCRYPT_CFLAGS) \
$(GTK_CFLAGS)
-# Install a link from gnome-keyring-prompt â?? gnome-keyring-prompt GCR_VERSION_SUFFIX@ to maintain compatibility
+# Install a link from gnome-keyring-prompt -> gnome-keyring-prompt GCR_VERSION_SUFFIX@ to maintain compatibility
if WITH_GTK3
install-exec-hook:
@test -e "$(DESTDIR)$(libexecdir)/gnome-keyring-prompt" || (cd $(DESTDIR)$(libexecdir) && $(LN_S) gnome-keyring-prompt GCR_VERSION_SUFFIX@ gnome-keyring-prompt)
diff --git a/ui/gku-prompt.c b/ui/gku-prompt.c
index c852298..abcb82f 100644
--- a/ui/gku-prompt.c
+++ b/ui/gku-prompt.c
@@ -1212,7 +1212,7 @@ gku_prompt_request_attention_sync (const gchar *window_id, GkuPromptAttentionFun
g_cond_free (cond);
}
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
void
gku_prompt_dummy_prepare_response (void)
@@ -1299,4 +1299,4 @@ gku_prompt_dummy_queue_no (void)
gku_prompt_dummy_queue_response (RESPONSE);
}
-#endif
+#endif /* WITH_TESTABLE */
diff --git a/ui/gku-prompt.h b/ui/gku-prompt.h
index f01f0be..6090999 100644
--- a/ui/gku-prompt.h
+++ b/ui/gku-prompt.h
@@ -144,7 +144,7 @@ void gku_prompt_request_attention_sync (const gchar *window_i
gpointer user_data,
GDestroyNotify destroy_notify);
-#ifdef WITH_TESTS
+#ifdef WITH_TESTABLE
void gku_prompt_dummy_prepare_response (void);
@@ -161,6 +161,6 @@ void gku_prompt_dummy_queue_auto_password (const gchar *passwor
void gku_prompt_dummy_queue_no (void);
-#endif
+#endif /* WITH_TESTABLE */
#endif /* __GKU_PROMPT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]