コード例 #1
0
int
main(int    argc,
     char **argv)
{
    GError *error = NULL;
    GOptionContext *context;

    g_thread_init(NULL);
    g_type_init();

    g_test_init(&argc, &argv, NULL);

    context = g_option_context_new("- Test Suite Output");
    g_option_context_add_main_entries(context, entries, "test-output");

    if (!g_option_context_parse(context, &argc, &argv, &error)) {
        g_printerr("option parsing failed: %s\n", error->message);
        g_error_free(error);
        exit(1);
    }

    if (option_version) {
        g_print("test-output %s\n",
                VERSION);
        exit(0);
    }

    hrt_log_init(option_debug ?
                 HRT_LOG_FLAG_DEBUG : 0);

    add_one_stream_test("stream",
                        test_stream);

    add_one_stream_test("stream_with_error",
                        test_stream_with_error);

    add_one_stream_test("stream_with_initial_error",
                        test_stream_with_initial_error);

    add_chain_test("chain",
                   test_chain);

    add_chain_test("chain_with_error",
                   test_chain_with_error);

    return g_test_run();
}
コード例 #2
0
int
main(int    argc,
     char **argv)
{
    GError *error = NULL;
    GOptionContext *context;

    g_thread_init(NULL);
    g_type_init();

    g_test_init(&argc, &argv, NULL);

    context = g_option_context_new("- Test Suite Immediate Events");
    g_option_context_add_main_entries(context, entries, "test-immediate");

    if (!g_option_context_parse(context, &argc, &argv, &error)) {
        g_printerr("option parsing failed: %s\n", error->message);
        g_error_free(error);
        exit(1);
    }

    if (option_version) {
        g_print("test-immediate %s\n",
                VERSION);
        exit(0);
    }

    hrt_log_init(option_debug ?
                 HRT_LOG_FLAG_DEBUG : 0);

    g_test_add("/immediate/immediate_that_sleeps_manual_remove_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_that_sleeps_manual_remove,
               teardown_test_fixture);

    g_test_add("/immediate/immediate_that_sleeps_return_false_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_that_sleeps_return_false,
               teardown_test_fixture);

    g_test_add("/immediate/immediate_runs_several_times_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_runs_several_times,
               teardown_test_fixture);

    g_test_add("/immediate/one_task_many_immediates_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_one_task_many_immediates,
               teardown_test_fixture);

    g_test_add("/immediate/many_tasks_many_immediates_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_many_tasks_many_immediates,
               teardown_test_fixture);

    g_test_add("/immediate/performance_many_watchers_few_tasks_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_performance_many_watchers,
               teardown_test_fixture);

    g_test_add("/immediate/performance_many_tasks_few_watchers_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_performance_many_tasks,
               teardown_test_fixture);

    g_test_add("/immediate/immediate_that_sleeps_manual_remove_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_that_sleeps_manual_remove,
               teardown_test_fixture);

    g_test_add("/immediate/immediate_that_sleeps_return_false_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_that_sleeps_return_false,
               teardown_test_fixture);

    g_test_add("/immediate/immediate_runs_several_times_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_runs_several_times,
               teardown_test_fixture);

    g_test_add("/immediate/one_task_many_immediates_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_one_task_many_immediates,
               teardown_test_fixture);

    g_test_add("/immediate/many_tasks_many_immediates_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_many_tasks_many_immediates,
               teardown_test_fixture);

    g_test_add("/immediate/performance_many_watchers_few_tasks_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_performance_many_watchers,
               teardown_test_fixture);

    g_test_add("/immediate/performance_many_tasks_few_watchers_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_performance_many_tasks,
               teardown_test_fixture);

    /* Check that our code runs one way WITHOUT blocking completion */
    g_test_add("/immediate/no_block_completion_libev",
               TestFixture,
               NULL,
               setup_test_fixture_libev,
               test_immediate_block_completion,
               teardown_test_fixture);

    g_test_add("/immediate/no_block_completion_glib",
               TestFixture,
               NULL,
               setup_test_fixture_glib,
               test_immediate_block_completion,
               teardown_test_fixture);

    /* Check that it runs another way WITH block completion */
    g_test_add("/immediate/block_completion_libev",
               TestFixture,
               NULL,
               setup_test_fixture_block_completion_libev,
               test_immediate_block_completion,
               teardown_test_fixture);

    g_test_add("/immediate/block_completion_glib",
               TestFixture,
               NULL,
               setup_test_fixture_block_completion_glib,
               test_immediate_block_completion,
               teardown_test_fixture);

    return g_test_run();
}