Skip to contentSkip to conversation

Remove stub headers for sepol tests

PATCH New Karl MacMillan 1 participant 1 message May 11, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove stub headers for sepol tests

Currently every test in libsepol requires a stub header to declare functions that are called in exactly one place. This is irritating so we should remove them and define the functions in libsepol-tests.c.

---

19 files changed, 38 insertions(+), 207 deletions(-)
libsepol/tests/libsepol-tests.c |   44 ++++++++++++++++++++++-----------------
libsepol/tests/test-cond.c      |    3 +-
libsepol/tests/test-cond.h      |   30 --------------------------
libsepol/tests/test-deps.c      |    3 +-
libsepol/tests/test-deps.h      |   30 --------------------------
libsepol/tests/test-expander.c  |    3 +-
libsepol/tests/test-expander.h  |   29 -------------------------
libsepol/tests/test-hashtab.c   |    2 -
libsepol/tests/test-hashtab.h   |   12 ----------
libsepol/tests/test-linker.c    |    3 +-
libsepol/tests/test-linker.h    |   30 --------------------------
libsepol/tests/test-list.c      |    2 -
libsepol/tests/test-list.h      |   12 ----------
libsepol/tests/test-objpool.c   |    2 -
libsepol/tests/test-objpool.h   |   12 ----------
libsepol/tests/test-objset.c    |    2 -
libsepol/tests/test-objset.h    |   12 ----------
libsepol/tests/test-policy.c    |    2 -
libsepol/tests/test-policy.h    |   12 ----------
libsepol/tests/libsepol-tests.c +25 -19
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/libsepol-tests.c
@@ -18,16 +18,6 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-cond.h"
-#include "test-linker.h"
-#include "test-expander.h"
-#include "test-deps.h"
-#include "test-list.h"
-#include "test-hashtab.h"
-#include "test-objpool.h"
-#include "test-objset.h"
-#include "test-policy.h"
-
 #include <CUnit/Basic.h>
 #include <CUnit/Console.h>
 #include <CUnit/TestDB.h>
@@ -39,6 +29,22 @@ int mls;
 int mls;
 
 #define DECLARE_SUITE(name) \
+	int name##_test_init(void); \
+	int name##_test_cleanup(void); \
+	int name##_add_tests(CU_pSuite suite); \
+
+DECLARE_SUITE(cond)
+DECLARE_SUITE(linker)
+DECLARE_SUITE(expander)
+DECLARE_SUITE(deps)
+DECLARE_SUITE(list)
+DECLARE_SUITE(hashtab)
+DECLARE_SUITE(objpool)
+DECLARE_SUITE(objset)
+DECLARE_SUITE(policy)
+
+
+#define SETUP_SUITE(name) \
 	suite = CU_add_suite(#name, name##_test_init, name##_test_cleanup); \
 	if (NULL == suite) { \
 		CU_cleanup_registry(); \
@@ -62,15 +68,15 @@ static int do_tests(int interactive, int
 	if (CUE_SUCCESS != CU_initialize_registry())
 		return CU_get_error();
 
-	DECLARE_SUITE(cond);
-	DECLARE_SUITE(linker);
-	DECLARE_SUITE(expander);
-	DECLARE_SUITE(deps);
-	DECLARE_SUITE(list);
-	DECLARE_SUITE(hashtab);
-	DECLARE_SUITE(objpool);
-	DECLARE_SUITE(objset);
-	DECLARE_SUITE(policy);
+	SETUP_SUITE(cond);
+	SETUP_SUITE(linker);
+	SETUP_SUITE(expander);
+	SETUP_SUITE(deps);
+	SETUP_SUITE(list);
+	SETUP_SUITE(hashtab);
+	SETUP_SUITE(objpool);
+	SETUP_SUITE(objset);
+	SETUP_SUITE(policy);
 
 	if (verbose)
 		CU_basic_set_mode(CU_BRM_VERBOSE);
libsepol/tests/test-cond.c +2 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-cond.c
@@ -18,7 +18,8 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-cond.h"
+#include <CUnit/Basic.h>
+
 #include "parse_util.h"
 #include "helpers.h"
 
libsepol/tests/test-cond.h +0 -30
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-cond.h
@@ -1,30 +0,0 @@
-/*
- * Author: Karl MacMillan <[email protected]>
- *
- * Copyright (C) 2006 Tresys Technology, LLC
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef __TEST_COND_H__
-#define __TEST_COND_H__
-
-#include <CUnit/Basic.h>
-
-int cond_test_init(void);
-int cond_test_cleanup(void);
-int cond_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-deps.c +2 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-deps.c
@@ -18,7 +18,8 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-deps.h"
+#include <CUnit/Basic.h>
+
 #include "parse_util.h"
 #include "helpers.h"
 
libsepol/tests/test-deps.h +0 -30
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-deps.h
@@ -1,30 +0,0 @@
-/*
- * Author: Karl MacMillan <[email protected]>
- *
- * Copyright (C) 2006 Tresys Technology, LLC
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef __TEST_DEPS_H__
-#define __TEST_DEPS_H__
-
-#include <CUnit/Basic.h>
-
-int deps_test_init(void);
-int deps_test_cleanup(void);
-int deps_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-expander.c +2 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-expander.c
@@ -30,7 +30,8 @@
  * - check conditional expressions for correct mapping
  */
 
-#include "test-expander.h"
+#include <CUnit/Basic.h>
+
 #include "parse_util.h"
 #include "helpers.h"
 #include "test-common.h"
libsepol/tests/test-expander.h +0 -29
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-expander.h
@@ -1,30 +1,1 @@
-/*
- * Author: Joshua Brindle <[email protected]>
- *
- * Copyright (C) 2006 Tresys Technology, LLC
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
 
-#ifndef __TEST_EXPANDER_H__
-#define __TEST_EXPANDER_H__
-
-#include <CUnit/Basic.h>
-
-int expander_test_init(void);
-int expander_test_cleanup(void);
-int expander_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-hashtab.c +1 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-hashtab.c
@@ -18,7 +18,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-hashtab.h"
+#include <CUnit/Basic.h>
 
 #include <sepol/policydb/hashtab.h>
 #include <sepol/policydb/symtab.h>
libsepol/tests/test-hashtab.h +0 -12
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-hashtab.h
@@ -1,12 +0,0 @@
-/* Author: Karl MacMillan <[email protected]> */
-
-#ifndef __test_hashtab_h__
-#define __test_hashtab_h__
-
-#include <CUnit/Basic.h>
-
-int hashtab_test_init(void);
-int hashtab_test_cleanup(void);
-int hashtab_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-linker.c +2 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-linker.c
@@ -26,7 +26,8 @@
  * - properly add symbols declared in optionals
  */
 
-#include "test-linker.h"
+#include <CUnit/Basic.h>
+
 #include "parse_util.h"
 #include "helpers.h"
 #include "test-common.h"
libsepol/tests/test-linker.h +0 -30
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-linker.h
@@ -1,30 +0,0 @@
-/*
- * Author: Joshua Brindle <[email protected]>
- *
- * Copyright (C) 2006 Tresys Technology, LLC
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License as published by the Free Software Foundation; either
- *  version 2.1 of the License, or (at your option) any later version.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef __TEST_LINKER_H__
-#define __TEST_LINKER_H__
-
-#include <CUnit/Basic.h>
-
-int linker_test_init(void);
-int linker_test_cleanup(void);
-int linker_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-list.c +1 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-list.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-list.h"
+#include <CUnit/Basic.h>
 
 #include <sepol/list.h>
 #include <sepol/iter.h>
libsepol/tests/test-list.h +0 -12
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-list.h
@@ -1,12 +0,0 @@
-/* Author : Karl MacMillan <[email protected]> */
-
-#ifndef __test_list_h__
-#define __test_list_h__
-
-#include <CUnit/Basic.h>
-
-int list_test_init(void);
-int list_test_cleanup(void);
-int list_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-objpool.c +1 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-objpool.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-objpool.h"
+#include <CUnit/Basic.h>
 
 #include <sepol/objpool.h>
 #include <sepol/policydb/symtab.h>
libsepol/tests/test-objpool.h +0 -12
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-objpool.h
@@ -1,12 +0,0 @@
-/* Author : Karl MacMillan <[email protected]> */
-
-#ifndef __test_objpool_h__
-#define __test_objpool_h__
-
-#include <CUnit/Basic.h>
-
-int objpool_test_init(void);
-int objpool_test_cleanup(void);
-int objpool_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-objset.c +1 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-objset.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-objset.h"
+#include <CUnit/Basic.h>
 
 #include <sepol/objset.h>
 #include <sepol/objpool.h>
libsepol/tests/test-objset.h +0 -12
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-objset.h
@@ -1,12 +0,0 @@
-/* Author : Karl MacMillan <[email protected]> */
-
-#ifndef __test_objset_h__
-#define __test_objset_h__
-
-#include <CUnit/Basic.h>
-
-int objset_test_init(void);
-int objset_test_cleanup(void);
-int objset_add_tests(CU_pSuite suite);
-
-#endif
libsepol/tests/test-policy.c +1 -1
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-policy.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include "test-policy.h"
+#include <CUnit/Basic.h>
 
 #include <sepol/policy.h>
 #include <sepol/iter.h>
libsepol/tests/test-policy.h +0 -12
diff -r 78649882a100 -r b6482ea2e0b8 libsepol/tests/test-policy.h
@@ -1,12 +0,0 @@
-/* Author : Karl MacMillan <[email protected]> */
-
-#ifndef __test_policy_h__
-#define __test_policy_h__
-
-#include <CUnit/Basic.h>
-
-int policy_test_init(void);
-int policy_test_cleanup(void);
-int policy_add_tests(CU_pSuite suite);
-
-#endif

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.