From 9ed0496fc8b20cf50b615c4721f7544c1768cdb9 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Wed, 10 Jul 2013 17:52:49 +0800 Subject: [PATCH v2 2/3] TEST: polish test build detection in bus daemon test files Bug: https://bugs.freedesktop.org/show_bug.cgi?id=66753 Signed-off-by: Chengwei Yang --- bus/test-launch-helper.c | 14 ++++---------- bus/test-main.c | 13 ++++--------- bus/test-system.c | 13 ++++--------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/bus/test-launch-helper.c b/bus/test-launch-helper.c index e88c989..bfadc65 100644 --- a/bus/test-launch-helper.c +++ b/bus/test-launch-helper.c @@ -22,6 +22,9 @@ */ #include + +#ifdef DBUS_ENABLE_EMBEDDED_TESTS + #include "test.h" #include "activation-helper.h" @@ -29,7 +32,6 @@ #include #include -#ifdef DBUS_ENABLE_EMBEDDED_TESTS static void die (const char *failure) { @@ -56,7 +58,6 @@ test_post_hook (const char *name) { check_memleaks (name); } -#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ #ifdef ACTIVATION_LAUNCHER_DO_OOM @@ -97,7 +98,6 @@ bus_activation_helper_oom_test (void *data) int main (int argc, char **argv) { -#ifdef DBUS_ENABLE_EMBEDDED_TESTS const char *dir; DBusString config_file; @@ -137,11 +137,5 @@ main (int argc, char **argv) printf ("%s: Success\n", argv[0]); return 0; -#else /* DBUS_ENABLE_EMBEDDED_TESTS */ - - printf ("Not compiled with test support\n"); - - return 0; -#endif } - +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ diff --git a/bus/test-main.c b/bus/test-main.c index 01d2287..e0edab8 100644 --- a/bus/test-main.c +++ b/bus/test-main.c @@ -22,6 +22,9 @@ */ #include + +#ifdef DBUS_ENABLE_EMBEDDED_TESTS + #include "test.h" #include #include @@ -31,7 +34,6 @@ #include #include "selinux.h" -#ifdef DBUS_ENABLE_EMBEDDED_TESTS static void die (const char *failure) { @@ -52,7 +54,6 @@ check_memleaks (const char *name) die ("memleaks"); } } -#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ static DBusInitialFDs *initial_fds = NULL; @@ -84,7 +85,6 @@ test_post_hook (void) int main (int argc, char **argv) { -#ifdef DBUS_ENABLE_EMBEDDED_TESTS const char *dir; const char *only; DBusString test_data_dir; @@ -181,10 +181,5 @@ main (int argc, char **argv) return 0; -#else /* DBUS_ENABLE_EMBEDDED_TESTS */ - - printf ("Not compiled with test support\n"); - - return 0; -#endif } +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ diff --git a/bus/test-system.c b/bus/test-system.c index 5f02d0a..a001d4d 100644 --- a/bus/test-system.c +++ b/bus/test-system.c @@ -22,6 +22,9 @@ */ #include + +#ifdef DBUS_ENABLE_EMBEDDED_TESTS + #include "test.h" #include #include @@ -29,7 +32,6 @@ #include #include -#ifdef DBUS_ENABLE_EMBEDDED_TESTS static void die (const char *failure) { @@ -50,7 +52,6 @@ check_memleaks (const char *name) die ("memleaks"); } } -#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ static void test_pre_hook (void) @@ -67,7 +68,6 @@ test_post_hook (void) int main (int argc, char **argv) { -#ifdef DBUS_ENABLE_EMBEDDED_TESTS const char *dir; DBusString test_data_dir; @@ -98,10 +98,5 @@ main (int argc, char **argv) printf ("%s: Success\n", argv[0]); return 0; -#else /* DBUS_ENABLE_EMBEDDED_TESTS */ - - printf ("Not compiled with test support\n"); - - return 0; -#endif } +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ -- 1.7.9.5