dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0002-tests-Move-N_ELEMENTS-definition-to-tests-common.h.patch

6cf099
From fd554736d9b0e909acfcdf1aa5358423beefbe91 Mon Sep 17 00:00:00 2001
6cf099
From: Jakub Hrozek <jhrozek@redhat.com>
6cf099
Date: Wed, 25 Mar 2015 10:03:43 +0100
6cf099
Subject: [PATCH 02/13] tests: Move N_ELEMENTS definition to tests/common.h
6cf099
MIME-Version: 1.0
6cf099
Content-Type: text/plain; charset=UTF-8
6cf099
Content-Transfer-Encoding: 8bit
6cf099
6cf099
Avoids code duplication
6cf099
6cf099
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
6cf099
---
6cf099
 src/tests/cmocka/test_nested_groups.c | 3 ---
6cf099
 src/tests/cmocka/test_nss_srv.c       | 3 ---
6cf099
 src/tests/common.h                    | 2 ++
6cf099
 src/tests/sbus_codegen_tests.c        | 3 ---
6cf099
 4 files changed, 2 insertions(+), 9 deletions(-)
6cf099
6cf099
diff --git a/src/tests/cmocka/test_nested_groups.c b/src/tests/cmocka/test_nested_groups.c
6cf099
index eef9df2dc25c231cb81243f48b759e2fced1a85d..8081ff26102e53b2e453838c3a18e4560ac5317e 100644
6cf099
--- a/src/tests/cmocka/test_nested_groups.c
6cf099
+++ b/src/tests/cmocka/test_nested_groups.c
6cf099
@@ -48,9 +48,6 @@
6cf099
 #define GROUP_BASE_DN "cn=groups," OBJECT_BASE_DN
6cf099
 #define USER_BASE_DN "cn=users," OBJECT_BASE_DN
6cf099
 
6cf099
-#define N_ELEMENTS(arr) \
6cf099
-    (sizeof(arr) / sizeof(arr[0]))
6cf099
-
6cf099
 struct nested_groups_test_ctx {
6cf099
     struct sss_test_ctx *tctx;
6cf099
 
6cf099
diff --git a/src/tests/cmocka/test_nss_srv.c b/src/tests/cmocka/test_nss_srv.c
6cf099
index d1a4c16851427a36b123f04cecee5fe5ae2d333d..3ab8d39c44a8bb8cacae20f534dcbeb6ca7dec08 100644
6cf099
--- a/src/tests/cmocka/test_nss_srv.c
6cf099
+++ b/src/tests/cmocka/test_nss_srv.c
6cf099
@@ -41,9 +41,6 @@
6cf099
 #define TEST_ID_PROVIDER "ldap"
6cf099
 #define TEST_DOM_SID "S-1-5-21-444379608-1639770488-2995963434"
6cf099
 
6cf099
-#define N_ELEMENTS(arr) \
6cf099
-    (sizeof(arr) / sizeof(arr[0]))
6cf099
-
6cf099
 struct nss_test_ctx {
6cf099
     struct sss_test_ctx *tctx;
6cf099
     struct sss_domain_info *subdom;
6cf099
diff --git a/src/tests/common.h b/src/tests/common.h
6cf099
index 0b351f5d647a8f72bdbc399c6fe02579d4b4e1be..1c6de2c3d6eb924ba7306bd350f8546d61f30751 100644
6cf099
--- a/src/tests/common.h
6cf099
+++ b/src/tests/common.h
6cf099
@@ -30,6 +30,8 @@
6cf099
 #include "providers/data_provider.h"
6cf099
 #include "providers/ldap/sdap.h"
6cf099
 
6cf099
+#define N_ELEMENTS(arr) (sizeof(arr) / sizeof(arr[0]))
6cf099
+
6cf099
 extern TALLOC_CTX *global_talloc_context;
6cf099
 
6cf099
 #define check_leaks(ctx, bytes) _check_leaks((ctx), (bytes), __location__)
6cf099
diff --git a/src/tests/sbus_codegen_tests.c b/src/tests/sbus_codegen_tests.c
6cf099
index 9e9be52e84672eb3ee3afa4e13d5f60047150e98..4637b92b84459041806bb5950e969e988716bec8 100644
6cf099
--- a/src/tests/sbus_codegen_tests.c
6cf099
+++ b/src/tests/sbus_codegen_tests.c
6cf099
@@ -33,9 +33,6 @@
6cf099
 #include "tests/sbus_codegen_tests_generated.h"
6cf099
 #include "util/util_errors.h"
6cf099
 
6cf099
-#define N_ELEMENTS(arr) \
6cf099
-    (sizeof(arr) / sizeof(arr[0]))
6cf099
-
6cf099
 /* The following 2 macros were taken from check's project source files (0.9.10)
6cf099
  * http://check.sourceforge.net/
6cf099
  */
6cf099
-- 
6cf099
2.4.3
6cf099