Fix more dev-mode build issues

........

Merged revisions 419129 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 419162 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@419163 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kinsey Moore
2014-07-22 14:13:14 +00:00
parent 29ca8a873b
commit 838b0014f9
23 changed files with 82 additions and 73 deletions

View File

@@ -113,6 +113,15 @@ static struct ast_frame *create_test_frame(long timestamp,
return AST_TEST_FAIL; \
} } while (0)
/*! \internal
* \brief Test two numeric (unsigned int) values.
*/
#define UINT_TEST(actual, expected) do { \
if ((actual) != (expected)) { \
ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \
return AST_TEST_FAIL; \
} } while (0)
/*! \internal
* \brief Test two string values
*/
@@ -126,7 +135,7 @@ static struct ast_frame *create_test_frame(long timestamp,
* \brief Verify that two frames have the same properties
*/
#define VERIFY_FRAME(actual, expected) do { \
INT_TEST((actual)->frametype, (expected)->frametype); \
UINT_TEST((actual)->frametype, (expected)->frametype); \
INT_TEST((actual)->seqno, (expected)->seqno); \
LONG_INT_TEST((actual)->ts, (expected)->ts); \
LONG_INT_TEST((actual)->len, (expected)->len); \

View File

@@ -411,7 +411,7 @@ AST_TEST_DEFINE(aoc_encode_decode_test)
if (!(unit = ast_aoc_get_unit_info(decoded, i)) ||
((unit->valid_amount) && (unit->amount != (i+1))) ||
((unit->valid_type) && (unit->type != (i+2)))) {
ast_test_status_update(test, "TEST 2, invalid unit entry result, got %d,%d, expected %d,%d\n",
ast_test_status_update(test, "TEST 2, invalid unit entry result, got %u,%u, expected %d,%d\n",
unit->amount,
unit->type,
i+1,

View File

@@ -489,7 +489,7 @@ static int astobj2_test_1_helper(int tst_num, enum test_container_type type, int
}
}
ast_test_status_update(test, "%s container created: buckets: %d, items: %d\n",
ast_test_status_update(test, "%s container created: buckets: %d, items: %u\n",
c_type, n_buckets, lim);
/* Testing ao2_container_clone */

View File

@@ -82,7 +82,7 @@ static char *ht_new(int i)
if (keybuf == NULL) {
return NULL;
}
needed = snprintf(keybuf, buflen, "key%08x", i);
needed = snprintf(keybuf, buflen, "key%08x", (unsigned)i);
ast_atomic_fetchadd_int(&alloc_count, 1);
ast_assert(needed + 1 <= buflen);
return keybuf;

View File

@@ -885,19 +885,19 @@ AST_TEST_DEFINE(config_options_test)
arr[3] = item_defaults;
/* Test global and item against configs, global_defaults and item_defaults against defaults */
#define NOT_EQUAL_FAIL(field) \
#define NOT_EQUAL_FAIL(field, format) \
if (arr[x]->field != control->field) { \
ast_test_status_update(test, "%s did not match: %d != %d with x = %d\n", #field, arr[x]->field, control->field, x); \
ast_test_status_update(test, "%s did not match: " format " != " format " with x = %d\n", #field, arr[x]->field, control->field, x); \
res = AST_TEST_FAIL; \
}
for (x = 0; x < 4; x++) {
struct test_item *control = x < 2 ? &configs : &defaults;
NOT_EQUAL_FAIL(intopt);
NOT_EQUAL_FAIL(uintopt);
NOT_EQUAL_FAIL(boolopt);
NOT_EQUAL_FAIL(flags);
NOT_EQUAL_FAIL(customopt);
NOT_EQUAL_FAIL(intopt, "%d");
NOT_EQUAL_FAIL(uintopt, "%u");
NOT_EQUAL_FAIL(boolopt, "%d");
NOT_EQUAL_FAIL(flags, "%u");
NOT_EQUAL_FAIL(customopt, "%d");
if (fabs(arr[x]->doubleopt - control->doubleopt) > 0.001) {
ast_test_status_update(test, "doubleopt did not match: %f vs %f on loop %d\n", arr[x]->doubleopt, control->doubleopt, x);
res = AST_TEST_FAIL;

View File

@@ -58,7 +58,7 @@ static int check_event(struct ast_event *event, struct ast_test *test,
/* Check #1: Ensure event type is set properly. */
type = ast_event_get_type(event);
if (ast_event_get_type(event) != type) {
ast_test_status_update(test, "Expected event type: '%d', got '%d'\n",
ast_test_status_update(test, "Expected event type: '%u', got '%u'\n",
expected_type, type);
return -1;
}

View File

@@ -120,7 +120,7 @@ static void test_set(struct ast_format_attr *fattr, va_list ap)
}
break;
default:
ast_log(LOG_WARNING, "unknown attribute type %d\n", key);
ast_log(LOG_WARNING, "unknown attribute type %u\n", key);
}
}
}

View File

@@ -83,7 +83,7 @@ static char *ht_new(int i)
if (keybuf == NULL) {
return NULL;
}
needed = snprintf(keybuf, buflen, "key%08x", i);
needed = snprintf(keybuf, buflen, "key%08x", (unsigned)i);
ast_assert(needed + 1 <= buflen);
return keybuf;
}

View File

@@ -85,7 +85,7 @@ static int json_test_cleanup(struct ast_test_info *info, struct ast_test *test)
ast_json_reset_alloc_funcs();
if (0 != alloc_count) {
ast_test_status_update(test,
"JSON test leaked %zd allocations!\n", alloc_count);
"JSON test leaked %zu allocations!\n", alloc_count);
return -1;
}
return 0;

View File

@@ -55,12 +55,12 @@ static void output_tests(struct test *tests, size_t num_tests, int fd)
unsigned int x;
for (x = 0; x < num_tests; x++) {
ast_cli(fd, "Test %d: %s\n", x + 1, tests[x].name);
ast_cli(fd, "\tExpected Successes: %d\n", tests[x].x_success);
ast_cli(fd, "\tExpected Failures: %d\n", tests[x].x_failure);
ast_cli(fd, "\tUnexpected Successes: %d\n", tests[x].u_success);
ast_cli(fd, "\tUnexpected Failures: %d\n", tests[x].u_failure);
ast_cli(fd, "Test %d Result: %s\n", x + 1, (tests[x].u_success + tests[x].u_failure) ? "FAIL" : "PASS");
ast_cli(fd, "Test %u: %s\n", x + 1, tests[x].name);
ast_cli(fd, "\tExpected Successes: %u\n", tests[x].x_success);
ast_cli(fd, "\tExpected Failures: %u\n", tests[x].x_failure);
ast_cli(fd, "\tUnexpected Successes: %u\n", tests[x].u_success);
ast_cli(fd, "\tUnexpected Failures: %u\n", tests[x].u_failure);
ast_cli(fd, "Test %u Result: %s\n", x + 1, (tests[x].u_success + tests[x].u_failure) ? "FAIL" : "PASS");
}
}
@@ -88,11 +88,11 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str
}
for (test = 0; test < ARRAY_LEN(tests); test++) {
ast_cli(a->fd, "Test %d: %s.\n", test + 1, tests[test].name);
ast_cli(a->fd, "Test %u: %s.\n", test + 1, tests[test].name);
switch (test) {
case 0:
if ((level = ast_logger_register_level("test")) != -1) {
ast_cli(a->fd, "Test: got level %d\n", level);
ast_cli(a->fd, "Test: got level %u\n", level);
ast_log_dynamic_level(level, "Logger Dynamic Test: Test 1\n");
ast_logger_unregister_level("test");
tests[test].x_success++;
@@ -106,7 +106,7 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str
char level_name[18][8];
for (x = 0; x < ARRAY_LEN(level_name); x++) {
sprintf(level_name[x], "level%02d", x);
sprintf(level_name[x], "level%02u", x);
if ((level = ast_logger_register_level(level_name[x])) == -1) {
if (x < 16) {
tests[test].u_failure++;
@@ -115,7 +115,7 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str
}
level_name[x][0] = '\0';
} else {
ast_cli(a->fd, "Test: registered '%s', got level %d\n", level_name[x], level);
ast_cli(a->fd, "Test: registered '%s', got level %u\n", level_name[x], level);
if (x < 16) {
tests[test].x_success++;
} else {
@@ -159,7 +159,7 @@ static char *handle_cli_performance_test(struct ast_cli_entry *e, int cmd, struc
}
for (test = 0; test < ARRAY_LEN(tests); test++) {
ast_cli(a->fd, "Test %d: %s.\n", test + 1, tests[test].name);
ast_cli(a->fd, "Test %u: %s.\n", test + 1, tests[test].name);
switch (test) {
case 0:
if ((level = ast_logger_register_level("perftest")) != -1) {
@@ -167,7 +167,7 @@ static char *handle_cli_performance_test(struct ast_cli_entry *e, int cmd, struc
struct timeval start, end;
int elapsed;
ast_cli(a->fd, "Test: got level %d\n", level);
ast_cli(a->fd, "Test: got level %u\n", level);
start = ast_tvnow();
for (x = 0; x < 10000; x++) {
ast_log_dynamic_level(level, "Performance test log message\n");

View File

@@ -99,7 +99,7 @@ AST_TEST_DEFINE(test_provide_first)
test_optional();
if (was_called_result != IMPL) {
ast_test_status_update(test, "Expected %d, was %d",
ast_test_status_update(test, "Expected %d, was %u",
IMPL, was_called_result);
goto done;
}
@@ -135,7 +135,7 @@ AST_TEST_DEFINE(test_provide_last)
test_optional();
if (was_called_result != STUB) {
ast_test_status_update(test, "Expected %d, was %d",
ast_test_status_update(test, "Expected %d, was %u",
STUB, was_called_result);
goto done;
}
@@ -144,7 +144,7 @@ AST_TEST_DEFINE(test_provide_last)
test_optional();
if (was_called_result != IMPL) {
ast_test_status_update(test, "Expected %d, was %d",
ast_test_status_update(test, "Expected %d, was %u",
IMPL, was_called_result);
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
goto done;
@@ -154,7 +154,7 @@ AST_TEST_DEFINE(test_provide_last)
test_optional();
if (was_called_result != STUB) {
ast_test_status_update(test, "Expected %d, was %d",
ast_test_status_update(test, "Expected %d, was %u",
STUB, was_called_result);
ast_optional_api_unprovide(SYMNAME, test_optional_impl);
goto done;

View File

@@ -2906,7 +2906,7 @@ AST_TEST_DEFINE(dialplan_function)
}
if (strcmp(ast_str_buffer(buf), "5")) {
ast_free(buf);
ast_test_status_update(test, "Failed retrieve field. Got '%d', should be '5'\n", obj->bob);
ast_test_status_update(test, "Failed retrieve field. Got '%u', should be '5'\n", obj->bob);
return AST_TEST_FAIL;
}
@@ -2919,7 +2919,7 @@ AST_TEST_DEFINE(dialplan_function)
}
if (strcmp(ast_str_buffer(buf), "5")) {
ast_free(buf);
ast_test_status_update(test, "Failed retrieve field. Got '%d', should be '5'\n", obj->bob);
ast_test_status_update(test, "Failed retrieve field. Got '%u', should be '5'\n", obj->bob);
return AST_TEST_FAIL;
}

View File

@@ -790,11 +790,11 @@ AST_TEST_DEFINE(object_allocate_on_retrieval)
}
if (obj->bob != 42) {
ast_test_status_update(test, "Object's 'bob' field does not have expected value: %d != 42\n",
ast_test_status_update(test, "Object's 'bob' field does not have expected value: %u != 42\n",
obj->bob);
return AST_TEST_FAIL;
} else if (obj->joe != 93) {
ast_test_status_update(test, "Object's 'joe' field does not have expected value: %d != 93\n",
ast_test_status_update(test, "Object's 'joe' field does not have expected value: %u != 93\n",
obj->joe);
return AST_TEST_FAIL;
}
@@ -844,11 +844,11 @@ AST_TEST_DEFINE(object_filter)
}
if (obj->bob != 42) {
ast_test_status_update(test, "Object's 'bob' field does not have expected value: %d != 42\n",
ast_test_status_update(test, "Object's 'bob' field does not have expected value: %u != 42\n",
obj->bob);
return AST_TEST_FAIL;
} else if (obj->joe != 93) {
ast_test_status_update(test, "Object's 'joe' field does not have expected value: %d != 93\n",
ast_test_status_update(test, "Object's 'joe' field does not have expected value: %u != 93\n",
obj->joe);
return AST_TEST_FAIL;
}

View File

@@ -129,7 +129,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
*/
#define VM_API_INT_VERIFY(expected, actual) do { \
if ((expected) != (actual)) { \
ast_test_status_update(test, "Test failed for parameter %s: Expected [%d], Actual [%d]\n", #actual, expected, actual); \
ast_test_status_update(test, "Test failed for parameter %s: Expected [%d], Actual [%d]\n", #actual, (int)expected, (int)actual); \
VM_API_SNAPSHOT_TEST_CLEANUP; \
return AST_TEST_FAIL; \
} } while (0)
@@ -457,9 +457,9 @@ static int test_vm_api_create_voicemail_files(const char *context, const char *m
*/
snprintf(folder_path, sizeof(folder_path), "%s/voicemail/%s/%s/%s",
ast_config_AST_SPOOL_DIR, context, mailbox, snapshot->folder_name);
snprintf(msg_path, sizeof(msg_path), "%s/msg%04d.txt",
snprintf(msg_path, sizeof(msg_path), "%s/msg%04u.txt",
folder_path, snapshot->msg_number);
snprintf(snd_path, sizeof(snd_path), "%s/msg%04d.gsm",
snprintf(snd_path, sizeof(snd_path), "%s/msg%04u.gsm",
folder_path, snapshot->msg_number);
snprintf(beep_path, sizeof(beep_path), "%s/sounds/en/beep.gsm", ast_config_AST_VAR_DIR);
@@ -548,9 +548,9 @@ static void test_vm_api_remove_voicemail(struct ast_vm_msg_snapshot *snapshot)
snprintf(folder_path, sizeof(folder_path), "%s/voicemail/%s/%s/%s",
ast_config_AST_SPOOL_DIR, "default", snapshot->exten, snapshot->folder_name);
snprintf(msg_path, sizeof(msg_path), "%s/msg%04d.txt",
snprintf(msg_path, sizeof(msg_path), "%s/msg%04u.txt",
folder_path, snapshot->msg_number);
snprintf(snd_path, sizeof(snd_path), "%s/msg%04d.gsm",
snprintf(snd_path, sizeof(snd_path), "%s/msg%04u.gsm",
folder_path, snapshot->msg_number);
unlink(msg_path);
unlink(snd_path);