lib/audit_logging: Remove #ifdef HAVE_JANSSON from audit_logging_test binary
authorAndrew Bartlett <abartlet@samba.org>
Thu, 31 May 2018 18:42:24 +0000 (06:42 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Jun 2018 06:28:26 +0000 (08:28 +0200)
Instead, we either build or do not build the entire binary.

This is much more likely to raise an error in make test if the build system
changes.  The concern is that HAVE_JANSSON can go away and the tests just vanish.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/audit_logging/tests/audit_logging_test.c
lib/audit_logging/wscript_build

index 56e8fbcd43ed926dbbdb6522cc453401d6f42369..6be71f31dbe897e5e8a483aad2f229a3783fd17b 100644 (file)
@@ -59,7 +59,6 @@
 
 #include "lib/audit_logging/audit_logging.h"
 
-#ifdef HAVE_JANSSON
 static void test_json_add_int(void **state)
 {
        struct json_object object;
@@ -490,7 +489,6 @@ static void test_json_to_string(void **state)
        json_free(&object);
        TALLOC_FREE(ctx);
 }
-#endif
 
 static void test_json_get_array(void **state)
 {
@@ -671,7 +669,6 @@ static void test_audit_get_timestamp(void **state)
 int main(int argc, const char **argv)
 {
        const struct CMUnitTest tests[] = {
-#ifdef HAVE_JANSSON
                cmocka_unit_test(test_json_add_int),
                cmocka_unit_test(test_json_add_bool),
                cmocka_unit_test(test_json_add_string),
@@ -686,7 +683,6 @@ int main(int argc, const char **argv)
                cmocka_unit_test(test_json_to_string),
                cmocka_unit_test(test_json_get_array),
                cmocka_unit_test(test_json_get_object),
-#endif
                cmocka_unit_test(test_audit_get_timestamp),
        };
 
index 4022d9031f6231061bc1b5552151bc8db051aa1e..fff683788d6eff350e83e0555e24f444b7052276 100644 (file)
@@ -9,16 +9,17 @@ bld.SAMBA_SUBSYSTEM(
     source='audit_logging.c'
 )
 
-bld.SAMBA_BINARY(
-    'audit_logging_test',
-    source='tests/audit_logging_test.c',
-    deps='''
-        audit_logging
-        jansson
-        cmocka
-        talloc
-        samba-util
-        LIBTSOCKET
-    ''',
-    install=False
-)
+if bld.CONFIG_SET('ENABLE_SELFTEST'):
+    bld.SAMBA_BINARY(
+        'audit_logging_test',
+        source='tests/audit_logging_test.c',
+        deps='''
+             audit_logging
+             jansson
+             cmocka
+             talloc
+             samba-util
+             LIBTSOCKET
+        ''',
+        install=False
+    )