test/atom: increase iteration count and print random seed on failure Signed-off-by: Ran Benita <ran@unusedvar.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/test/atom.c b/test/atom.c
index 1d9ab85..592eca6 100644
--- a/test/atom.c
+++ b/test/atom.c
@@ -75,9 +75,10 @@ test_random_strings(void)
table = atom_table_new();
assert(table);
- srand(clock());
+ unsigned seed = (unsigned) clock();
+ srand(seed);
- N = 1 + rand() % 1500;
+ N = 1 + rand() % 100000;
arr = calloc(N, sizeof(*arr));
assert(arr);
@@ -96,6 +97,7 @@ test_random_strings(void)
strlen(string), string);
fprintf(stderr, "new length %lu, string %.*s\n",
arr[i].len, (int) arr[i].len, arr[i].string);
+ fprintf(stderr, "seed: %u\n", seed);
assert(false);
}
@@ -109,6 +111,7 @@ test_random_strings(void)
if (arr[i].atom == XKB_ATOM_NONE) {
fprintf(stderr, "failed to intern! len: %lu, string: %.*s\n",
arr[i].len, (int) arr[i].len, arr[i].string);
+ fprintf(stderr, "seed: %u\n", seed);
assert(false);
}
}
@@ -134,6 +137,7 @@ test_random_strings(void)
}
fprintf(stderr, "END\n");
+ fprintf(stderr, "seed: %u\n", seed);
assert(false);
}
}