diff options
author | Emilio G. Cota <cota@braap.org> | 2016-06-08 14:55:31 -0400 |
---|---|---|
committer | Richard Henderson <rth@twiddle.net> | 2016-06-11 17:11:16 -0700 |
commit | 896a9ee96720c5cc7e00e63943435ccccec54d23 (patch) | |
tree | ee2d66a1fa92b643a8b8e37938cd15154142086c /tests/test-qht-par.c | |
parent | 515864a0d7a2033163e8e08df20b7873bb6287ae (diff) |
qht: add test-qht-par to invoke qht-bench from 'check' target
Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <1465412133-3029-14-git-send-email-cota@braap.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'tests/test-qht-par.c')
-rw-r--r-- | tests/test-qht-par.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/test-qht-par.c b/tests/test-qht-par.c new file mode 100644 index 0000000000..f09e004ec6 --- /dev/null +++ b/tests/test-qht-par.c @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2016, Emilio G. Cota <cota@braap.org> + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#include "qemu/osdep.h" +#include <glib.h> + +#define TEST_QHT_STRING "tests/qht-bench 1>/dev/null 2>&1 -R -S0.1 -D10000 -N1 " + +static void test_qht(int n_threads, int update_rate, int duration) +{ + char *str; + int rc; + + str = g_strdup_printf(TEST_QHT_STRING "-n %d -u %d -d %d", + n_threads, update_rate, duration); + rc = system(str); + g_free(str); + g_assert_cmpint(rc, ==, 0); +} + +static void test_2th0u1s(void) +{ + test_qht(2, 0, 1); +} + +static void test_2th20u1s(void) +{ + test_qht(2, 20, 1); +} + +static void test_2th0u5s(void) +{ + test_qht(2, 0, 5); +} + +static void test_2th20u5s(void) +{ + test_qht(2, 20, 5); +} + +int main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + if (g_test_quick()) { + g_test_add_func("/qht/parallel/2threads-0%updates-1s", test_2th0u1s); + g_test_add_func("/qht/parallel/2threads-20%updates-1s", test_2th20u1s); + } else { + g_test_add_func("/qht/parallel/2threads-0%updates-5s", test_2th0u5s); + g_test_add_func("/qht/parallel/2threads-20%updates-5s", test_2th20u5s); + } + return g_test_run(); +} |