Commit 18aa5546 authored by Davide Galassi's avatar Davide Galassi

Malloc tests improvement

parent 504e509c
Pipeline #59967273 passed with stages
in 2 minutes and 25 seconds
......@@ -274,10 +274,10 @@ static void mpi_dispatch(int argc, char *argv[])
static struct malloc_fail_args g_malloc_fail_tests[] = {
{ 5, { "Baseline", "mpi_mul_baseline", "12345678", "12345678", "14b66dc1df4d840" }},
{ 5, { "Comba", "mpi_mul_comba", "12345678", "12345678", "14b66dc1df4d840" }},
{ 5, { "Karatsuba", "mpi_mul_karatsuba", "FFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFF", "fffffffffffffffe0000000000000001" }},
{ 5, { "Toom-3", "mpi_mul_toom3", "FFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFF", "fffffffffffffffe0000000000000001" }},
{ 5, { "Multiply Baseline", "mpi_mul_baseline", "12345678", "12345678", "14b66dc1df4d840" }},
{ 5, { "Multiply Comba", "mpi_mul_comba", "12345678", "12345678", "14b66dc1df4d840" }},
{ 5, { "Multiply Karatsuba", "mpi_mul_karatsuba", "FFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFF", "fffffffffffffffe0000000000000001" }},
{ 5, { "Multiply Toom-3", "mpi_mul_toom3", "FFFFFFFFFFFFFFFF", "FFFFFFFFFFFFFFFF", "fffffffffffffffe0000000000000001" }},
};
......@@ -285,7 +285,7 @@ void mpi_test(void)
{
printf("* MPI\n");
func_test("mpi_test.data", mpi_dispatch);
malloc_fail_tests(g_malloc_fail_tests, ARLEN(g_malloc_fail_tests),
mpi_dispatch);
malloc_fail_tests(g_malloc_fail_tests,
ARLEN(g_malloc_fail_tests), mpi_dispatch);
printf("\n");
}
......@@ -157,16 +157,19 @@ void malloc_fail_tests(struct malloc_fail_args *args, size_t num,
{
size_t i, fail_after;
printf(" Malloc fails\n");
if (g_verbose != 0)
printf(" Malloc fails\n");
for (i = 0; i < num; i++) {
printf(" %s \n", args[i].argv[0]);
if (g_verbose != 0)
printf(" %s \n", args[i].argv[0]);
fail_after = 0;
do {
g_malloc_mock_state = MALLOC_MOCK_READY;
g_malloc_mock_count = fail_after++;
dispatch(args[i].argc - 1, args[i].argv + 1);
} while (g_malloc_mock_state == MALLOC_MOCK_FAILED);
printf(" count: %u\n", (unsigned)fail_after);
if (g_verbose != 0)
printf(" fail-counter: %u\n", (unsigned)fail_after);
}
g_malloc_mock_state = MALLOC_MOCK_STOPPED;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment