40c3ae9
From 26590d31f492dbbd36be6d0bde46a4bd3b221edb Mon Sep 17 00:00:00 2001
40c3ae9
From: Jakub Hrozek <jhrozek@redhat.com>
40c3ae9
Date: Mon, 4 Mar 2013 16:37:04 +0100
40c3ae9
Subject: [PATCH 3/4] Do not compile main() in DP if UNIT_TESTING is defined
40c3ae9
40c3ae9
The simple access provider unit tests now need to link against the Data
40c3ae9
Provider when they start using the be_file_account_request() function.
40c3ae9
But then we would start having conflicts as at least the main()
40c3ae9
functions would clash.
40c3ae9
40c3ae9
If UNIT_TESTING is defined, then the data_provider_be.c module does not
40c3ae9
contain the main() function and can be linked against directly from
40c3ae9
another module that contains its own main() function
40c3ae9
---
40c3ae9
 src/providers/data_provider_be.c | 2 ++
40c3ae9
 1 file changed, 2 insertions(+)
40c3ae9
40c3ae9
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
40c3ae9
index f85a04d09b5b41b17be611c333324f7207242979..33590aeef0231427642916c6a2f9bc391c165c21 100644
40c3ae9
--- a/src/providers/data_provider_be.c
40c3ae9
+++ b/src/providers/data_provider_be.c
40c3ae9
@@ -2651,6 +2651,7 @@ fail:
40c3ae9
     return ret;
40c3ae9
 }
40c3ae9
 
40c3ae9
+#ifndef UNIT_TESTING
40c3ae9
 int main(int argc, const char *argv[])
40c3ae9
 {
40c3ae9
     int opt;
40c3ae9
@@ -2732,6 +2733,7 @@ int main(int argc, const char *argv[])
40c3ae9
 
40c3ae9
     return 0;
40c3ae9
 }
40c3ae9
+#endif
40c3ae9
 
40c3ae9
 static int data_provider_res_init(DBusMessage *message,
40c3ae9
                                   struct sbus_connection *conn)
40c3ae9
-- 
40c3ae9
1.8.1.4
40c3ae9