All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration
@ 2022-04-14 13:51 James Carter
  2022-04-14 13:51 ` [PATCH 2/5] libsepol/test: Include paired headers for prototypes James Carter
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: James Carter @ 2022-04-14 13:51 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, James Carter

Since test-linker-cond-map.h and test-linker-types.h references
policydb_t, include the policydb header file.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsepol/tests/test-linker-cond-map.h | 2 ++
 libsepol/tests/test-linker-types.h    | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/libsepol/tests/test-linker-cond-map.h b/libsepol/tests/test-linker-cond-map.h
index 148c6f62..740a722e 100644
--- a/libsepol/tests/test-linker-cond-map.h
+++ b/libsepol/tests/test-linker-cond-map.h
@@ -21,6 +21,8 @@
 #ifndef __TEST_LINKER_COND_MAP_H__
 #define __TEST_LINKER_COND_MAP_H__
 
+#include <sepol/policydb/policydb.h>
+
 extern void base_cond_tests(policydb_t * base);
 extern void module_cond_tests(policydb_t * base);
 
diff --git a/libsepol/tests/test-linker-types.h b/libsepol/tests/test-linker-types.h
index 0c860ebf..acad5e0e 100644
--- a/libsepol/tests/test-linker-types.h
+++ b/libsepol/tests/test-linker-types.h
@@ -21,6 +21,8 @@
 #ifndef __TEST_LINKER_TYPES_H__
 #define __TEST_LINKER_TYPES_H__
 
+#include <sepol/policydb/policydb.h>
+
 extern void base_type_tests(policydb_t * base);
 extern void module_type_tests(policydb_t * base);
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] libsepol/test: Include paired headers for prototypes
  2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
@ 2022-04-14 13:51 ` James Carter
  2022-04-14 13:51 ` [PATCH 3/5] libsepol/test: Declare file local functions as static James Carter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: James Carter @ 2022-04-14 13:51 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, James Carter

This is needed to use "-Wmissing-prototypes".

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsepol/tests/test-common.c          | 1 +
 libsepol/tests/test-linker-cond-map.c | 1 +
 libsepol/tests/test-linker-roles.c    | 1 +
 libsepol/tests/test-linker-types.c    | 1 +
 4 files changed, 4 insertions(+)

diff --git a/libsepol/tests/test-common.c b/libsepol/tests/test-common.c
index f690635e..8f2807b2 100644
--- a/libsepol/tests/test-common.c
+++ b/libsepol/tests/test-common.c
@@ -26,6 +26,7 @@
 
 #include <CUnit/Basic.h>
 
+#include "test-common.h"
 #include "helpers.h"
 
 void test_sym_presence(policydb_t * p, const char *id, int sym_type, unsigned int scope_type, unsigned int *decls, unsigned int len)
diff --git a/libsepol/tests/test-linker-cond-map.c b/libsepol/tests/test-linker-cond-map.c
index b02e7881..5400c46b 100644
--- a/libsepol/tests/test-linker-cond-map.c
+++ b/libsepol/tests/test-linker-cond-map.c
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "test-linker-cond-map.h"
 #include "parse_util.h"
 #include "helpers.h"
 #include "test-common.h"
diff --git a/libsepol/tests/test-linker-roles.c b/libsepol/tests/test-linker-roles.c
index 6843252b..2b17dffd 100644
--- a/libsepol/tests/test-linker-roles.c
+++ b/libsepol/tests/test-linker-roles.c
@@ -18,6 +18,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "test-linker-roles.h"
 #include "parse_util.h"
 #include "helpers.h"
 #include "test-common.h"
diff --git a/libsepol/tests/test-linker-types.c b/libsepol/tests/test-linker-types.c
index b41e08e0..048dd422 100644
--- a/libsepol/tests/test-linker-types.c
+++ b/libsepol/tests/test-linker-types.c
@@ -19,6 +19,7 @@
  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "test-linker-types.h"
 #include "parse_util.h"
 #include "helpers.h"
 #include "test-common.h"
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] libsepol/test: Declare file local functions as static
  2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
  2022-04-14 13:51 ` [PATCH 2/5] libsepol/test: Include paired headers for prototypes James Carter
@ 2022-04-14 13:51 ` James Carter
  2022-04-14 13:51 ` [PATCH 4/5] libsemanage/tests: " James Carter
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: James Carter @ 2022-04-14 13:51 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, James Carter

This is needed to use "-Wmissing-prototypes".

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsepol/tests/test-expander.c        | 2 +-
 libsepol/tests/test-linker-cond-map.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libsepol/tests/test-expander.c b/libsepol/tests/test-expander.c
index ee70e220..a9e66ed8 100644
--- a/libsepol/tests/test-expander.c
+++ b/libsepol/tests/test-expander.c
@@ -67,7 +67,7 @@ extern int mls;
 /* Takes base, some number of modules, links them, and expands them
    reads source from myfiles array, which has the base string followed by
    each module string */
-int expander_policy_init(policydb_t * mybase, int num_modules, policydb_t ** mymodules, policydb_t * myexpanded, const char *const *myfiles)
+static int expander_policy_init(policydb_t * mybase, int num_modules, policydb_t ** mymodules, policydb_t * myexpanded, const char *const *myfiles)
 {
 	char *filename[num_modules + 1];
 	int i;
diff --git a/libsepol/tests/test-linker-cond-map.c b/libsepol/tests/test-linker-cond-map.c
index 5400c46b..694a7346 100644
--- a/libsepol/tests/test-linker-cond-map.c
+++ b/libsepol/tests/test-linker-cond-map.c
@@ -55,7 +55,7 @@ typedef struct test_cond_expr {
 	uint32_t expr_type;
 } test_cond_expr_t;
 
-void test_cond_expr_mapping(policydb_t * p, avrule_decl_t * d, test_cond_expr_t * bools, int len)
+static void test_cond_expr_mapping(policydb_t * p, avrule_decl_t * d, test_cond_expr_t * bools, int len)
 {
 	int i;
 	cond_expr_t *expr;
@@ -76,7 +76,7 @@ void test_cond_expr_mapping(policydb_t * p, avrule_decl_t * d, test_cond_expr_t
 	}
 }
 
-void test_bool_state(policydb_t * p, const char *bool, int state)
+static void test_bool_state(policydb_t * p, const char *bool, int state)
 {
 	cond_bool_datum_t *b;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] libsemanage/tests: Declare file local functions as static
  2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
  2022-04-14 13:51 ` [PATCH 2/5] libsepol/test: Include paired headers for prototypes James Carter
  2022-04-14 13:51 ` [PATCH 3/5] libsepol/test: Declare file local functions as static James Carter
@ 2022-04-14 13:51 ` James Carter
  2022-04-14 13:51 ` [PATCH 5/5] libsemanage/tests: Remove unused functions James Carter
  2022-04-20 18:54 ` [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration Petr Lautrbach
  4 siblings, 0 replies; 7+ messages in thread
From: James Carter @ 2022-04-14 13:51 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, James Carter

This is needed to use "-Wmissing-prototypes".

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsemanage/tests/test_bool.c      | 118 +++++++++++++--------------
 libsemanage/tests/test_fcontext.c  | 126 ++++++++++++++---------------
 libsemanage/tests/test_handle.c    |  54 ++++++-------
 libsemanage/tests/test_ibendport.c |  60 +++++++-------
 libsemanage/tests/test_iface.c     |  88 ++++++++++----------
 libsemanage/tests/test_node.c      | 104 ++++++++++++------------
 libsemanage/tests/test_port.c      | 114 +++++++++++++-------------
 libsemanage/tests/test_user.c      |  96 +++++++++++-----------
 libsemanage/tests/test_utilities.c |  41 +++++-----
 libsemanage/tests/utilities.c      |   2 +-
 10 files changed, 402 insertions(+), 401 deletions(-)

diff --git a/libsemanage/tests/test_bool.c b/libsemanage/tests/test_bool.c
index 7bf5225b..672544bb 100644
--- a/libsemanage/tests/test_bool.c
+++ b/libsemanage/tests/test_bool.c
@@ -31,29 +31,29 @@
 #define BOOL_NONEXISTENT "asdf"
 
 /* boolean_record.h */
-void test_bool_key_create(void);
-void test_bool_key_extract(void);
-void test_bool_compare(void);
-void test_bool_compare2(void);
-void test_bool_get_set_name(void);
-void test_bool_get_set_value(void);
-void test_bool_create(void);
-void test_bool_clone(void);
+static void test_bool_key_create(void);
+static void test_bool_key_extract(void);
+static void test_bool_compare(void);
+static void test_bool_compare2(void);
+static void test_bool_get_set_name(void);
+static void test_bool_get_set_value(void);
+static void test_bool_create(void);
+static void test_bool_clone(void);
 
 /* booleans_policy.h */
-void test_bool_query(void);
-void test_bool_exists(void);
-void test_bool_count(void);
-void test_bool_iterate(void);
-void test_bool_list(void);
+static void test_bool_query(void);
+static void test_bool_exists(void);
+static void test_bool_count(void);
+static void test_bool_iterate(void);
+static void test_bool_list(void);
 
 /* booleans_local.h */
-void test_bool_modify_del_local(void);
-void test_bool_query_local(void);
-void test_bool_exists_local(void);
-void test_bool_count_local(void);
-void test_bool_iterate_local(void);
-void test_bool_list_local(void);
+static void test_bool_modify_del_local(void);
+static void test_bool_query_local(void);
+static void test_bool_exists_local(void);
+static void test_bool_count_local(void);
+static void test_bool_iterate_local(void);
+static void test_bool_list_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -111,7 +111,7 @@ int bool_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_bool_t *get_bool_nth(int idx)
+static semanage_bool_t *get_bool_nth(int idx)
 {
 	int res;
 	semanage_bool_t **records;
@@ -137,7 +137,7 @@ semanage_bool_t *get_bool_nth(int idx)
 	return boolean;
 }
 
-semanage_bool_t *get_bool_new(void)
+static semanage_bool_t *get_bool_new(void)
 {
 	int res;
 	semanage_bool_t *boolean;
@@ -149,7 +149,7 @@ semanage_bool_t *get_bool_new(void)
 	return boolean;
 }
 
-semanage_bool_key_t *get_bool_key_nth(int idx)
+static semanage_bool_key_t *get_bool_key_nth(int idx)
 {
 	semanage_bool_key_t *key;
 	semanage_bool_t *boolean;
@@ -170,7 +170,7 @@ semanage_bool_key_t *get_bool_key_nth(int idx)
 	return key;
 }
 
-semanage_bool_key_t *get_bool_key_from_str(const char *str)
+static semanage_bool_key_t *get_bool_key_from_str(const char *str)
 {
 	semanage_bool_key_t *key;
 	int res;
@@ -186,7 +186,7 @@ semanage_bool_key_t *get_bool_key_from_str(const char *str)
 	return key;
 }
 
-void add_local_bool(const char *name)
+static void add_local_bool(const char *name)
 {
 	semanage_bool_t *boolean;
 	semanage_bool_key_t *key = NULL;
@@ -205,7 +205,7 @@ void add_local_bool(const char *name)
 	semanage_bool_free(boolean);
 }
 
-void delete_local_bool(const char *name)
+static void delete_local_bool(const char *name)
 {
 	semanage_bool_key_t *key = NULL;
 
@@ -221,7 +221,7 @@ void delete_local_bool(const char *name)
 
 /* Function bool_key_create */
 
-void helper_bool_key_create(level_t level)
+static void helper_bool_key_create(level_t level)
 {
 	semanage_bool_key_t *key = NULL;
 
@@ -253,7 +253,7 @@ void test_bool_key_create(void)
 #define SK_NEW 2
 #define SK_INDEX 3
 #define SK_KEY_NULL 4
-void helper_bool_key_extract(level_t level, int mode)
+static void helper_bool_key_extract(level_t level, int mode)
 {
 	semanage_bool_t *boolean = NULL;
 	semanage_bool_key_t *key = NULL;
@@ -306,7 +306,7 @@ void test_bool_key_extract(void)
 #undef SK_KEY_NULL
 
 /* Function bool_compare */
-void helper_bool_compare(level_t level, int bool_idx1, int bool_idx2)
+static void helper_bool_compare(level_t level, int bool_idx1, int bool_idx2)
 {
 	semanage_bool_t *boolean;
 	semanage_bool_key_t *key;
@@ -330,7 +330,7 @@ void helper_bool_compare(level_t level, int bool_idx1, int bool_idx2)
 	cleanup_handle(level);
 }
 
-void test_bool_compare(void)
+static void test_bool_compare(void)
 {
 	helper_bool_compare(SH_CONNECT, I_FIRST,  I_FIRST);
 	helper_bool_compare(SH_CONNECT, I_FIRST,  I_SECOND);
@@ -344,7 +344,7 @@ void test_bool_compare(void)
 }
 
 /* Function bool_compare2 */
-void helper_bool_compare2(level_t level, int bool_idx1, int bool_idx2)
+static void helper_bool_compare2(level_t level, int bool_idx1, int bool_idx2)
 {
 	semanage_bool_t *bool1;
 	semanage_bool_t *bool2;
@@ -368,7 +368,7 @@ void helper_bool_compare2(level_t level, int bool_idx1, int bool_idx2)
 	cleanup_handle(level);
 }
 
-void test_bool_compare2(void)
+static void test_bool_compare2(void)
 {
 	helper_bool_compare2(SH_CONNECT, I_FIRST,  I_FIRST);
 	helper_bool_compare2(SH_CONNECT, I_FIRST,  I_SECOND);
@@ -382,7 +382,7 @@ void test_bool_compare2(void)
 }
 
 /* Function bool_get_name, bool_set_name */
-void helper_bool_get_set_name(level_t level, int bool_idx, const char *name)
+static void helper_bool_get_set_name(level_t level, int bool_idx, const char *name)
 {
 	semanage_bool_t *boolean;
 	const char *new_name = NULL;
@@ -404,7 +404,7 @@ void helper_bool_get_set_name(level_t level, int bool_idx, const char *name)
 	cleanup_handle(level);
 }
 
-void test_bool_get_set_name(void)
+static void test_bool_get_set_name(void)
 {
 	helper_bool_get_set_name(SH_CONNECT, I_FIRST, "testbool");
 	helper_bool_get_set_name(SH_CONNECT, I_FIRST, "");
@@ -418,7 +418,7 @@ void test_bool_get_set_name(void)
 }
 
 /* Function bool_get_value, bool_set_value */
-void helper_bool_get_set_value(int bool_idx, int val)
+static void helper_bool_get_set_value(int bool_idx, int val)
 {
 	semanage_bool_t *boolean;
 	int new_val = 0;
@@ -436,7 +436,7 @@ void helper_bool_get_set_value(int bool_idx, int val)
 	semanage_bool_free(boolean);
 }
 
-void test_bool_get_set_value(void)
+static void test_bool_get_set_value(void)
 {
 	helper_bool_get_set_value(I_FIRST, 1);
 	helper_bool_get_set_value(I_FIRST, 0);
@@ -445,7 +445,7 @@ void test_bool_get_set_value(void)
 }
 
 /* Function bool_create */
-void helper_bool_create(level_t level)
+static void helper_bool_create(level_t level)
 {
 	semanage_bool_t *boolean;
 
@@ -461,7 +461,7 @@ void helper_bool_create(level_t level)
 	cleanup_handle(level);
 }
 
-void test_bool_create(void)
+static void test_bool_create(void)
 {
 	helper_bool_create(SH_HANDLE);
 	helper_bool_create(SH_CONNECT);
@@ -469,7 +469,7 @@ void test_bool_create(void)
 }
 
 /* Function bool_clone */
-void helper_bool_clone(level_t level, int bool_idx)
+static void helper_bool_clone(level_t level, int bool_idx)
 {
 	semanage_bool_t *boolean;
 	semanage_bool_t *boolean_clone;
@@ -500,7 +500,7 @@ void helper_bool_clone(level_t level, int bool_idx)
 	cleanup_handle(level);
 }
 
-void test_bool_clone(void)
+static void test_bool_clone(void)
 {
 	helper_bool_clone(SH_CONNECT, I_FIRST);
 	helper_bool_clone(SH_CONNECT, I_SECOND);
@@ -510,7 +510,7 @@ void test_bool_clone(void)
 }
 
 /* Function bool_query */
-void helper_bool_query(level_t level, const char *bool_str, int exp_res)
+static void helper_bool_query(level_t level, const char *bool_str, int exp_res)
 {
 	semanage_bool_key_t *key;
 	semanage_bool_t *resp = (void *) 42;
@@ -534,7 +534,7 @@ void helper_bool_query(level_t level, const char *bool_str, int exp_res)
 	cleanup_handle(level);
 }
 
-void test_bool_query(void)
+static void test_bool_query(void)
 {
 	helper_bool_query(SH_CONNECT, BOOL1_NAME,  1);
 	helper_bool_query(SH_CONNECT, BOOL2_NAME, 1);
@@ -546,7 +546,7 @@ void test_bool_query(void)
 }
 
 /* Function bool_exists */
-void helper_bool_exists(level_t level, const char *bool_str, int exp_resp)
+static void helper_bool_exists(level_t level, const char *bool_str, int exp_resp)
 {
 	semanage_bool_key_t *key;
 	int resp;
@@ -563,7 +563,7 @@ void helper_bool_exists(level_t level, const char *bool_str, int exp_resp)
 	cleanup_handle(level);
 }
 
-void test_bool_exists(void)
+static void test_bool_exists(void)
 {
 	helper_bool_exists(SH_CONNECT, BOOL1_NAME,  1);
 	helper_bool_exists(SH_CONNECT, BOOL2_NAME, 1);
@@ -575,7 +575,7 @@ void test_bool_exists(void)
 }
 
 /* Function bool_count */
-void test_bool_count(void)
+static void test_bool_count(void)
 {
 	unsigned int resp;
 
@@ -603,13 +603,13 @@ void test_bool_count(void)
 /* Function bool_iterate */
 unsigned int counter_bool_iterate = 0;
 
-int handler_bool_iterate(const semanage_bool_t *record, void *varg)
+static int handler_bool_iterate(const semanage_bool_t *record, void *varg)
 {
 	counter_bool_iterate++;
 	return 0;
 }
 
-void helper_bool_iterate_invalid(void)
+static void helper_bool_iterate_invalid(void)
 {
 	setup_handle(SH_HANDLE);
 	CU_ASSERT(semanage_bool_iterate(sh, &handler_bool_iterate, NULL) < 0);
@@ -617,7 +617,7 @@ void helper_bool_iterate_invalid(void)
 	cleanup_handle(SH_HANDLE);
 }
 
-void helper_bool_iterate(level_t level)
+static void helper_bool_iterate(level_t level)
 {
 	setup_handle(level);
 	counter_bool_iterate = 0;
@@ -626,7 +626,7 @@ void helper_bool_iterate(level_t level)
 	cleanup_handle(level);
 }
 
-void test_bool_iterate(void)
+static void test_bool_iterate(void)
 {
 	helper_bool_iterate_invalid();
 	helper_bool_iterate(SH_CONNECT);
@@ -634,7 +634,7 @@ void test_bool_iterate(void)
 }
 
 /* Function bool_list */
-void helper_bool_list_invalid(void)
+static void helper_bool_list_invalid(void)
 {
 	semanage_bool_t **records;
 	unsigned int count;
@@ -648,7 +648,7 @@ void helper_bool_list_invalid(void)
 	cleanup_handle(SH_HANDLE);
 }
 
-void helper_bool_list(level_t level)
+static void helper_bool_list(level_t level)
 {
 	semanage_bool_t **records;
 	unsigned int count;
@@ -669,7 +669,7 @@ void helper_bool_list(level_t level)
 	cleanup_handle(level);
 }
 
-void test_bool_list(void)
+static void test_bool_list(void)
 {
 	helper_bool_list_invalid();
 	helper_bool_list(SH_CONNECT);
@@ -677,7 +677,7 @@ void test_bool_list(void)
 }
 
 /* Function bool_modify_local, bool_del_local */
-void helper_bool_modify_del_local(level_t level, const char *name,
+static void helper_bool_modify_del_local(level_t level, const char *name,
 				  int old_val, int exp_res)
 {
 	semanage_bool_t *boolean;
@@ -729,7 +729,7 @@ void helper_bool_modify_del_local(level_t level, const char *name,
 	cleanup_handle(level);
 }
 
-void test_bool_modify_del_local(void)
+static void test_bool_modify_del_local(void)
 {
 	helper_bool_modify_del_local(SH_CONNECT, BOOL1_NAME, BOOL1_VALUE, -1);
 	helper_bool_modify_del_local(SH_CONNECT, BOOL2_NAME, BOOL2_VALUE, -1);
@@ -738,7 +738,7 @@ void test_bool_modify_del_local(void)
 }
 
 /* Function bool_query_local */
-void test_bool_query_local(void)
+static void test_bool_query_local(void)
 {
 	semanage_bool_key_t *key = NULL;
 	semanage_bool_t *resp = NULL;
@@ -785,7 +785,7 @@ void test_bool_query_local(void)
 }
 
 /* Function bool_exists_local */
-void test_bool_exists_local(void)
+static void test_bool_exists_local(void)
 {
 	int resp = -1;
 	semanage_bool_key_t *key;
@@ -815,7 +815,7 @@ void test_bool_exists_local(void)
 }
 
 /* Function bool_count_local */
-void test_bool_count_local(void)
+static void test_bool_count_local(void)
 {
 	unsigned int resp;
 	unsigned int init_count;
@@ -859,13 +859,13 @@ void test_bool_count_local(void)
 /* Function bool_iterate_local */
 unsigned int counter_bool_iterate_local = 0;
 
-int handler_bool_iterate_local(const semanage_bool_t *record, void *varg)
+static int handler_bool_iterate_local(const semanage_bool_t *record, void *varg)
 {
 	counter_bool_iterate_local++;
 	return 0;
 }
 
-void test_bool_iterate_local(void)
+static void test_bool_iterate_local(void)
 {
 	unsigned int init_count;
 
@@ -912,7 +912,7 @@ void test_bool_iterate_local(void)
 }
 
 /* Function bool_list_local */
-void test_bool_list_local(void)
+static void test_bool_list_local(void)
 {
 	semanage_bool_t **records;
 	unsigned int count;
diff --git a/libsemanage/tests/test_fcontext.c b/libsemanage/tests/test_fcontext.c
index a5fcf849..5104989e 100644
--- a/libsemanage/tests/test_fcontext.c
+++ b/libsemanage/tests/test_fcontext.c
@@ -45,35 +45,35 @@ unsigned int FCONTEXTS_LEN = sizeof(FCONTEXTS);
 #define FCONTEXT_NONEXISTENT_TYPE SEMANAGE_FCONTEXT_ALL
 
 /* fcontext_record.h */
-void test_fcontext_compare(void);
-void test_fcontext_compare2(void);
-void test_fcontext_key_create(void);
-void test_fcontext_key_extract(void);
-void test_fcontext_get_set_expr(void);
-void test_fcontext_get_set_type(void);
-void test_fcontext_get_type_str(void);
-void test_fcontext_get_set_con(void);
-void test_fcontext_create(void);
-void test_fcontext_clone(void);
+static void test_fcontext_compare(void);
+static void test_fcontext_compare2(void);
+static void test_fcontext_key_create(void);
+static void test_fcontext_key_extract(void);
+static void test_fcontext_get_set_expr(void);
+static void test_fcontext_get_set_type(void);
+static void test_fcontext_get_type_str(void);
+static void test_fcontext_get_set_con(void);
+static void test_fcontext_create(void);
+static void test_fcontext_clone(void);
 
 /* fcontext_policy.h */
-void test_fcontext_query(void);
-void test_fcontext_exists(void);
-void test_fcontext_count(void);
-void test_fcontext_iterate(void);
-void test_fcontext_list(void);
+static void test_fcontext_query(void);
+static void test_fcontext_exists(void);
+static void test_fcontext_count(void);
+static void test_fcontext_iterate(void);
+static void test_fcontext_list(void);
 
 /* fcontext_local.h */
-void test_fcontext_modify_del_local(void);
-void test_fcontext_query_local(void);
-void test_fcontext_exists_local(void);
-void test_fcontext_count_local(void);
-void test_fcontext_iterate_local(void);
-void test_fcontext_list_local(void);
+static void test_fcontext_modify_del_local(void);
+static void test_fcontext_query_local(void);
+static void test_fcontext_exists_local(void);
+static void test_fcontext_count_local(void);
+static void test_fcontext_iterate_local(void);
+static void test_fcontext_list_local(void);
 
 extern semanage_handle_t *sh;
 
-int get_type(char *t)
+static int get_type(char *t)
 {
 	if (strcmp(t, "--") == 0)
 		return SEMANAGE_FCONTEXT_ALL;
@@ -95,7 +95,7 @@ int get_type(char *t)
 		return -1;
 }
 
-int write_file_contexts(const char *data, unsigned int data_len)
+static int write_file_contexts(const char *data, unsigned int data_len)
 {
 	FILE *fptr = fopen("test-policy/store/active/file_contexts", "w+");
 
@@ -187,7 +187,7 @@ int fcontext_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_fcontext_t *get_fcontext_new(void)
+static semanage_fcontext_t *get_fcontext_new(void)
 {
 	semanage_fcontext_t *fcontext;
 
@@ -196,7 +196,7 @@ semanage_fcontext_t *get_fcontext_new(void)
 	return fcontext;
 }
 
-semanage_fcontext_t *get_fcontext_nth(int idx)
+static semanage_fcontext_t *get_fcontext_nth(int idx)
 {
 	semanage_fcontext_t **records;
 	semanage_fcontext_t *fcontext;
@@ -219,7 +219,7 @@ semanage_fcontext_t *get_fcontext_nth(int idx)
 	return fcontext;
 }
 
-semanage_fcontext_key_t *get_fcontext_key_nth(int idx)
+static semanage_fcontext_key_t *get_fcontext_key_nth(int idx)
 {
 	semanage_fcontext_key_t *key;
 	semanage_fcontext_t *fcontext;
@@ -237,7 +237,7 @@ semanage_fcontext_key_t *get_fcontext_key_nth(int idx)
 	return key;
 }
 
-void add_local_fcontext(int fcontext_idx)
+static void add_local_fcontext(int fcontext_idx)
 {
 	semanage_fcontext_t *fcontext;
 	semanage_fcontext_key_t *key = NULL;
@@ -256,7 +256,7 @@ void add_local_fcontext(int fcontext_idx)
 	semanage_fcontext_free(fcontext);
 }
 
-void delete_local_fcontext(int fcontext_idx)
+static void delete_local_fcontext(int fcontext_idx)
 {
 	semanage_fcontext_key_t *key = NULL;
 
@@ -269,7 +269,7 @@ void delete_local_fcontext(int fcontext_idx)
 	semanage_fcontext_key_free(key);
 }
 
-semanage_fcontext_key_t *get_fcontext_key_from_str(const char *str, int type)
+static semanage_fcontext_key_t *get_fcontext_key_from_str(const char *str, int type)
 {
 	semanage_fcontext_key_t *key;
 	int res;
@@ -286,7 +286,7 @@ semanage_fcontext_key_t *get_fcontext_key_from_str(const char *str, int type)
 }
 
 /* Function semanage_fcontext_compare */
-void test_fcontext_compare(void)
+static void test_fcontext_compare(void)
 {
 	semanage_fcontext_t *fcontext;
 	semanage_fcontext_key_t *key1;
@@ -316,7 +316,7 @@ void test_fcontext_compare(void)
 }
 
 /* Function semanage_fcontext_compare2 */
-void test_fcontext_compare2(void)
+static void test_fcontext_compare2(void)
 {
 	semanage_fcontext_t *fcontext;
 	semanage_fcontext_t *fcontext1;
@@ -345,7 +345,7 @@ void test_fcontext_compare2(void)
 }
 
 /* Function semanage_fcontext_key_create */
-void test_fcontext_key_create(void)
+static void test_fcontext_key_create(void)
 {
 	semanage_fcontext_key_t *key = NULL;
 
@@ -372,7 +372,7 @@ void test_fcontext_key_create(void)
 }
 
 /* Function semanage_fcontext_key_extract */
-void test_fcontext_key_extract(void)
+static void test_fcontext_key_extract(void)
 {
 	semanage_fcontext_t *fcontext;
 	semanage_fcontext_key_t *key;
@@ -392,7 +392,7 @@ void test_fcontext_key_extract(void)
 }
 
 /* Function semanage_fcontext_get_expr, semanage_fcontext_set_expr */
-void test_fcontext_get_set_expr(void)
+static void test_fcontext_get_set_expr(void)
 {
 	semanage_fcontext_t *fcontext;
 	const char *expr = NULL;
@@ -415,7 +415,7 @@ void test_fcontext_get_set_expr(void)
 }
 
 /* Function semanage_fcontext_get_type, semanage_fcontext_set_type */
-void test_fcontext_get_set_type(void)
+static void test_fcontext_get_set_type(void)
 {
 	semanage_fcontext_t *fcontext;
 	int type_exp = SEMANAGE_FCONTEXT_SOCK;
@@ -436,12 +436,12 @@ void test_fcontext_get_set_type(void)
 }
 
 /* Function semanage_fcontext_get_type_str */
-void helper_fcontext_get_type_str(int type, const char *exp_str)
+static void helper_fcontext_get_type_str(int type, const char *exp_str)
 {
 	CU_ASSERT_STRING_EQUAL(semanage_fcontext_get_type_str(type), exp_str);
 }
 
-void test_fcontext_get_type_str(void)
+static void test_fcontext_get_type_str(void)
 {
 	helper_fcontext_get_type_str(SEMANAGE_FCONTEXT_ALL, "all files");
 	helper_fcontext_get_type_str(SEMANAGE_FCONTEXT_REG, "regular file");
@@ -458,7 +458,7 @@ void test_fcontext_get_type_str(void)
 }
 
 /* Function semanage_fcontext_get_con, semanage_fcontext_set_con */
-void helper_fcontext_get_set_con(level_t level, int fcontext_idx,
+static void helper_fcontext_get_set_con(level_t level, int fcontext_idx,
 				 const char *con_str)
 {
 	semanage_fcontext_t *fcontext;
@@ -492,7 +492,7 @@ void helper_fcontext_get_set_con(level_t level, int fcontext_idx,
 	cleanup_handle(level);
 }
 
-void test_fcontext_get_set_con(void)
+static void test_fcontext_get_set_con(void)
 {
 	helper_fcontext_get_set_con(SH_CONNECT, I_FIRST, NULL);
 	helper_fcontext_get_set_con(SH_CONNECT, I_FIRST,
@@ -507,7 +507,7 @@ void test_fcontext_get_set_con(void)
 }
 
 /* Function semanage_fcontext_create */
-void helper_fcontext_create(level_t level)
+static void helper_fcontext_create(level_t level)
 {
 	semanage_fcontext_t *fcontext;
 
@@ -526,7 +526,7 @@ void helper_fcontext_create(level_t level)
 	cleanup_handle(level);
 }
 
-void test_fcontext_create(void)
+static void test_fcontext_create(void)
 {
 	helper_fcontext_create(SH_NULL);
 	helper_fcontext_create(SH_HANDLE);
@@ -535,7 +535,7 @@ void test_fcontext_create(void)
 }
 
 /* Function semanage_fcontext_clone */
-void helper_fcontext_clone(level_t level, int fcontext_idx)
+static void helper_fcontext_clone(level_t level, int fcontext_idx)
 {
 	semanage_fcontext_t *fcontext;
 	semanage_fcontext_t *fcontext_clone;
@@ -571,7 +571,7 @@ void helper_fcontext_clone(level_t level, int fcontext_idx)
 	cleanup_handle(level);
 }
 
-void test_fcontext_clone(void)
+static void test_fcontext_clone(void)
 {
 	helper_fcontext_clone(SH_CONNECT, I_FIRST);
 	helper_fcontext_clone(SH_CONNECT, I_SECOND);
@@ -580,7 +580,7 @@ void test_fcontext_clone(void)
 }
 
 /* Function semanage_fcontext_query */
-void helper_fcontext_query(level_t level, const char *fcontext_expr,
+static void helper_fcontext_query(level_t level, const char *fcontext_expr,
 			   int fcontext_type, int exp_res)
 {
 	semanage_fcontext_key_t *key;
@@ -609,7 +609,7 @@ void helper_fcontext_query(level_t level, const char *fcontext_expr,
 	cleanup_handle(level);
 }
 
-void test_fcontext_query(void)
+static void test_fcontext_query(void)
 {
 	helper_fcontext_query(SH_CONNECT, FCONTEXT_NONEXISTENT_EXPR,
 			      FCONTEXT_NONEXISTENT_TYPE, -1);
@@ -624,7 +624,7 @@ void test_fcontext_query(void)
 }
 
 /* Function semanage_fcontext_exists */
-void helper_fcontext_exists(level_t level, const char *fcontext_expr,
+static void helper_fcontext_exists(level_t level, const char *fcontext_expr,
 			    int fcontext_type, int exp_resp)
 {
 	semanage_fcontext_key_t *key;
@@ -643,7 +643,7 @@ void helper_fcontext_exists(level_t level, const char *fcontext_expr,
 	cleanup_handle(level);
 }
 
-void test_fcontext_exists(void)
+static void test_fcontext_exists(void)
 {
 	helper_fcontext_exists(SH_CONNECT, FCONTEXT_NONEXISTENT_EXPR,
 			       FCONTEXT_NONEXISTENT_TYPE, 0);
@@ -658,7 +658,7 @@ void test_fcontext_exists(void)
 }
 
 /* Function semanage_fcontext_count */
-void test_fcontext_count(void)
+static void test_fcontext_count(void)
 {
 	unsigned int resp;
 
@@ -686,14 +686,14 @@ void test_fcontext_count(void)
 /* Function semanage_fcontext_iterate */
 unsigned int counter_fcontext_iterate = 0;
 
-int handler_fcontext_iterate(const semanage_fcontext_t *record, void *varg)
+static int handler_fcontext_iterate(const semanage_fcontext_t *record, void *varg)
 {
 	CU_ASSERT_PTR_NOT_NULL(record);
 	counter_fcontext_iterate++;
 	return 0;
 }
 
-void helper_fcontext_iterate_invalid(void)
+static void helper_fcontext_iterate_invalid(void)
 {
 	/* setup */
 	setup_handle(SH_HANDLE);
@@ -707,7 +707,7 @@ void helper_fcontext_iterate_invalid(void)
 	cleanup_handle(SH_HANDLE);
 }
 
-void helper_fcontext_iterate(level_t level)
+static void helper_fcontext_iterate(level_t level)
 {
 	/* setup */
 	setup_handle(level);
@@ -722,7 +722,7 @@ void helper_fcontext_iterate(level_t level)
 	cleanup_handle(level);
 }
 
-void test_fcontext_iterate(void)
+static void test_fcontext_iterate(void)
 {
 	helper_fcontext_iterate_invalid();
 	helper_fcontext_iterate(SH_CONNECT);
@@ -730,7 +730,7 @@ void test_fcontext_iterate(void)
 }
 
 /* Function semanage_fcontext_list */
-void helper_fcontext_list_invalid(void)
+static void helper_fcontext_list_invalid(void)
 {
 	semanage_fcontext_t **records;
 	unsigned int count;
@@ -747,7 +747,7 @@ void helper_fcontext_list_invalid(void)
 	cleanup_handle(SH_HANDLE);
 }
 
-void helper_fcontext_list(level_t level)
+static void helper_fcontext_list(level_t level)
 {
 	semanage_fcontext_t **records;
 	unsigned int count;
@@ -771,7 +771,7 @@ void helper_fcontext_list(level_t level)
 	cleanup_handle(level);
 }
 
-void test_fcontext_list(void)
+static void test_fcontext_list(void)
 {
 	helper_fcontext_list_invalid();
 	helper_fcontext_list(SH_CONNECT);
@@ -779,7 +779,7 @@ void test_fcontext_list(void)
 }
 
 /* Function semanage_fcontext_modify_local, semanage_fcontext_del_local */
-void helper_fcontext_modify_del_local(level_t level, int fcontext_idx,
+static void helper_fcontext_modify_del_local(level_t level, int fcontext_idx,
 				      const char *con_str, int exp_res)
 {
 	semanage_fcontext_t *fcontext;
@@ -834,7 +834,7 @@ void helper_fcontext_modify_del_local(level_t level, int fcontext_idx,
 	cleanup_handle(level);
 }
 
-void test_fcontext_modify_del_local(void)
+static void test_fcontext_modify_del_local(void)
 {
 	helper_fcontext_modify_del_local(SH_CONNECT, I_FIRST,
 					 "system_u:object_r:tmp_t:s0", -1);
@@ -847,7 +847,7 @@ void test_fcontext_modify_del_local(void)
 }
 
 /* Function semanage_fcontext_query_local */
-void test_fcontext_query_local(void)
+static void test_fcontext_query_local(void)
 {
 	semanage_fcontext_key_t *key = NULL;
 	semanage_fcontext_t *resp = NULL;
@@ -891,7 +891,7 @@ void test_fcontext_query_local(void)
 }
 
 /* Function semanage_fcontext_exists_local */
-void test_fcontext_exists_local(void)
+static void test_fcontext_exists_local(void)
 {
 	int resp = -1;
 	semanage_fcontext_key_t *key;
@@ -927,7 +927,7 @@ void test_fcontext_exists_local(void)
 }
 
 /* Function semanage_fcontext_count_local */
-void test_fcontext_count_local(void)
+static void test_fcontext_count_local(void)
 {
 	unsigned int resp;
 
@@ -967,7 +967,7 @@ void test_fcontext_count_local(void)
 /* Function semanage_fcontext_iterate_local */
 unsigned int counter_fcontext_iterate_local = 0;
 
-int handler_fcontext_iterate_local(const semanage_fcontext_t *record,
+static int handler_fcontext_iterate_local(const semanage_fcontext_t *record,
 				   void *varg)
 {
 	CU_ASSERT_PTR_NOT_NULL(record);
@@ -975,7 +975,7 @@ int handler_fcontext_iterate_local(const semanage_fcontext_t *record,
 	return 0;
 }
 
-void test_fcontext_iterate_local(void)
+static void test_fcontext_iterate_local(void)
 {
 	/* handle */
 	setup_handle(SH_HANDLE);
@@ -1024,7 +1024,7 @@ void test_fcontext_iterate_local(void)
 }
 
 /* Function semanage_fcontext_list_local */
-void test_fcontext_list_local(void)
+static void test_fcontext_list_local(void)
 {
 	semanage_fcontext_t **records;
 	unsigned int count;
diff --git a/libsemanage/tests/test_handle.c b/libsemanage/tests/test_handle.c
index 2fab29be..00a6cb92 100644
--- a/libsemanage/tests/test_handle.c
+++ b/libsemanage/tests/test_handle.c
@@ -21,18 +21,18 @@
 #include "utilities.h"
 #include "test_handle.h"
 
-void test_handle_create(void);
-void test_connect(void);
-void test_disconnect(void);
-void test_transaction(void);
-void test_commit(void);
-void test_is_connected(void);
-void test_access_check(void);
-void test_is_managed(void);
-void test_mls_enabled(void);
-void test_msg_set_callback(void);
-void test_root(void);
-void test_select_store(void);
+static void test_handle_create(void);
+static void test_connect(void);
+static void test_disconnect(void);
+static void test_transaction(void);
+static void test_commit(void);
+static void test_is_connected(void);
+static void test_access_check(void);
+static void test_is_managed(void);
+static void test_mls_enabled(void);
+static void test_msg_set_callback(void);
+static void test_root(void);
+static void test_select_store(void);
 
 extern semanage_handle_t *sh;
 
@@ -80,7 +80,7 @@ int handle_add_tests(CU_pSuite suite)
 }
 
 /* Function semanage_handle_create */
-void test_handle_create(void)
+static void test_handle_create(void)
 {
 	sh = semanage_handle_create();
 	CU_ASSERT_PTR_NOT_NULL(sh);
@@ -88,7 +88,7 @@ void test_handle_create(void)
 }
 
 /* Function semanage_connect */
-void test_connect(void)
+static void test_connect(void)
 {
 	/* test handle created */
 	setup_handle(SH_HANDLE);
@@ -109,7 +109,7 @@ void test_connect(void)
 }
 
 /* Function semanage_disconnect */
-void test_disconnect(void)
+static void test_disconnect(void)
 {
 	setup_handle(SH_CONNECT);
 	CU_ASSERT(semanage_disconnect(sh) >= 0);
@@ -117,7 +117,7 @@ void test_disconnect(void)
 }
 
 /* Function semanage_begin_transaction */
-void test_transaction(void)
+static void test_transaction(void)
 {
 	/* test disconnected */
 	setup_handle(SH_CONNECT);
@@ -135,7 +135,7 @@ void test_transaction(void)
 }
 
 /* Function semanage_commit */
-void test_commit(void)
+static void test_commit(void)
 {
 	/* test without transaction */
 	setup_handle(SH_CONNECT);
@@ -149,7 +149,7 @@ void test_commit(void)
 }
 
 /* Function semanage_is_connected */
-void test_is_connected(void)
+static void test_is_connected(void)
 {
 	/* test disconnected */
 	setup_handle(SH_HANDLE);
@@ -167,7 +167,7 @@ void test_is_connected(void)
 }
 
 /* Function semanage_access_check */
-void test_access_check(void)
+static void test_access_check(void)
 {
 	int res = 0;
 
@@ -192,7 +192,7 @@ void test_access_check(void)
 }
 
 /* Function semanage_is_managed */
-void test_is_managed(void)
+static void test_is_managed(void)
 {
 	int res = 0;
 
@@ -210,7 +210,7 @@ void test_is_managed(void)
 }
 
 /* Function semanage_mls_enabled */
-void test_mls_enabled(void)
+static void test_mls_enabled(void)
 {
 	int res = 0;
 
@@ -236,13 +236,13 @@ void test_mls_enabled(void)
 /* Function semanage_set_callback */
 int msg_set_callback_count = 0;
 
-void helper_msg_set_callback(void *varg, semanage_handle_t *handle,
+static void helper_msg_set_callback(void *varg, semanage_handle_t *handle,
 			     const char *fmt, ...)
 {
 	msg_set_callback_count++;
 }
 
-void test_msg_set_callback(void)
+static void test_msg_set_callback(void)
 {
 	setup_handle(SH_CONNECT);
 
@@ -261,7 +261,7 @@ void test_msg_set_callback(void)
 }
 
 /* Function semanage_root, semanage_set_root */
-void helper_root(void)
+static void helper_root(void)
 {
 	const char *root = NULL;
 
@@ -274,7 +274,7 @@ void helper_root(void)
 	CU_ASSERT_STRING_EQUAL(root, "");
 }
 
-void test_root(void)
+static void test_root(void)
 {
 	/* test without handle */
 	setup_handle(SH_NULL);
@@ -292,7 +292,7 @@ void test_root(void)
 }
 
 /* Function semanage_select_store */
-void helper_select_store(const char *name, enum semanage_connect_type type,
+static void helper_select_store(const char *name, enum semanage_connect_type type,
 			 int exp_res)
 {
 	setup_handle(SH_HANDLE);
@@ -316,7 +316,7 @@ void helper_select_store(const char *name, enum semanage_connect_type type,
 		cleanup_handle(SH_HANDLE);
 }
 
-void test_select_store(void)
+static void test_select_store(void)
 {
 	helper_select_store("asdf", SEMANAGE_CON_INVALID - 1, -1);
 	helper_select_store("asdf", SEMANAGE_CON_POLSERV_REMOTE + 1, -1);
diff --git a/libsemanage/tests/test_ibendport.c b/libsemanage/tests/test_ibendport.c
index 8addc908..a6ce7a34 100644
--- a/libsemanage/tests/test_ibendport.c
+++ b/libsemanage/tests/test_ibendport.c
@@ -33,18 +33,18 @@
 #define IBENDPORT_3_CON "system_u:object_r:third_ibendport_second_t:s0"
 
 /* ibendports_policy.h */
-void test_ibendport_query(void);
-void test_ibendport_exists(void);
-void test_ibendport_count(void);
-void test_ibendport_iterate(void);
-void test_ibendport_list(void);
+static void test_ibendport_query(void);
+static void test_ibendport_exists(void);
+static void test_ibendport_count(void);
+static void test_ibendport_iterate(void);
+static void test_ibendport_list(void);
 
 /* ibendports_local.h */
-void test_ibendport_modify_del_query_local(void);
-void test_ibendport_exists_local(void);
-void test_ibendport_count_local(void);
-void test_ibendport_iterate_local(void);
-void test_ibendport_list_local(void);
+static void test_ibendport_modify_del_query_local(void);
+static void test_ibendport_exists_local(void);
+static void test_ibendport_count_local(void);
+static void test_ibendport_iterate_local(void);
+static void test_ibendport_list_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -95,7 +95,7 @@ int ibendport_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_ibendport_t *get_ibendport_nth(int idx)
+static semanage_ibendport_t *get_ibendport_nth(int idx)
 {
 	semanage_ibendport_t **records;
 	semanage_ibendport_t *ibendport;
@@ -118,7 +118,7 @@ semanage_ibendport_t *get_ibendport_nth(int idx)
 	return ibendport;
 }
 
-semanage_ibendport_key_t *get_ibendport_key_nth(int idx)
+static semanage_ibendport_key_t *get_ibendport_key_nth(int idx)
 {
 	semanage_ibendport_key_t *key;
 	semanage_ibendport_t *ibendport;
@@ -139,7 +139,7 @@ semanage_ibendport_key_t *get_ibendport_key_nth(int idx)
 	return key;
 }
 
-void add_local_ibendport(int idx)
+static void add_local_ibendport(int idx)
 {
 	semanage_ibendport_t *ibendport;
 	semanage_ibendport_key_t *key = NULL;
@@ -157,7 +157,7 @@ void add_local_ibendport(int idx)
 	semanage_ibendport_free(ibendport);
 }
 
-void delete_local_ibendport(int idx)
+static void delete_local_ibendport(int idx)
 {
 	semanage_ibendport_key_t *key = NULL;
 	key = get_ibendport_key_nth(idx);
@@ -167,7 +167,7 @@ void delete_local_ibendport(int idx)
 }
 
 /* Function semanage_ibendport_query */
-void test_ibendport_query(void)
+static void test_ibendport_query(void)
 {
 	semanage_ibendport_t *ibendport = NULL;
 	semanage_ibendport_t *ibendport_exp = NULL;
@@ -213,7 +213,7 @@ void test_ibendport_query(void)
 }
 
 /* Function semanage_ibendport_exists */
-void test_ibendport_exists(void)
+static void test_ibendport_exists(void)
 {
 	semanage_ibendport_key_t *key1 = NULL;
 	semanage_ibendport_key_t *key2 = NULL;
@@ -238,7 +238,7 @@ void test_ibendport_exists(void)
 }
 
 /* Function semanage_ibendport_count */
-void test_ibendport_count(void)
+static void test_ibendport_count(void)
 {
 	unsigned int count = 42;
 
@@ -256,7 +256,7 @@ void test_ibendport_count(void)
 /* Function semanage_ibendport_iterate */
 unsigned int helper_ibendport_iterate_counter = 0;
 
-int helper_ibendport_iterate(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate(const semanage_ibendport_t *ibendport,
 			     void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -264,7 +264,7 @@ int helper_ibendport_iterate(const semanage_ibendport_t *ibendport,
 	return 0;
 }
 
-int helper_ibendport_iterate_error(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate_error(const semanage_ibendport_t *ibendport,
 				   void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -272,7 +272,7 @@ int helper_ibendport_iterate_error(const semanage_ibendport_t *ibendport,
 	return -1;
 }
 
-int helper_ibendport_iterate_break(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate_break(const semanage_ibendport_t *ibendport,
 				   void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -280,7 +280,7 @@ int helper_ibendport_iterate_break(const semanage_ibendport_t *ibendport,
 	return 1;
 }
 
-void test_ibendport_iterate(void)
+static void test_ibendport_iterate(void)
 {
 	/* setup */
 	setup_handle(SH_CONNECT);
@@ -308,7 +308,7 @@ void test_ibendport_iterate(void)
 }
 
 /* Function semanage_ibendport_list */
-void test_ibendport_list(void)
+static void test_ibendport_list(void)
 {
 	semanage_ibendport_t **records = NULL;
 	unsigned int count = 42;
@@ -345,7 +345,7 @@ void test_ibendport_list(void)
 /* Function semanage_ibendport_modify_local, semanage_ibendport_del_local,
  * semanage_ibendport_query_local
  */
-void test_ibendport_modify_del_query_local(void)
+static void test_ibendport_modify_del_query_local(void)
 {
 	semanage_ibendport_t *ibendport;
 	semanage_ibendport_t *ibendport_local;
@@ -380,7 +380,7 @@ void test_ibendport_modify_del_query_local(void)
 }
 
 /* Function semanage_ibendport_exists_local */
-void test_ibendport_exists_local(void)
+static void test_ibendport_exists_local(void)
 {
 	semanage_ibendport_key_t *key1 = NULL;
 	semanage_ibendport_key_t *key2 = NULL;
@@ -407,7 +407,7 @@ void test_ibendport_exists_local(void)
 }
 
 /* Function semanage_ibendport_count_local */
-void test_ibendport_count_local(void)
+static void test_ibendport_count_local(void)
 {
 	unsigned int count = 42;
 
@@ -441,7 +441,7 @@ void test_ibendport_count_local(void)
 /* Function semanage_ibendport_iterate_local */
 unsigned int helper_ibendport_iterate_local_counter = 0;
 
-int helper_ibendport_iterate_local(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate_local(const semanage_ibendport_t *ibendport,
 				   void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -449,7 +449,7 @@ int helper_ibendport_iterate_local(const semanage_ibendport_t *ibendport,
 	return 0;
 }
 
-int helper_ibendport_iterate_local_error(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate_local_error(const semanage_ibendport_t *ibendport,
 					 void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -457,7 +457,7 @@ int helper_ibendport_iterate_local_error(const semanage_ibendport_t *ibendport,
 	return -1;
 }
 
-int helper_ibendport_iterate_local_break(const semanage_ibendport_t *ibendport,
+static int helper_ibendport_iterate_local_break(const semanage_ibendport_t *ibendport,
 					 void *fn_arg)
 {
 	CU_ASSERT(fn_arg == (void *) 42);
@@ -465,7 +465,7 @@ int helper_ibendport_iterate_local_break(const semanage_ibendport_t *ibendport,
 	return 1;
 }
 
-void test_ibendport_iterate_local(void)
+static void test_ibendport_iterate_local(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -498,7 +498,7 @@ void test_ibendport_iterate_local(void)
 }
 
 /* Function semanage_ibendport_list_local */
-void test_ibendport_list_local(void)
+static void test_ibendport_list_local(void)
 {
 	semanage_ibendport_t **records = NULL;
 	unsigned int count = 42;
diff --git a/libsemanage/tests/test_iface.c b/libsemanage/tests/test_iface.c
index 46937e10..2b84cb8e 100644
--- a/libsemanage/tests/test_iface.c
+++ b/libsemanage/tests/test_iface.c
@@ -37,29 +37,29 @@
 
 
 /* iface_record.h */
-void test_iface_compare(void);
-void test_iface_compare2(void);
-void test_iface_key_create(void);
-void test_iface_key_extract(void);
-void test_iface_get_set_name(void);
-void test_iface_get_set_ifcon(void);
-void test_iface_get_set_msgcon(void);
-void test_iface_create(void);
-void test_iface_clone(void);
+static void test_iface_compare(void);
+static void test_iface_compare2(void);
+static void test_iface_key_create(void);
+static void test_iface_key_extract(void);
+static void test_iface_get_set_name(void);
+static void test_iface_get_set_ifcon(void);
+static void test_iface_get_set_msgcon(void);
+static void test_iface_create(void);
+static void test_iface_clone(void);
 
 /* interfaces_policy.h */
-void test_iface_query(void);
-void test_iface_exists(void);
-void test_iface_count(void);
-void test_iface_iterate(void);
-void test_iface_list(void);
+static void test_iface_query(void);
+static void test_iface_exists(void);
+static void test_iface_count(void);
+static void test_iface_iterate(void);
+static void test_iface_list(void);
 
 /* interfaces_local.h */
-void test_iface_modify_del_query_local(void);
-void test_iface_exists_local(void);
-void test_iface_count_local(void);
-void test_iface_iterate_local(void);
-void test_iface_list_local(void);
+static void test_iface_modify_del_query_local(void);
+static void test_iface_exists_local(void);
+static void test_iface_count_local(void);
+static void test_iface_iterate_local(void);
+static void test_iface_list_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -118,7 +118,7 @@ int iface_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_iface_t *get_iface_nth(int idx)
+static semanage_iface_t *get_iface_nth(int idx)
 {
 	int res;
 	semanage_iface_t **records;
@@ -144,7 +144,7 @@ semanage_iface_t *get_iface_nth(int idx)
 	return iface;
 }
 
-semanage_iface_key_t *get_iface_key_nth(int idx)
+static semanage_iface_key_t *get_iface_key_nth(int idx)
 {
 	semanage_iface_key_t *key;
 	semanage_iface_t *iface;
@@ -165,7 +165,7 @@ semanage_iface_key_t *get_iface_key_nth(int idx)
 	return key;
 }
 
-void add_local_iface(int idx)
+static void add_local_iface(int idx)
 {
 	semanage_iface_t *iface;
 	semanage_iface_key_t *key = NULL;
@@ -182,7 +182,7 @@ void add_local_iface(int idx)
 	semanage_iface_free(iface);
 }
 
-void delete_local_iface(int idx)
+static void delete_local_iface(int idx)
 {
 	semanage_iface_key_t *key = NULL;
 	key = get_iface_key_nth(idx);
@@ -193,7 +193,7 @@ void delete_local_iface(int idx)
 }
 
 /* Function semanage_iface_compare */
-void test_iface_compare(void)
+static void test_iface_compare(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_iface_key_t *key1 = NULL;
@@ -221,7 +221,7 @@ void test_iface_compare(void)
 }
 
 /* Function semanage_iface_compare2 */
-void test_iface_compare2(void)
+static void test_iface_compare2(void)
 {
 	semanage_iface_t *iface1 = NULL;
 	semanage_iface_t *iface2 = NULL;
@@ -248,7 +248,7 @@ void test_iface_compare2(void)
 }
 
 /* Function semanage_iface_create */
-void test_iface_key_create(void)
+static void test_iface_key_create(void)
 {
 	semanage_iface_key_t *key = NULL;
 
@@ -265,7 +265,7 @@ void test_iface_key_create(void)
 }
 
 /* Function semanage_iface_extract */
-void test_iface_key_extract(void)
+static void test_iface_key_extract(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_iface_key_t *key = NULL;
@@ -285,7 +285,7 @@ void test_iface_key_extract(void)
 }
 
 /* Function semanage_iface_get_name, semanage_iface_set_name */
-void test_iface_get_set_name(void)
+static void test_iface_get_set_name(void)
 {
 	semanage_iface_t *iface = NULL;
 
@@ -303,7 +303,7 @@ void test_iface_get_set_name(void)
 }
 
 /* Function semanage_iface_get_ifcon, semanage_iface_set_ifcon */
-void test_iface_get_set_ifcon(void)
+static void test_iface_get_set_ifcon(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_context_t *con1 = NULL;
@@ -327,7 +327,7 @@ void test_iface_get_set_ifcon(void)
 }
 
 /* Function semanage_iface_get_msgcon, semanage_iface_set_msgcon */
-void test_iface_get_set_msgcon(void)
+static void test_iface_get_set_msgcon(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_context_t *con1 = NULL;
@@ -351,7 +351,7 @@ void test_iface_get_set_msgcon(void)
 }
 
 /* Function semanage_iface_create */
-void test_iface_create(void)
+static void test_iface_create(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_context_t *ifcon = NULL;
@@ -378,7 +378,7 @@ void test_iface_create(void)
 }
 
 /* Function semanage_iface_clone */
-void test_iface_clone(void)
+static void test_iface_clone(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_iface_t *iface_clone = NULL;
@@ -417,7 +417,7 @@ void test_iface_clone(void)
 }
 
 /* Function semanage_iface_query */
-void test_iface_query(void)
+static void test_iface_query(void)
 {
 	semanage_iface_t *iface = NULL;
 	semanage_iface_t *iface_exp = NULL;
@@ -451,7 +451,7 @@ void test_iface_query(void)
 }
 
 /* Function semanage_iface_exists */
-void test_iface_exists(void)
+static void test_iface_exists(void)
 {
 	semanage_iface_key_t *key1 = NULL;
 	semanage_iface_key_t *key2 = NULL;
@@ -475,7 +475,7 @@ void test_iface_exists(void)
 }
 
 /* Function semanage_iface_count */
-void test_iface_count(void)
+static void test_iface_count(void)
 {
 	unsigned int count = 42;
 
@@ -494,13 +494,13 @@ void test_iface_count(void)
 
 unsigned int counter_iface_iterate = 0;
 
-int handler_iface_iterate(const semanage_iface_t *record, void *varg)
+static int handler_iface_iterate(const semanage_iface_t *record, void *varg)
 {
 	counter_iface_iterate++;
 	return 0;
 }
 
-void test_iface_iterate(void)
+static void test_iface_iterate(void)
 {
 	/* setup */
 	setup_handle(SH_CONNECT);
@@ -514,7 +514,7 @@ void test_iface_iterate(void)
 }
 
 /* Function semanage_iface_list */
-void test_iface_list(void)
+static void test_iface_list(void)
 {
 	semanage_iface_t **records = NULL;
 	unsigned int count = 42;
@@ -541,7 +541,7 @@ void test_iface_list(void)
 /* Function semanage_iface_modify_local, semanage_iface_del_local,
  * semanage_iface_query_local
  */
-void test_iface_modify_del_query_local(void)
+static void test_iface_modify_del_query_local(void)
 {
 	semanage_iface_t *iface;
 	semanage_iface_t *iface_local;
@@ -574,7 +574,7 @@ void test_iface_modify_del_query_local(void)
 }
 
 /* Function semanage_iface_exists_local */
-void test_iface_exists_local(void)
+static void test_iface_exists_local(void)
 {
 	semanage_iface_key_t *key1 = NULL;
 	semanage_iface_key_t *key2 = NULL;
@@ -600,7 +600,7 @@ void test_iface_exists_local(void)
 }
 
 /* Function semanage_iface_count_local */
-void test_iface_count_local(void)
+static void test_iface_count_local(void)
 {
 	unsigned int count = 42;
 
@@ -634,13 +634,13 @@ void test_iface_count_local(void)
 /* Function semanage_iface_iterate_local */
 unsigned int counter_iface_iterate_local = 0;
 
-int handler_iface_iterate_local(const semanage_iface_t *record, void *varg)
+static int handler_iface_iterate_local(const semanage_iface_t *record, void *varg)
 {
 	counter_iface_iterate_local++;
 	return 0;
 }
 
-void test_iface_iterate_local(void)
+static void test_iface_iterate_local(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -660,7 +660,7 @@ void test_iface_iterate_local(void)
 }
 
 /* Function semanage_iface_list_local */
-void test_iface_list_local(void)
+static void test_iface_list_local(void)
 {
 	semanage_iface_t **records = NULL;
 	unsigned int count = 42;
diff --git a/libsemanage/tests/test_node.c b/libsemanage/tests/test_node.c
index e49e8c3b..0db38d97 100644
--- a/libsemanage/tests/test_node.c
+++ b/libsemanage/tests/test_node.c
@@ -39,33 +39,33 @@
 #define NODE3_CONTEXT "system_u:object_r:third_node_t:s0"
 
 /* node_record.h */
-void test_node_compare(void);
-void test_node_compare2(void);
-void test_node_key_create(void);
-void test_node_key_extract(void);
-void test_node_get_set_addr(void);
-void test_node_get_set_addr_bytes(void);
-void test_node_get_set_mask(void);
-void test_node_get_set_mask_bytes(void);
-void test_node_get_set_proto(void);
-void test_node_get_proto_str(void);
-void test_node_get_set_con(void);
-void test_node_create(void);
-void test_node_clone(void);
+static void test_node_compare(void);
+static void test_node_compare2(void);
+static void test_node_key_create(void);
+static void test_node_key_extract(void);
+static void test_node_get_set_addr(void);
+static void test_node_get_set_addr_bytes(void);
+static void test_node_get_set_mask(void);
+static void test_node_get_set_mask_bytes(void);
+static void test_node_get_set_proto(void);
+static void test_node_get_proto_str(void);
+static void test_node_get_set_con(void);
+static void test_node_create(void);
+static void test_node_clone(void);
 
 /* nodes_policy.h */
-void test_node_query(void);
-void test_node_exists(void);
-void test_node_count(void);
-void test_node_iterate(void);
-void test_node_list(void);
+static void test_node_query(void);
+static void test_node_exists(void);
+static void test_node_count(void);
+static void test_node_iterate(void);
+static void test_node_list(void);
 
 /* nodes_local.h */
-void test_node_modify_del_query_local(void);
-void test_node_exists_local(void);
-void test_node_count_local(void);
-void test_node_iterate_local(void);
-void test_node_list_local(void);
+static void test_node_modify_del_query_local(void);
+static void test_node_exists_local(void);
+static void test_node_count_local(void);
+static void test_node_iterate_local(void);
+static void test_node_list_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -130,7 +130,7 @@ int node_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_node_t *get_node_nth(int idx)
+static semanage_node_t *get_node_nth(int idx)
 {
 	semanage_node_t **records;
 	semanage_node_t *node;
@@ -153,7 +153,7 @@ semanage_node_t *get_node_nth(int idx)
 	return node;
 }
 
-semanage_node_key_t *get_node_key_nth(int idx)
+static semanage_node_key_t *get_node_key_nth(int idx)
 {
 	semanage_node_key_t *key;
 	semanage_node_t *node;
@@ -174,7 +174,7 @@ semanage_node_key_t *get_node_key_nth(int idx)
 	return key;
 }
 
-void add_local_node(int idx)
+static void add_local_node(int idx)
 {
 	semanage_node_t *node;
 	semanage_node_key_t *key = NULL;
@@ -191,7 +191,7 @@ void add_local_node(int idx)
 	semanage_node_free(node);
 }
 
-void delete_local_node(int idx)
+static void delete_local_node(int idx)
 {
 	semanage_node_key_t *key = NULL;
 
@@ -204,7 +204,7 @@ void delete_local_node(int idx)
 }
 
 /* Function semanage_node_compare */
-void test_node_compare(void)
+static void test_node_compare(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_node_key_t *key1 = NULL;
@@ -233,7 +233,7 @@ void test_node_compare(void)
 }
 
 /* Function semanage_node_compare2 */
-void test_node_compare2(void)
+static void test_node_compare2(void)
 {
 	semanage_node_t *node1 = NULL;
 	semanage_node_t *node2 = NULL;
@@ -260,7 +260,7 @@ void test_node_compare2(void)
 }
 
 /* Function semanage_node_key_create */
-void test_node_key_create(void)
+static void test_node_key_create(void)
 {
 	semanage_node_key_t *key = NULL;
 
@@ -278,7 +278,7 @@ void test_node_key_create(void)
 }
 
 /* Function semanage_node_key_extract */
-void test_node_key_extract(void)
+static void test_node_key_extract(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_node_key_t *key = NULL;
@@ -298,7 +298,7 @@ void test_node_key_extract(void)
 }
 
 /* Function semanage_node_get_addr, semanage_node_set_addr */
-void test_node_get_set_addr(void)
+static void test_node_get_set_addr(void)
 {
 	semanage_node_t *node = NULL;
 	char *addr = NULL;
@@ -322,7 +322,7 @@ void test_node_get_set_addr(void)
 }
 
 /* Function semanage_node_get_addr_bytes, semanage_node_set_addr_bytes */
-void test_node_get_set_addr_bytes(void)
+static void test_node_get_set_addr_bytes(void)
 {
 	semanage_node_t *node = NULL;
 	char addr1[] = { 192, 168, 0, 1 };
@@ -352,7 +352,7 @@ void test_node_get_set_addr_bytes(void)
 }
 
 /* Function semanage_node_get_mask, semanage_node_set_mask */
-void test_node_get_set_mask(void)
+static void test_node_get_set_mask(void)
 {
 	semanage_node_t *node = NULL;
 	char *mask = NULL;
@@ -376,7 +376,7 @@ void test_node_get_set_mask(void)
 }
 
 /* Function semanage_node_get_mask_bytes, semanage_node_set_mask_bytes */
-void test_node_get_set_mask_bytes(void)
+static void test_node_get_set_mask_bytes(void)
 {
 	semanage_node_t *node = NULL;
 	char mask1[] = { 255, 255, 255, 0 };
@@ -406,7 +406,7 @@ void test_node_get_set_mask_bytes(void)
 }
 
 /* Function semanage_node_get_proto, semanage_node_set_proto */
-void test_node_get_set_proto(void)
+static void test_node_get_set_proto(void)
 {
 	semanage_node_t *node = NULL;
 
@@ -424,7 +424,7 @@ void test_node_get_set_proto(void)
 }
 
 /* Function semanage_node_get_proto_str */
-void test_node_get_proto_str(void)
+static void test_node_get_proto_str(void)
 {
 	CU_ASSERT_STRING_EQUAL(semanage_node_get_proto_str(SEMANAGE_PROTO_IP4),
 							   "ipv4");
@@ -433,7 +433,7 @@ void test_node_get_proto_str(void)
 }
 
 /* Function semanage_node_get_con, semanage_node_set_con */
-void test_node_get_set_con(void)
+static void test_node_get_set_con(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_context_t *con1 = NULL;
@@ -457,7 +457,7 @@ void test_node_get_set_con(void)
 }
 
 /* Function semanage_node_create */
-void test_node_create(void)
+static void test_node_create(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_context_t *con = NULL;
@@ -483,7 +483,7 @@ void test_node_create(void)
 }
 
 /* Function semanage_node_clone */
-void test_node_clone(void)
+static void test_node_clone(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_node_t *node_clone = NULL;
@@ -534,7 +534,7 @@ void test_node_clone(void)
 }
 
 /* Function semanage_node_query */
-void test_node_query(void)
+static void test_node_query(void)
 {
 	semanage_node_t *node = NULL;
 	semanage_node_t *node_exp = NULL;
@@ -579,7 +579,7 @@ void test_node_query(void)
 }
 
 /* Function semanage_node_exists */
-void test_node_exists(void)
+static void test_node_exists(void)
 {
 	semanage_node_key_t *key1 = NULL;
 	semanage_node_key_t *key2 = NULL;
@@ -604,7 +604,7 @@ void test_node_exists(void)
 }
 
 /* Function semanage_node_count */
-void test_node_count(void)
+static void test_node_count(void)
 {
 	unsigned int count = 42;
 
@@ -622,13 +622,13 @@ void test_node_count(void)
 /* Function semanage_node_iterate */
 unsigned int counter_node_iterate = 0;
 
-int handler_node_iterate(const semanage_node_t *record, void *varg)
+static int handler_node_iterate(const semanage_node_t *record, void *varg)
 {
 	counter_node_iterate++;
 	return 0;
 }
 
-void test_node_iterate(void)
+static void test_node_iterate(void)
 {
 	/* setup */
 	setup_handle(SH_CONNECT);
@@ -642,7 +642,7 @@ void test_node_iterate(void)
 }
 
 /* Function semanage_node_list */
-void test_node_list(void)
+static void test_node_list(void)
 {
 	semanage_node_t **records = NULL;
 	unsigned int count = 42;
@@ -669,7 +669,7 @@ void test_node_list(void)
 /* Function semanage_node_modify_local, semanage_node_del_local,
  * semanage_node_query_local
  */
-void test_node_modify_del_query_local(void)
+static void test_node_modify_del_query_local(void)
 {
 	semanage_node_t *node;
 	semanage_node_t *node_local;
@@ -719,7 +719,7 @@ void test_node_modify_del_query_local(void)
 }
 
 /* Function semanage_node_exists_local */
-void test_node_exists_local(void)
+static void test_node_exists_local(void)
 {
 	semanage_node_key_t *key1 = NULL;
 	semanage_node_key_t *key2 = NULL;
@@ -745,7 +745,7 @@ void test_node_exists_local(void)
 }
 
 /* Function semanage_node_count_local */
-void test_node_count_local(void)
+static void test_node_count_local(void)
 {
 	unsigned int count = 42;
 
@@ -779,13 +779,13 @@ void test_node_count_local(void)
 /* Function semanage_node_iterate_local */
 unsigned int counter_node_iterate_local = 0;
 
-int handler_node_iterate_local(const semanage_node_t *record, void *varg)
+static int handler_node_iterate_local(const semanage_node_t *record, void *varg)
 {
 	counter_node_iterate_local++;
 	return 0;
 }
 
-void test_node_iterate_local(void)
+static void test_node_iterate_local(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -805,7 +805,7 @@ void test_node_iterate_local(void)
 }
 
 /* Function semanage_node_list_local */
-void test_node_list_local(void)
+static void test_node_list_local(void)
 {
 	semanage_node_t **records = NULL;
 	unsigned int count = 42;
diff --git a/libsemanage/tests/test_port.c b/libsemanage/tests/test_port.c
index f4c6ec21..19213f6d 100644
--- a/libsemanage/tests/test_port.c
+++ b/libsemanage/tests/test_port.c
@@ -36,34 +36,34 @@
 #define PORT3_PROTO SEPOL_PROTO_TCP
 
 /* port_record.h */
-void test_port_compare(void);
-void test_port_compare2(void);
-void test_port_key_create(void);
-void test_port_key_extract(void);
-void test_port_get_set_proto(void);
-void test_port_get_proto_str(void);
-void test_port_get_set_port(void);
-void test_port_get_set_con(void);
-void test_port_create(void);
-void test_port_clone(void);
+static void test_port_compare(void);
+static void test_port_compare2(void);
+static void test_port_key_create(void);
+static void test_port_key_extract(void);
+static void test_port_get_set_proto(void);
+static void test_port_get_proto_str(void);
+static void test_port_get_set_port(void);
+static void test_port_get_set_con(void);
+static void test_port_create(void);
+static void test_port_clone(void);
 
 /* ports_policy.h */
-void test_port_query(void);
-void test_port_exists(void);
-void test_port_count(void);
-void test_port_iterate(void);
-void test_port_list(void);
+static void test_port_query(void);
+static void test_port_exists(void);
+static void test_port_count(void);
+static void test_port_iterate(void);
+static void test_port_list(void);
 
 /* ports_local.h */
-void test_port_modify_del_local(void);
-void test_port_query_local(void);
-void test_port_exists_local(void);
-void test_port_count_local(void);
-void test_port_iterate_local(void);
-void test_port_list_local(void);
+static void test_port_modify_del_local(void);
+static void test_port_query_local(void);
+static void test_port_exists_local(void);
+static void test_port_count_local(void);
+static void test_port_iterate_local(void);
+static void test_port_list_local(void);
 
 /* internal */
-void test_port_validate_local(void);
+static void test_port_validate_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -125,7 +125,7 @@ int port_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_port_t *get_port_nth(int idx)
+static semanage_port_t *get_port_nth(int idx)
 {
 	int res;
 	semanage_port_t **records;
@@ -151,7 +151,7 @@ semanage_port_t *get_port_nth(int idx)
 	return port;
 }
 
-semanage_port_key_t *get_port_key_nth(int idx)
+static semanage_port_key_t *get_port_key_nth(int idx)
 {
 	semanage_port_key_t *key;
 	semanage_port_t *port;
@@ -173,7 +173,7 @@ semanage_port_key_t *get_port_key_nth(int idx)
 	return key;
 }
 
-void add_local_port(int port_idx)
+static void add_local_port(int port_idx)
 {
 	semanage_port_t *port;
 	semanage_port_key_t *key = NULL;
@@ -192,7 +192,7 @@ void add_local_port(int port_idx)
 	semanage_port_free(port);
 }
 
-void delete_local_port(int port_idx)
+static void delete_local_port(int port_idx)
 {
 	semanage_port_key_t *key = NULL;
 
@@ -206,7 +206,7 @@ void delete_local_port(int port_idx)
 }
 
 /* Function semanage_port_compare */
-void helper_port_compare(int idx1, int idx2)
+static void helper_port_compare(int idx1, int idx2)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_key_t *key = NULL;
@@ -232,7 +232,7 @@ void helper_port_compare(int idx1, int idx2)
 	cleanup_handle(SH_CONNECT);
 }
 
-void test_port_compare(void)
+static void test_port_compare(void)
 {
 	helper_port_compare(I_FIRST,  I_FIRST);
 	helper_port_compare(I_FIRST,  I_SECOND);
@@ -241,7 +241,7 @@ void test_port_compare(void)
 }
 
 /* Function semanage_port_compare2 */
-void helper_port_compare2(int idx1, int idx2)
+static void helper_port_compare2(int idx1, int idx2)
 {
 	semanage_port_t *port1 = NULL;
 	semanage_port_t *port2 = NULL;
@@ -268,7 +268,7 @@ void helper_port_compare2(int idx1, int idx2)
 	cleanup_handle(SH_CONNECT);
 }
 
-void test_port_compare2(void)
+static void test_port_compare2(void)
 {
 	helper_port_compare2(I_FIRST,  I_FIRST);
 	helper_port_compare2(I_FIRST,  I_SECOND);
@@ -277,7 +277,7 @@ void test_port_compare2(void)
 }
 
 /* Function semanage_port_create */
-void test_port_key_create(void)
+static void test_port_key_create(void)
 {
 	semanage_port_key_t *key = NULL;
 
@@ -294,7 +294,7 @@ void test_port_key_create(void)
 }
 
 /* Function semanage_port_extract */
-void test_port_key_extract(void)
+static void test_port_key_extract(void)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_key_t *key = NULL;
@@ -314,7 +314,7 @@ void test_port_key_extract(void)
 }
 
 /* Function semanage_port_get_proto, semanage_port_set_proto */
-void helper_port_get_set_proto(int idx)
+static void helper_port_get_set_proto(int idx)
 {
 	semanage_port_t *port = NULL;
 
@@ -333,14 +333,14 @@ void helper_port_get_set_proto(int idx)
 	cleanup_handle(SH_CONNECT);
 }
 
-void test_port_get_set_proto(void)
+static void test_port_get_set_proto(void)
 {
 	helper_port_get_set_proto(I_FIRST);
 	helper_port_get_set_proto(I_SECOND);
 }
 
 /* Function semanage_port_get_proto_str */
-void test_port_get_proto_str(void)
+static void test_port_get_proto_str(void)
 {
 	const char *str = NULL;
 
@@ -365,7 +365,7 @@ void test_port_get_proto_str(void)
 
 /* Function semanage_port_get_low, semanage_port_get_high, */
 /* semanage_port_set_port, semanage_port_set_range */
-void test_port_get_set_port(void)
+static void test_port_get_set_port(void)
 {
 	semanage_port_t *port = NULL;
 
@@ -388,7 +388,7 @@ void test_port_get_set_port(void)
 }
 
 /* Function semanage_port_get_con, semanage_port_set_con */
-void test_port_get_set_con(void)
+static void test_port_get_set_con(void)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_t *port_tmp = NULL;
@@ -413,7 +413,7 @@ void test_port_get_set_con(void)
 }
 
 /* Function semanage_port_create */
-void test_port_create(void)
+static void test_port_create(void)
 {
 	semanage_port_t *port = NULL;
 
@@ -433,7 +433,7 @@ void test_port_create(void)
 }
 
 /* Function semanage_port_clone */
-void test_port_clone(void)
+static void test_port_clone(void)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_t *port_clone = NULL;
@@ -465,7 +465,7 @@ void test_port_clone(void)
 }
 
 /* Function semanage_port_query */
-void test_port_query(void)
+static void test_port_query(void)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_t *port_exp = NULL;
@@ -499,7 +499,7 @@ void test_port_query(void)
 }
 
 /* Function semanage_port_exists */
-void test_port_exists(void)
+static void test_port_exists(void)
 {
 	semanage_port_key_t *key1 = NULL;
 	semanage_port_key_t *key2 = NULL;
@@ -523,7 +523,7 @@ void test_port_exists(void)
 }
 
 /* Function semanage_port_count */
-void test_port_count(void)
+static void test_port_count(void)
 {
 	unsigned int count = 42;
 
@@ -541,13 +541,13 @@ void test_port_count(void)
 /* Function semanage_port_iterate */
 unsigned int counter_port_iterate = 0;
 
-int handler_port_iterate(const semanage_port_t *record, void *varg)
+static int handler_port_iterate(const semanage_port_t *record, void *varg)
 {
 	counter_port_iterate++;
 	return 0;
 }
 
-void test_port_iterate(void)
+static void test_port_iterate(void)
 {
 	/* setup */
 	setup_handle(SH_CONNECT);
@@ -561,7 +561,7 @@ void test_port_iterate(void)
 }
 
 /* Function semanage_port_list */
-void test_port_list(void)
+static void test_port_list(void)
 {
 	semanage_port_t **records = NULL;
 	unsigned int count = 42;
@@ -586,7 +586,7 @@ void test_port_list(void)
 }
 
 /* Function semanage_port_modify_local, semanage_port_del_local */
-void test_port_modify_del_local(void)
+static void test_port_modify_del_local(void)
 {
 	semanage_port_t *port;
 	semanage_port_t *port_local;
@@ -622,7 +622,7 @@ void test_port_modify_del_local(void)
 }
 
 /* Function semanage_port_query_local */
-void test_port_query_local(void)
+static void test_port_query_local(void)
 {
 	semanage_port_t *port = NULL;
 	semanage_port_t *port_exp = NULL;
@@ -658,7 +658,7 @@ void test_port_query_local(void)
 }
 
 /* Function semanage_port_exists_local */
-void test_port_exists_local(void)
+static void test_port_exists_local(void)
 {
 	semanage_port_key_t *key1 = NULL;
 	semanage_port_key_t *key2 = NULL;
@@ -684,7 +684,7 @@ void test_port_exists_local(void)
 }
 
 /* Function semanage_port_count_local */
-void test_port_count_local(void)
+static void test_port_count_local(void)
 {
 	unsigned int count = 42;
 
@@ -718,13 +718,13 @@ void test_port_count_local(void)
 /* Function semanage_port_iterate_local */
 unsigned int counter_port_iterate_local = 0;
 
-int handler_port_iterate_local(const semanage_port_t *record, void *varg)
+static int handler_port_iterate_local(const semanage_port_t *record, void *varg)
 {
 	counter_port_iterate_local++;
 	return 0;
 }
 
-void test_port_iterate_local(void)
+static void test_port_iterate_local(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -744,7 +744,7 @@ void test_port_iterate_local(void)
 }
 
 /* Function semanage_port_list_local */
-void test_port_list_local(void)
+static void test_port_list_local(void)
 {
 	semanage_port_t **records = NULL;
 	unsigned int count = 42;
@@ -775,7 +775,7 @@ void test_port_list_local(void)
 }
 
 /* Internal function semanage_port_validate_local */
-void helper_port_validate_local_noport(void)
+static void helper_port_validate_local_noport(void)
 {
 	semanage_port_key_t *key = NULL;
 	int resp = 42;
@@ -800,7 +800,7 @@ void helper_port_validate_local_noport(void)
 	cleanup_handle(SH_TRANS);
 }
 
-void helper_port_validate_local_oneport(void)
+static void helper_port_validate_local_oneport(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -815,7 +815,7 @@ void helper_port_validate_local_oneport(void)
 	cleanup_handle(SH_TRANS);
 }
 
-void helper_port_validate_local_twoports(void)
+static void helper_port_validate_local_twoports(void)
 {
 	semanage_port_key_t *key1 = NULL;
 	semanage_port_key_t *key2 = NULL;
@@ -863,7 +863,7 @@ void helper_port_validate_local_twoports(void)
 	cleanup_handle(SH_TRANS);
 }
 
-void helper_port_validate_local_proto(void)
+static void helper_port_validate_local_proto(void)
 {
 	semanage_port_key_t *key1 = NULL;
 	semanage_port_key_t *key2 = NULL;
@@ -925,7 +925,7 @@ void helper_port_validate_local_proto(void)
 	cleanup_handle(SH_TRANS);
 }
 
-void test_port_validate_local(void)
+static void test_port_validate_local(void)
 {
 	helper_port_validate_local_noport();
 	helper_port_validate_local_oneport();
diff --git a/libsemanage/tests/test_user.c b/libsemanage/tests/test_user.c
index c3835c8d..b6fda51a 100644
--- a/libsemanage/tests/test_user.c
+++ b/libsemanage/tests/test_user.c
@@ -24,31 +24,31 @@
 #define USER_COUNT 3
 
 /* user_record.h */
-void test_user_compare(void);
-void test_user_compare2(void);
-void test_user_key_create(void);
-void test_user_key_extract(void);
-void test_user_get_set_name(void);
-void test_user_get_set_prefix(void);
-void test_user_get_set_mlslevel(void);
-void test_user_get_set_mlsrange(void);
-void test_user_roles(void);
-void test_user_create(void);
-void test_user_clone(void);
+static void test_user_compare(void);
+static void test_user_compare2(void);
+static void test_user_key_create(void);
+static void test_user_key_extract(void);
+static void test_user_get_set_name(void);
+static void test_user_get_set_prefix(void);
+static void test_user_get_set_mlslevel(void);
+static void test_user_get_set_mlsrange(void);
+static void test_user_roles(void);
+static void test_user_create(void);
+static void test_user_clone(void);
 
 /* users_policy.h */
-void test_user_query(void);
-void test_user_exists(void);
-void test_user_count(void);
-void test_user_iterate(void);
-void test_user_list(void);
+static void test_user_query(void);
+static void test_user_exists(void);
+static void test_user_count(void);
+static void test_user_iterate(void);
+static void test_user_list(void);
 
 /* users_local.h */
-void test_user_modify_del_query_local(void);
-void test_user_exists_local(void);
-void test_user_count_local(void);
-void test_user_iterate_local(void);
-void test_user_list_local(void);
+static void test_user_modify_del_query_local(void);
+static void test_user_exists_local(void);
+static void test_user_count_local(void);
+static void test_user_iterate_local(void);
+static void test_user_list_local(void);
 
 extern semanage_handle_t *sh;
 
@@ -109,7 +109,7 @@ int user_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-semanage_user_t *get_user_nth(int idx)
+static semanage_user_t *get_user_nth(int idx)
 {
 	int res;
 	semanage_user_t **records;
@@ -135,7 +135,7 @@ semanage_user_t *get_user_nth(int idx)
 	return user;
 }
 
-semanage_user_key_t *get_user_key_nth(int idx)
+static semanage_user_key_t *get_user_key_nth(int idx)
 {
 	semanage_user_key_t *key;
 	semanage_user_t *user;
@@ -156,7 +156,7 @@ semanage_user_key_t *get_user_key_nth(int idx)
 	return key;
 }
 
-void add_local_user(int user_idx)
+static void add_local_user(int user_idx)
 {
 	semanage_user_t *user;
 	semanage_user_key_t *key = NULL;
@@ -174,7 +174,7 @@ void add_local_user(int user_idx)
 	semanage_user_free(user);
 }
 
-void delete_local_user(int user_idx)
+static void delete_local_user(int user_idx)
 {
 	semanage_user_key_t *key = NULL;
 
@@ -188,7 +188,7 @@ void delete_local_user(int user_idx)
 }
 
 /* Function semanage_user_compare */
-void test_user_compare(void)
+static void test_user_compare(void)
 {
 	semanage_user_t *user = NULL;
 	semanage_user_key_t *key1 = NULL;
@@ -215,7 +215,7 @@ void test_user_compare(void)
 }
 
 /* Function semanage_user_compare2 */
-void test_user_compare2(void)
+static void test_user_compare2(void)
 {
 	semanage_user_t *user1 = NULL;
 	semanage_user_t *user2 = NULL;
@@ -242,7 +242,7 @@ void test_user_compare2(void)
 }
 
 /* Function semanage_user_key_create */
-void test_user_key_create(void)
+static void test_user_key_create(void)
 {
 	semanage_user_key_t *key = NULL;
 
@@ -259,7 +259,7 @@ void test_user_key_create(void)
 }
 
 /* Function semanage_user_key_extract */
-void test_user_key_extract(void)
+static void test_user_key_extract(void)
 {
 	semanage_user_t *user = NULL;
 	semanage_user_key_t *key = NULL;
@@ -279,7 +279,7 @@ void test_user_key_extract(void)
 }
 
 /* Function semanage_user_get_name, semanage_user_set_name */
-void test_user_get_set_name(void)
+static void test_user_get_set_name(void)
 {
 	semanage_user_t *user = NULL;
 
@@ -297,7 +297,7 @@ void test_user_get_set_name(void)
 }
 
 /* Function semanage_user_get_prefix, semanage_user_set_prefix */
-void test_user_get_set_prefix(void)
+static void test_user_get_set_prefix(void)
 {
 	semanage_user_t *user = NULL;
 
@@ -315,7 +315,7 @@ void test_user_get_set_prefix(void)
 }
 
 /* Function semanage_user_get_mlslevel, semanage_user_set_mlslevel */
-void test_user_get_set_mlslevel(void)
+static void test_user_get_set_mlslevel(void)
 {
 	semanage_user_t *user = NULL;
 
@@ -333,7 +333,7 @@ void test_user_get_set_mlslevel(void)
 }
 
 /* Function semanage_user_get_mlsrange, semanage_user_set_mlsrange */
-void test_user_get_set_mlsrange(void)
+static void test_user_get_set_mlsrange(void)
 {
 	semanage_user_t *user = NULL;
 
@@ -354,7 +354,7 @@ void test_user_get_set_mlsrange(void)
  * semanage_user_del_role, semanage_user_has_role, semanage_user_get_roles
  * semanage_user_set_roles
  */
-void test_user_roles(void)
+static void test_user_roles(void)
 {
 	semanage_user_t *user = NULL;
 	const char **roles_arr = NULL;
@@ -406,7 +406,7 @@ void test_user_roles(void)
 }
 
 /* Function semanage_user_create */
-void test_user_create(void)
+static void test_user_create(void)
 {
 	semanage_user_t *user = NULL;
 
@@ -426,7 +426,7 @@ void test_user_create(void)
 }
 
 /* Function semanage_user_clone */
-void test_user_clone(void)
+static void test_user_clone(void)
 {
 	semanage_user_t *user = NULL;
 	semanage_user_t *user_clone = NULL;
@@ -453,7 +453,7 @@ void test_user_clone(void)
 }
 
 /* Function semanage_user_query */
-void test_user_query(void)
+static void test_user_query(void)
 {
 	semanage_user_t *user = NULL;
 	semanage_user_key_t *key = NULL;
@@ -475,7 +475,7 @@ void test_user_query(void)
 }
 
 /* Function semanage_user_exists */
-void test_user_exists(void)
+static void test_user_exists(void)
 {
 	semanage_user_key_t *key1 = NULL;
 	semanage_user_key_t *key2 = NULL;
@@ -499,7 +499,7 @@ void test_user_exists(void)
 }
 
 /* Function semanage_user_count */
-void test_user_count(void)
+static void test_user_count(void)
 {
 	unsigned int count = 42;
 
@@ -517,13 +517,13 @@ void test_user_count(void)
 /* Function semanage_user_iterate */
 unsigned int counter_user_iterate = 0;
 
-int handler_user_iterate(const semanage_user_t *record, void *varg)
+static int handler_user_iterate(const semanage_user_t *record, void *varg)
 {
 	counter_user_iterate++;
 	return 0;
 }
 
-void test_user_iterate(void)
+static void test_user_iterate(void)
 {
 	/* setup */
 	setup_handle(SH_CONNECT);
@@ -537,7 +537,7 @@ void test_user_iterate(void)
 }
 
 /* Function semanage_user_list */
-void test_user_list(void)
+static void test_user_list(void)
 {
 	semanage_user_t **records = NULL;
 	unsigned int count = 42;
@@ -565,7 +565,7 @@ void test_user_list(void)
 /* Function semanage_user_modify_local, semanage_user_del_local,
  * semanage_user_query_local
  */
-void test_user_modify_del_query_local(void)
+static void test_user_modify_del_query_local(void)
 {
 	semanage_user_t *user;
 	semanage_user_t *user_local;
@@ -597,7 +597,7 @@ void test_user_modify_del_query_local(void)
 }
 
 /* Function semanage_user_exists_local */
-void test_user_exists_local(void)
+static void test_user_exists_local(void)
 {
 	semanage_user_t *user = NULL;
 	semanage_user_key_t *key1 = NULL;
@@ -626,7 +626,7 @@ void test_user_exists_local(void)
 }
 
 /* Function semanage_user_count_local */
-void test_user_count_local(void)
+static void test_user_count_local(void)
 {
 	unsigned int count = 42;
 
@@ -650,13 +650,13 @@ void test_user_count_local(void)
 /* Function semanage_user_iterate_local */
 unsigned int counter_user_iterate_local = 0;
 
-int handler_user_iterate_local(const semanage_user_t *record, void *varg)
+static int handler_user_iterate_local(const semanage_user_t *record, void *varg)
 {
 	counter_user_iterate_local++;
 	return 0;
 }
 
-void test_user_iterate_local(void)
+static void test_user_iterate_local(void)
 {
 	/* setup */
 	setup_handle(SH_TRANS);
@@ -676,7 +676,7 @@ void test_user_iterate_local(void)
 }
 
 /* Function semanage_user_list_local */
-void test_user_list_local(void)
+static void test_user_list_local(void)
 {
 	semanage_user_t **records = NULL;
 	unsigned int count = 42;
diff --git a/libsemanage/tests/test_utilities.c b/libsemanage/tests/test_utilities.c
index 33609401..e1ff4e7d 100644
--- a/libsemanage/tests/test_utilities.c
+++ b/libsemanage/tests/test_utilities.c
@@ -35,16 +35,17 @@
 #include <unistd.h>
 
 #include "utilities.h"
-
-void test_semanage_is_prefix(void);
-void test_semanage_split_on_space(void);
-void test_semanage_split(void);
-void test_semanage_list(void);
-void test_semanage_str_count(void);
-void test_semanage_rtrim(void);
-void test_semanage_str_replace(void);
-void test_semanage_findval(void);
-void test_slurp_file_filter(void);
+#include "test_utilities.h"
+
+static void test_semanage_is_prefix(void);
+static void test_semanage_split_on_space(void);
+static void test_semanage_split(void);
+static void test_semanage_list(void);
+static void test_semanage_str_count(void);
+static void test_semanage_rtrim(void);
+static void test_semanage_str_replace(void);
+static void test_semanage_findval(void);
+static void test_slurp_file_filter(void);
 
 char fname[] = {
 	'T', 'E', 'S', 'T', '_', 'T', 'E', 'M', 'P', '_', 'X', 'X', 'X', 'X',
@@ -122,7 +123,7 @@ int semanage_utilities_add_tests(CU_pSuite suite)
 	return CU_get_error();
 }
 
-void test_semanage_is_prefix(void)
+static void test_semanage_is_prefix(void)
 {
 	const char *str = "some string";
 	const char *pre = "some";
@@ -134,7 +135,7 @@ void test_semanage_is_prefix(void)
 	CU_ASSERT_FALSE(semanage_is_prefix(str, not_pre));
 }
 
-void test_semanage_split_on_space(void)
+static void test_semanage_split_on_space(void)
 {
 	char *str = strdup("   foo   bar    baz");
 	char *temp;
@@ -163,7 +164,7 @@ void test_semanage_split_on_space(void)
 	free(temp);
 }
 
-void test_semanage_split(void)
+static void test_semanage_split(void)
 {
 	char *str = strdup("foo1 foo2   foo:bar:");
 	char *temp;
@@ -198,7 +199,7 @@ void test_semanage_split(void)
 	free(temp);
 }
 
-void test_semanage_list(void)
+static void test_semanage_list(void)
 {
 	semanage_list_t *list = NULL;
 	semanage_list_t *ptr = NULL;
@@ -247,7 +248,7 @@ void test_semanage_list(void)
 	CU_ASSERT_PTR_NULL(list);
 }
 
-void test_semanage_str_count(void)
+static void test_semanage_str_count(void)
 {
 	const char *test_string = "abaababbaaaba";
 
@@ -256,7 +257,7 @@ void test_semanage_str_count(void)
 	CU_ASSERT_EQUAL(semanage_str_count(test_string, 'b'), 5);
 }
 
-void test_semanage_rtrim(void)
+static void test_semanage_rtrim(void)
 {
 	char *str = strdup("/blah/foo/bar/baz/");
 
@@ -272,7 +273,7 @@ void test_semanage_rtrim(void)
 	free(str);
 }
 
-void test_semanage_str_replace(void)
+static void test_semanage_str_replace(void)
 {
 	const char *test_str = "Hello, I am %{USERNAME} and my id is %{USERID}";
 	char *str1, *str2;
@@ -301,7 +302,7 @@ void test_semanage_str_replace(void)
 	free(str1);
 }
 
-void test_semanage_findval(void)
+static void test_semanage_findval(void)
 {
 	char *tok;
 	if (!fptr) {
@@ -323,12 +324,12 @@ void test_semanage_findval(void)
 	free(tok);
 }
 
-int PREDICATE(const char *str)
+static int PREDICATE(const char *str)
 {
 	return semanage_is_prefix(str, "#");
 }
 
-void test_slurp_file_filter(void)
+static void test_slurp_file_filter(void)
 {
 	semanage_list_t *data, *tmp;
 	int cnt = 0;
diff --git a/libsemanage/tests/utilities.c b/libsemanage/tests/utilities.c
index b28ae155..71d7af1e 100644
--- a/libsemanage/tests/utilities.c
+++ b/libsemanage/tests/utilities.c
@@ -76,7 +76,7 @@ void enable_test_store(void) {
 	test_store_enabled = 1;
 }
 
-int write_test_policy(char *data, size_t data_len) {
+static int write_test_policy(char *data, size_t data_len) {
 	FILE *fptr = fopen("test-policy/store/active/policy.kern", "wb+");
 
 	if (!fptr) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] libsemanage/tests: Remove unused functions
  2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
                   ` (2 preceding siblings ...)
  2022-04-14 13:51 ` [PATCH 4/5] libsemanage/tests: " James Carter
@ 2022-04-14 13:51 ` James Carter
  2022-04-20 18:54 ` [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration Petr Lautrbach
  4 siblings, 0 replies; 7+ messages in thread
From: James Carter @ 2022-04-14 13:51 UTC (permalink / raw)
  To: selinux; +Cc: cgzones, James Carter

The functions helper_port_validate_local_proto(), get_type(), and
get_fcontext_new() are not used, so remove them.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsemanage/tests/test_fcontext.c | 31 ----------------
 libsemanage/tests/test_port.c     | 62 -------------------------------
 2 files changed, 93 deletions(-)

diff --git a/libsemanage/tests/test_fcontext.c b/libsemanage/tests/test_fcontext.c
index 5104989e..8943d741 100644
--- a/libsemanage/tests/test_fcontext.c
+++ b/libsemanage/tests/test_fcontext.c
@@ -73,28 +73,6 @@ static void test_fcontext_list_local(void);
 
 extern semanage_handle_t *sh;
 
-static int get_type(char *t)
-{
-	if (strcmp(t, "--") == 0)
-		return SEMANAGE_FCONTEXT_ALL;
-	else if (strcmp(t, "-f") == 0)
-		return SEMANAGE_FCONTEXT_REG;
-	else if (strcmp(t, "-d") == 0)
-		return SEMANAGE_FCONTEXT_DIR;
-	else if (strcmp(t, "-c") == 0)
-		return SEMANAGE_FCONTEXT_CHAR;
-	else if (strcmp(t, "-b") == 0)
-		return SEMANAGE_FCONTEXT_BLOCK;
-	else if (strcmp(t, "-s") == 0)
-		return SEMANAGE_FCONTEXT_SOCK;
-	else if (strcmp(t, "-l") == 0)
-		return SEMANAGE_FCONTEXT_LINK;
-	else if (strcmp(t, "-p") == 0)
-		return SEMANAGE_FCONTEXT_PIPE;
-	else
-		return -1;
-}
-
 static int write_file_contexts(const char *data, unsigned int data_len)
 {
 	FILE *fptr = fopen("test-policy/store/active/file_contexts", "w+");
@@ -187,15 +165,6 @@ int fcontext_add_tests(CU_pSuite suite)
 
 /* Helpers */
 
-static semanage_fcontext_t *get_fcontext_new(void)
-{
-	semanage_fcontext_t *fcontext;
-
-	CU_ASSERT_FATAL(semanage_fcontext_create(sh, &fcontext) >= 0);
-
-	return fcontext;
-}
-
 static semanage_fcontext_t *get_fcontext_nth(int idx)
 {
 	semanage_fcontext_t **records;
diff --git a/libsemanage/tests/test_port.c b/libsemanage/tests/test_port.c
index 19213f6d..e6393d78 100644
--- a/libsemanage/tests/test_port.c
+++ b/libsemanage/tests/test_port.c
@@ -863,68 +863,6 @@ static void helper_port_validate_local_twoports(void)
 	cleanup_handle(SH_TRANS);
 }
 
-static void helper_port_validate_local_proto(void)
-{
-	semanage_port_key_t *key1 = NULL;
-	semanage_port_key_t *key2 = NULL;
-	semanage_port_key_t *key3 = NULL;
-	semanage_port_t *port1 = NULL;
-	semanage_port_t *port2 = NULL;
-	semanage_port_t *port3 = NULL;
-	semanage_context_t *con1 = NULL;
-	semanage_context_t *con2 = NULL;
-	semanage_context_t *con3 = NULL;
-
-	/* setup */
-	setup_handle(SH_TRANS);
-
-	CU_ASSERT(semanage_port_key_create(sh, 101, 200, 0, &key1) >= 0);
-	CU_ASSERT(semanage_port_key_create(sh,  51, 250, 1, &key2) >= 0);
-	CU_ASSERT(semanage_port_key_create(sh, 201, 300, 0, &key3) >= 0);
-
-	CU_ASSERT(semanage_port_create(sh, &port1) >= 0);
-	CU_ASSERT(semanage_port_create(sh, &port2) >= 0);
-	CU_ASSERT(semanage_port_create(sh, &port3) >= 0);
-
-	semanage_port_set_range(port1, 101, 200);
-	semanage_port_set_range(port2,  51, 250);
-	semanage_port_set_range(port3, 201, 300);
-
-	semanage_port_set_proto(port1, 0);
-	semanage_port_set_proto(port2, 0);
-	semanage_port_set_proto(port3, 0);
-
-	CU_ASSERT(semanage_context_from_string(sh,
-			       "system_u:object_r:user_home_t:s0", &con1) >= 0);
-	CU_ASSERT(semanage_context_from_string(sh,
-			       "system_u:object_r:user_home_t:s0", &con2) >= 0);
-	CU_ASSERT(semanage_context_from_string(sh,
-				"system_u:object_r:user_tmp_t:s0", &con3) >= 0);
-
-	semanage_port_set_con(sh, port1, con1);
-	semanage_port_set_con(sh, port2, con2);
-	semanage_port_set_con(sh, port3, con3);
-
-	CU_ASSERT(semanage_port_modify_local(sh, key1, port1) >= 0);
-	CU_ASSERT(semanage_port_modify_local(sh, key2, port2) >= 0);
-	CU_ASSERT(semanage_port_modify_local(sh, key3, port3) >= 0);
-
-	/* test */
-	helper_commit();
-
-	/* cleanup */
-	CU_ASSERT(semanage_port_del_local(sh, key1) >= 0);
-	CU_ASSERT(semanage_port_del_local(sh, key2) >= 0);
-	CU_ASSERT(semanage_port_del_local(sh, key3) >= 0);
-	semanage_port_key_free(key1);
-	semanage_port_key_free(key2);
-	semanage_port_key_free(key3);
-	semanage_port_free(port1);
-	semanage_port_free(port2);
-	semanage_port_free(port3);
-	cleanup_handle(SH_TRANS);
-}
-
 static void test_port_validate_local(void)
 {
 	helper_port_validate_local_noport();
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration
  2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
                   ` (3 preceding siblings ...)
  2022-04-14 13:51 ` [PATCH 5/5] libsemanage/tests: Remove unused functions James Carter
@ 2022-04-20 18:54 ` Petr Lautrbach
  2022-04-20 19:01   ` James Carter
  4 siblings, 1 reply; 7+ messages in thread
From: Petr Lautrbach @ 2022-04-20 18:54 UTC (permalink / raw)
  To: James Carter, selinux; +Cc: cgzones

James Carter <jwcart2@gmail.com> writes:

> Since test-linker-cond-map.h and test-linker-types.h references
> policydb_t, include the policydb header file.
>
> Signed-off-by: James Carter <jwcart2@gmail.com>

For all 5 patches:

Acked-by: Petr Lautrbach <plautrba@redhat.com>

> ---
>  libsepol/tests/test-linker-cond-map.h | 2 ++
>  libsepol/tests/test-linker-types.h    | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/libsepol/tests/test-linker-cond-map.h b/libsepol/tests/test-linker-cond-map.h
> index 148c6f62..740a722e 100644
> --- a/libsepol/tests/test-linker-cond-map.h
> +++ b/libsepol/tests/test-linker-cond-map.h
> @@ -21,6 +21,8 @@
>  #ifndef __TEST_LINKER_COND_MAP_H__
>  #define __TEST_LINKER_COND_MAP_H__
>  
> +#include <sepol/policydb/policydb.h>
> +
>  extern void base_cond_tests(policydb_t * base);
>  extern void module_cond_tests(policydb_t * base);
>  
> diff --git a/libsepol/tests/test-linker-types.h b/libsepol/tests/test-linker-types.h
> index 0c860ebf..acad5e0e 100644
> --- a/libsepol/tests/test-linker-types.h
> +++ b/libsepol/tests/test-linker-types.h
> @@ -21,6 +21,8 @@
>  #ifndef __TEST_LINKER_TYPES_H__
>  #define __TEST_LINKER_TYPES_H__
>  
> +#include <sepol/policydb/policydb.h>
> +
>  extern void base_type_tests(policydb_t * base);
>  extern void module_type_tests(policydb_t * base);
>  
> -- 
> 2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration
  2022-04-20 18:54 ` [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration Petr Lautrbach
@ 2022-04-20 19:01   ` James Carter
  0 siblings, 0 replies; 7+ messages in thread
From: James Carter @ 2022-04-20 19:01 UTC (permalink / raw)
  To: Petr Lautrbach; +Cc: SElinux list, Christian Göttsche

On Wed, Apr 20, 2022 at 2:54 PM Petr Lautrbach <plautrba@redhat.com> wrote:
>
> James Carter <jwcart2@gmail.com> writes:
>
> > Since test-linker-cond-map.h and test-linker-types.h references
> > policydb_t, include the policydb header file.
> >
> > Signed-off-by: James Carter <jwcart2@gmail.com>
>
> For all 5 patches:
>
> Acked-by: Petr Lautrbach <plautrba@redhat.com>
>

These patches have been merged.
Thanks,
Jim

> > ---
> >  libsepol/tests/test-linker-cond-map.h | 2 ++
> >  libsepol/tests/test-linker-types.h    | 2 ++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/libsepol/tests/test-linker-cond-map.h b/libsepol/tests/test-linker-cond-map.h
> > index 148c6f62..740a722e 100644
> > --- a/libsepol/tests/test-linker-cond-map.h
> > +++ b/libsepol/tests/test-linker-cond-map.h
> > @@ -21,6 +21,8 @@
> >  #ifndef __TEST_LINKER_COND_MAP_H__
> >  #define __TEST_LINKER_COND_MAP_H__
> >
> > +#include <sepol/policydb/policydb.h>
> > +
> >  extern void base_cond_tests(policydb_t * base);
> >  extern void module_cond_tests(policydb_t * base);
> >
> > diff --git a/libsepol/tests/test-linker-types.h b/libsepol/tests/test-linker-types.h
> > index 0c860ebf..acad5e0e 100644
> > --- a/libsepol/tests/test-linker-types.h
> > +++ b/libsepol/tests/test-linker-types.h
> > @@ -21,6 +21,8 @@
> >  #ifndef __TEST_LINKER_TYPES_H__
> >  #define __TEST_LINKER_TYPES_H__
> >
> > +#include <sepol/policydb/policydb.h>
> > +
> >  extern void base_type_tests(policydb_t * base);
> >  extern void module_type_tests(policydb_t * base);
> >
> > --
> > 2.34.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-04-20 19:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 13:51 [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration James Carter
2022-04-14 13:51 ` [PATCH 2/5] libsepol/test: Include paired headers for prototypes James Carter
2022-04-14 13:51 ` [PATCH 3/5] libsepol/test: Declare file local functions as static James Carter
2022-04-14 13:51 ` [PATCH 4/5] libsemanage/tests: " James Carter
2022-04-14 13:51 ` [PATCH 5/5] libsemanage/tests: Remove unused functions James Carter
2022-04-20 18:54 ` [PATCH 1/5] libsepol/test Include policydb.h header for policydb_t declaration Petr Lautrbach
2022-04-20 19:01   ` James Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.