Merge remote-tracking branch 'remotes/dgilbert/tags/pull-hmp-20180320' into staging
[qemu/ar7.git] / tests / test-qht-par.c
blobd8a83caf5cc05d3f8fa1761dd85346c1d75700f3
1 /*
2 * Copyright (C) 2016, Emilio G. Cota <cota@braap.org>
4 * License: GNU GPL, version 2 or later.
5 * See the COPYING file in the top-level directory.
6 */
7 #include "qemu/osdep.h"
9 #define TEST_QHT_STRING "tests/qht-bench 1>/dev/null 2>&1 -R -S0.1 -D10000 -N1 "
11 static void test_qht(int n_threads, int update_rate, int duration)
13 char *str;
14 int rc;
16 str = g_strdup_printf(TEST_QHT_STRING "-n %d -u %d -d %d",
17 n_threads, update_rate, duration);
18 rc = system(str);
19 g_free(str);
20 g_assert_cmpint(rc, ==, 0);
23 static void test_2th0u1s(void)
25 test_qht(2, 0, 1);
28 static void test_2th20u1s(void)
30 test_qht(2, 20, 1);
33 static void test_2th0u5s(void)
35 test_qht(2, 0, 5);
38 static void test_2th20u5s(void)
40 test_qht(2, 20, 5);
43 int main(int argc, char *argv[])
45 g_test_init(&argc, &argv, NULL);
47 if (g_test_quick()) {
48 g_test_add_func("/qht/parallel/2threads-0%updates-1s", test_2th0u1s);
49 g_test_add_func("/qht/parallel/2threads-20%updates-1s", test_2th20u1s);
50 } else {
51 g_test_add_func("/qht/parallel/2threads-0%updates-5s", test_2th0u5s);
52 g_test_add_func("/qht/parallel/2threads-20%updates-5s", test_2th20u5s);
54 return g_test_run();