So it comes to this...

Put in a whole bunch of stderr output in the wmem tree tests in the hopes that
the next time one of the buildbots randomly (and irreproducibly) fails on this
step we'll have at least a bit of a hint as to where it happened.

svn path=/trunk/; revision=50131
This commit is contained in:
Evan Huus 2013-06-24 21:59:02 +00:00
parent d23f769c0d
commit 29c75dae91
1 changed files with 54 additions and 0 deletions

View File

@ -633,9 +633,13 @@ wmem_test_tree(void)
allocator = wmem_allocator_force_new(WMEM_ALLOCATOR_STRICT); allocator = wmem_allocator_force_new(WMEM_ALLOCATOR_STRICT);
extra_allocator = wmem_allocator_force_new(WMEM_ALLOCATOR_STRICT); extra_allocator = wmem_allocator_force_new(WMEM_ALLOCATOR_STRICT);
fprintf(stderr, "B");
fflush(stderr);
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
g_assert(tree); g_assert(tree);
fprintf(stderr, "C");
fflush(stderr);
/* test basic 32-bit key operations */ /* test basic 32-bit key operations */
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
g_assert(wmem_tree_lookup32(tree, i) == NULL); g_assert(wmem_tree_lookup32(tree, i) == NULL);
@ -645,32 +649,50 @@ wmem_test_tree(void)
wmem_tree_insert32(tree, i, GINT_TO_POINTER(i)); wmem_tree_insert32(tree, i, GINT_TO_POINTER(i));
g_assert(wmem_tree_lookup32(tree, i) == GINT_TO_POINTER(i)); g_assert(wmem_tree_lookup32(tree, i) == GINT_TO_POINTER(i));
} }
fprintf(stderr, "D");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
fprintf(stderr, "E");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
guint32 rand = g_test_rand_int(); guint32 rand = g_test_rand_int();
wmem_tree_insert32(tree, rand, GINT_TO_POINTER(i)); wmem_tree_insert32(tree, rand, GINT_TO_POINTER(i));
g_assert(wmem_tree_lookup32(tree, rand) == GINT_TO_POINTER(i)); g_assert(wmem_tree_lookup32(tree, rand) == GINT_TO_POINTER(i));
} }
fprintf(stderr, "F");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
/* test auto-reset functionality */ /* test auto-reset functionality */
fprintf(stderr, "G");
fflush(stderr);
tree = wmem_tree_new_autoreset(allocator, extra_allocator); tree = wmem_tree_new_autoreset(allocator, extra_allocator);
fprintf(stderr, "H");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
g_assert(wmem_tree_lookup32(tree, i) == NULL); g_assert(wmem_tree_lookup32(tree, i) == NULL);
wmem_tree_insert32(tree, i, GINT_TO_POINTER(i)); wmem_tree_insert32(tree, i, GINT_TO_POINTER(i));
g_assert(wmem_tree_lookup32(tree, i) == GINT_TO_POINTER(i)); g_assert(wmem_tree_lookup32(tree, i) == GINT_TO_POINTER(i));
} }
fprintf(stderr, "I");
fflush(stderr);
wmem_free_all(extra_allocator); wmem_free_all(extra_allocator);
fprintf(stderr, "J");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
g_assert(wmem_tree_lookup32(tree, i) == NULL); g_assert(wmem_tree_lookup32(tree, i) == NULL);
g_assert(wmem_tree_lookup32_le(tree, i) == NULL); g_assert(wmem_tree_lookup32_le(tree, i) == NULL);
} }
fprintf(stderr, "K");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
/* test array key functionality */ /* test array key functionality */
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
fprintf(stderr, "L");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
key_count = g_random_int_range(1, WMEM_TREE_MAX_KEY_COUNT); key_count = g_random_int_range(1, WMEM_TREE_MAX_KEY_COUNT);
keys[key_count].length = 0; keys[key_count].length = 0;
@ -682,17 +704,25 @@ wmem_test_tree(void)
wmem_tree_insert32_array(tree, keys, GINT_TO_POINTER(i)); wmem_tree_insert32_array(tree, keys, GINT_TO_POINTER(i));
g_assert(wmem_tree_lookup32_array(tree, keys) == GINT_TO_POINTER(i)); g_assert(wmem_tree_lookup32_array(tree, keys) == GINT_TO_POINTER(i));
} }
fprintf(stderr, "M");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
fprintf(stderr, "N");
fflush(stderr);
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
keys[0].length = 1; keys[0].length = 1;
keys[0].key = wmem_new(allocator, guint32); keys[0].key = wmem_new(allocator, guint32);
*(keys[0].key) = 0; *(keys[0].key) = 0;
keys[1].length = 0; keys[1].length = 0;
fprintf(stderr, "O");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
wmem_tree_insert32_array(tree, keys, GINT_TO_POINTER(i)); wmem_tree_insert32_array(tree, keys, GINT_TO_POINTER(i));
*(keys[0].key) += 4; *(keys[0].key) += 4;
} }
fprintf(stderr, "P");
fflush(stderr);
*(keys[0].key) = 0; *(keys[0].key) = 0;
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
g_assert(wmem_tree_lookup32_array(tree, keys) == GINT_TO_POINTER(i)); g_assert(wmem_tree_lookup32_array(tree, keys) == GINT_TO_POINTER(i));
@ -703,9 +733,13 @@ wmem_test_tree(void)
} }
*(keys[0].key) += 1; *(keys[0].key) += 1;
} }
fprintf(stderr, "Q");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
/* test string key functionality */ /* test string key functionality */
fprintf(stderr, "R");
fflush(stderr);
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
str_key = wmem_test_rand_string(allocator, 1, 64); str_key = wmem_test_rand_string(allocator, 1, 64);
@ -713,9 +747,13 @@ wmem_test_tree(void)
g_assert(wmem_tree_lookup_string(tree, str_key, 0) == g_assert(wmem_tree_lookup_string(tree, str_key, 0) ==
GINT_TO_POINTER(i)); GINT_TO_POINTER(i));
} }
fprintf(stderr, "S");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
fprintf(stderr, "T");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
str_key = wmem_test_rand_string(allocator, 1, 64); str_key = wmem_test_rand_string(allocator, 1, 64);
wmem_tree_insert_string(tree, str_key, GINT_TO_POINTER(i), wmem_tree_insert_string(tree, str_key, GINT_TO_POINTER(i),
@ -723,11 +761,15 @@ wmem_test_tree(void)
g_assert(wmem_tree_lookup_string(tree, str_key, g_assert(wmem_tree_lookup_string(tree, str_key,
WMEM_TREE_STRING_NOCASE) == GINT_TO_POINTER(i)); WMEM_TREE_STRING_NOCASE) == GINT_TO_POINTER(i));
} }
fprintf(stderr, "U");
fflush(stderr);
wmem_free_all(allocator); wmem_free_all(allocator);
/* test for-each functionality */ /* test for-each functionality */
tree = wmem_tree_new(allocator); tree = wmem_tree_new(allocator);
expected_user_data = GINT_TO_POINTER(g_test_rand_int()); expected_user_data = GINT_TO_POINTER(g_test_rand_int());
fprintf(stderr, "V");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
gint tmp; gint tmp;
do { do {
@ -736,23 +778,31 @@ wmem_test_tree(void)
value_seen[i] = FALSE; value_seen[i] = FALSE;
wmem_tree_insert32(tree, tmp, GINT_TO_POINTER(i)); wmem_tree_insert32(tree, tmp, GINT_TO_POINTER(i));
} }
fprintf(stderr, "W");
fflush(stderr);
cb_called_count = 0; cb_called_count = 0;
cb_continue_count = CONTAINER_ITERS; cb_continue_count = CONTAINER_ITERS;
wmem_tree_foreach(tree, wmem_test_foreach_cb, expected_user_data); wmem_tree_foreach(tree, wmem_test_foreach_cb, expected_user_data);
g_assert(cb_called_count == CONTAINER_ITERS); g_assert(cb_called_count == CONTAINER_ITERS);
g_assert(cb_continue_count == 0); g_assert(cb_continue_count == 0);
fprintf(stderr, "X");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
g_assert(value_seen[i]); g_assert(value_seen[i]);
value_seen[i] = FALSE; value_seen[i] = FALSE;
} }
fprintf(stderr, "Y");
fflush(stderr);
cb_called_count = 0; cb_called_count = 0;
cb_continue_count = 10; cb_continue_count = 10;
wmem_tree_foreach(tree, wmem_test_foreach_cb, expected_user_data); wmem_tree_foreach(tree, wmem_test_foreach_cb, expected_user_data);
g_assert(cb_called_count == 10); g_assert(cb_called_count == 10);
g_assert(cb_continue_count == 0); g_assert(cb_continue_count == 0);
fprintf(stderr, "Z");
fflush(stderr);
for (i=0; i<CONTAINER_ITERS; i++) { for (i=0; i<CONTAINER_ITERS; i++) {
if (value_seen[i]) { if (value_seen[i]) {
@ -760,9 +810,13 @@ wmem_test_tree(void)
} }
} }
g_assert(seen_values == 10); g_assert(seen_values == 10);
fprintf(stderr, "0");
fflush(stderr);
wmem_destroy_allocator(extra_allocator); wmem_destroy_allocator(extra_allocator);
wmem_destroy_allocator(allocator); wmem_destroy_allocator(allocator);
fprintf(stderr, "1");
fflush(stderr);
} }
int int