diff --git a/tests/test_acl.c b/tests/test_acl.c
index be9866c0cfe28c934e2fccb9b38c6131536f1c90..c7a711fe3b8b18282374a112c5043dea49f16e04 100644
--- a/tests/test_acl.c
+++ b/tests/test_acl.c
@@ -122,6 +122,22 @@ struct acl {
 #define TACL_A AST_SENSE_ALLOW
 #define TACL_D AST_SENSE_DENY
 
+static int build_ha(const struct acl *acl, size_t len, struct ast_ha **ha, const char *acl_name, int *err, struct ast_test *test, enum ast_test_result_state *res) 
+{
+	size_t i;
+
+	for (i = 0; i < len; ++i) {
+		if (!(*ha = ast_append_ha(acl[i].access, acl[i].host, *ha, err))) {
+			ast_test_status_update(test, "Failed to add rule %s with access %s to %s\n",
+					       acl[i].host, acl[i].access, acl_name);
+			*res = AST_TEST_FAIL;
+			return -1;
+		}
+	}
+
+	return 0;
+}
+
 AST_TEST_DEFINE(acl)
 {
 	struct acl permitallv4 = { "0.0.0.0/0", "permit" };
@@ -211,21 +227,6 @@ AST_TEST_DEFINE(acl)
 	int err = 0;
 	int i;
 
-	auto int build_ha(const struct acl *acl, size_t len, struct ast_ha **ha, const char *acl_name);
-	auto int build_ha(const struct acl *acl, size_t len, struct ast_ha **ha, const char *acl_name) {
-		size_t i;
-
-		for (i = 0; i < len; ++i) {
-			if (!(*ha = ast_append_ha(acl[i].access, acl[i].host, *ha, &err))) {
-				ast_test_status_update(test, "Failed to add rule %s with access %s to %s\n",
-						       acl[i].host, acl[i].access, acl_name);
-				res = AST_TEST_FAIL;
-				return -1;
-			}
-		}
-
-		return 0;
-	}
 
 	switch (cmd) {
 	case TEST_INIT:
@@ -263,31 +264,31 @@ AST_TEST_DEFINE(acl)
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl1, ARRAY_LEN(acl1), &ha1, "ha1") != 0) {
+	if (build_ha(acl1, ARRAY_LEN(acl1), &ha1, "ha1", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl2, ARRAY_LEN(acl2), &ha2, "ha2") != 0) {
+	if (build_ha(acl2, ARRAY_LEN(acl2), &ha2, "ha2", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl3, ARRAY_LEN(acl3), &ha3, "ha3") != 0) {
+	if (build_ha(acl3, ARRAY_LEN(acl3), &ha3, "ha3", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl4, ARRAY_LEN(acl4), &ha4, "ha4") != 0) {
+	if (build_ha(acl4, ARRAY_LEN(acl4), &ha4, "ha4", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl5, ARRAY_LEN(acl5), &ha5, "ha5") != 0) {
+	if (build_ha(acl5, ARRAY_LEN(acl5), &ha5, "ha5", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl6, ARRAY_LEN(acl6), &ha6, "ha6") != 0) {
+	if (build_ha(acl6, ARRAY_LEN(acl6), &ha6, "ha6", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
-	if (build_ha(acl7, ARRAY_LEN(acl7), &ha7, "ha7") != 0) {
+	if (build_ha(acl7, ARRAY_LEN(acl7), &ha7, "ha7", &err, test, &res) != 0) {
 		goto acl_cleanup;
 	}
 
diff --git a/tests/test_sched.c b/tests/test_sched.c
index 87b09189f16aec54612892c9ea758fcc2d44dbac..5ad2f5dde533c98af79e9fec77b0536a7d97ce3d 100644
--- a/tests/test_sched.c
+++ b/tests/test_sched.c
@@ -202,7 +202,7 @@ static char *handle_cli_sched_bench(struct ast_cli_entry *e, int cmd, struct ast
 	start = ast_tvnow();
 
 	for (i = 0; i < num; i++) {
-		int when = abs(ast_random()) % 60000;
+		long when = labs(ast_random()) % 60000;
 		if ((sched_ids[i] = ast_sched_add(con, when, sched_cb, NULL)) == -1) {
 			ast_cli(a->fd, "Test failed - sched_add returned -1\n");
 			goto return_cleanup;
diff --git a/tests/test_stringfields.c b/tests/test_stringfields.c
index 712348064f35a262c506f720468605c23224ccae..2eeb83d45f834ec07f667e137e4a9d573bdb7790 100644
--- a/tests/test_stringfields.c
+++ b/tests/test_stringfields.c
@@ -212,7 +212,7 @@ AST_TEST_DEFINE(string_field_test)
 	}
 
 	if (AST_STRING_FIELD_ALLOCATION(test_struct.string2) != strlen("hippopotamus face") + 1) {
-		ast_test_status_update(test, "The allocation amount is incorrect for string2. We expect %lu but it has %hu\n",
+		ast_test_status_update(test, "The allocation amount is incorrect for string2. We expect %lu but it has %d\n",
 				(unsigned long) strlen("hippopotamus face"), AST_STRING_FIELD_ALLOCATION(test_struct.string2) + 1);
 		goto error;
 	} else {
diff --git a/tests/test_strings.c b/tests/test_strings.c
index cf089a8653500f59beb6a03ec66bfd62a765ff1d..4321d4a0392541a792ffd237c85af85c122682a7 100644
--- a/tests/test_strings.c
+++ b/tests/test_strings.c
@@ -390,9 +390,12 @@ AST_TEST_DEFINE(strsep_test)
 static int test_semi(char *string1, char *string2, int test_len)
 {
 	char *test2 = NULL;
-	if (test_len >= 0) {
+
+	if (test_len > 0) {
 		test2 = ast_alloca(test_len);
 		*test2 = '\0';
+	} else if (test_len == 0) {
+		test2 = "";
 	}
 	ast_escape_semicolons(string1, test2, test_len);
 	if (test2 != NULL && strcmp(string2, test2) == 0) {