Lines Matching refs:g_ctx
78 static struct zuc_context g_ctx = { variable
115 return g_ctx.curr_test ? in zuc_has_skip()
116 test_has_skip(g_ctx.curr_test) : false; in zuc_has_skip()
122 return g_ctx.curr_test ? in zuc_has_failure()
123 test_has_failure(g_ctx.curr_test) : false; in zuc_has_failure()
129 g_ctx.filter = strdup(filter); in zuc_set_filter()
135 g_ctx.repeat = repeat; in zuc_set_repeat()
141 g_ctx.random = random; in zuc_set_random()
147 g_ctx.spawn = spawn; in zuc_set_spawn()
153 g_ctx.break_on_failure = break_on_failure; in zuc_set_break_on_failure()
159 g_ctx.output_junit = enable; in zuc_set_output_junit()
300 g_ctx.case_count = case_count; in register_tests()
301 g_ctx.cases = case_array; in register_tests()
506 if (g_ctx.fatal) in initialize()
509 if (g_ctx.random > 1) { in initialize()
510 g_ctx.seed = g_ctx.random; in initialize()
511 } else if (g_ctx.random == 1) { in initialize()
512 g_ctx.seed = get_seed_from_time(); in initialize()
515 if (g_ctx.case_count) { in initialize()
516 order_cases(g_ctx.case_count, g_ctx.cases); in initialize()
517 if (g_ctx.filter && g_ctx.filter[0]) in initialize()
518 filter_cases(&g_ctx.case_count, g_ctx.cases, in initialize()
519 g_ctx.filter); in initialize()
583 if (g_ctx.fatal) in zuc_initialize()
822 dispatch_check_triggered(&g_ctx, in migrate_deferred_events()
854 if (g_ctx.break_on_failure) in mark_single_failed()
862 if (!test && g_ctx.curr_test) in mark_failed()
863 test = g_ctx.curr_test; in mark_failed()
867 } else if (g_ctx.curr_case) { in mark_failed()
870 for (i = 0; i < g_ctx.curr_case->test_count; ++i) in mark_failed()
871 mark_single_failed(g_ctx.curr_case->tests[i], state); in mark_failed()
874 g_ctx.fatal = true; in mark_failed()
918 if (!g_ctx.listeners) { in zuc_add_event_listener()
919 g_ctx.listeners = zalloc(sizeof(struct zuc_slinked)); in zuc_add_event_listener()
920 ZUC_ASSERT_NOT_NULL(g_ctx.listeners); in zuc_add_event_listener()
921 g_ctx.listeners->data = event_listener; in zuc_add_event_listener()
923 struct zuc_slinked *curr = g_ctx.listeners; in zuc_add_event_listener()
938 free(g_ctx.filter); in zuc_cleanup()
939 g_ctx.filter = 0; in zuc_cleanup()
941 if (g_ctx.fds[i] != -1) { in zuc_cleanup()
942 close(g_ctx.fds[i]); in zuc_cleanup()
943 g_ctx.fds[i] = -1; in zuc_cleanup()
946 if (g_ctx.listeners) { in zuc_cleanup()
947 struct zuc_slinked *curr = g_ctx.listeners; in zuc_cleanup()
957 g_ctx.listeners = NULL; in zuc_cleanup()
960 for (i = g_ctx.case_count - 1; i >= 0; --i) { in zuc_cleanup()
961 free_test_case(g_ctx.cases[i]); in zuc_cleanup()
962 g_ctx.cases[i] = NULL; in zuc_cleanup()
964 free(g_ctx.cases); in zuc_cleanup()
965 g_ctx.cases = NULL; in zuc_cleanup()
1010 if (g_ctx.fatal) in zuc_list_tests()
1012 for (i = 0; i < g_ctx.case_count; ++i) { in zuc_list_tests()
1013 printf("%s.\n", g_ctx.cases[i]->name); in zuc_list_tests()
1014 for (j = 0; j < g_ctx.cases[i]->test_count; ++j) { in zuc_list_tests()
1015 printf(" %s\n", g_ctx.cases[i]->tests[j]->name); in zuc_list_tests()
1029 if (pipe2(g_ctx.fds, O_CLOEXEC)) { in spawn_test()
1043 close(g_ctx.fds[0]); in spawn_test()
1044 g_ctx.fds[0] = -1; in spawn_test()
1045 close(g_ctx.fds[1]); in spawn_test()
1046 g_ctx.fds[1] = -1; in spawn_test()
1050 close(g_ctx.fds[0]); in spawn_test()
1051 g_ctx.fds[0] = -1; in spawn_test()
1074 close(g_ctx.fds[1]); in spawn_test()
1075 g_ctx.fds[1] = -1; in spawn_test()
1078 rc = zuc_process_message(g_ctx.curr_test, in spawn_test()
1079 g_ctx.fds[0]); in spawn_test()
1081 close(g_ctx.fds[0]); in spawn_test()
1082 g_ctx.fds[0] = -1; in spawn_test()
1096 if (!test_has_skip(g_ctx.curr_test) && in spawn_test()
1097 !test_has_failure(g_ctx.curr_test)) in spawn_test()
1102 if (!test_has_failure(g_ctx.curr_test)) in spawn_test()
1132 g_ctx.curr_test = test; in run_single_test()
1133 dispatch_test_started(&g_ctx, test); in run_single_test()
1181 dispatch_test_ended(&g_ctx, test); in run_single_test()
1183 g_ctx.curr_test = NULL; in run_single_test()
1190 g_ctx.curr_case = test_case; in run_single_case()
1196 dispatch_case_started(&g_ctx, test_case, in run_single_case()
1205 dispatch_test_disabled(&g_ctx, curr); in run_single_case()
1208 g_ctx.spawn); in run_single_case()
1224 dispatch_case_ended(&g_ctx, test_case); in run_single_case()
1226 g_ctx.curr_case = NULL; in run_single_case()
1268 reset_test_values(g_ctx.cases, g_ctx.case_count); in run_single_pass()
1269 for (i = 0; i < g_ctx.case_count; ++i) { in run_single_pass()
1270 int live = g_ctx.cases[i]->test_count in run_single_pass()
1271 - g_ctx.cases[i]->disabled; in run_single_pass()
1276 if (g_ctx.cases[i]->disabled) in run_single_pass()
1280 dispatch_run_started(&g_ctx, live_case_count, live_test_count, in run_single_pass()
1283 for (i = 0; i < g_ctx.case_count; ++i) { in run_single_pass()
1284 run_single_case(g_ctx.cases[i]); in run_single_pass()
1285 total_failed += g_ctx.cases[i]->test_count in run_single_pass()
1286 - (g_ctx.cases[i]->passed + g_ctx.cases[i]->disabled); in run_single_pass()
1287 total_passed += g_ctx.cases[i]->passed; in run_single_pass()
1288 total_elapsed += g_ctx.cases[i]->elapsed; in run_single_pass()
1289 total_skipped += g_ctx.cases[i]->skipped; in run_single_pass()
1292 dispatch_run_ended(&g_ctx, live_case_count, live_test_count, in run_single_pass()
1309 int limit = g_ctx.repeat > 0 ? g_ctx.repeat : 1; in zucimpl_run_tests()
1312 if (g_ctx.fatal) in zucimpl_run_tests()
1315 if (g_ctx.listeners == NULL) { in zucimpl_run_tests()
1316 zuc_add_event_listener(zuc_collector_create(&(g_ctx.fds[1]))); in zucimpl_run_tests()
1318 if (g_ctx.output_junit) in zucimpl_run_tests()
1322 if (g_ctx.case_count < 1) { in zucimpl_run_tests()
1328 for (i = 0; (i < limit) && (g_ctx.case_count > 0); ++i) { in zucimpl_run_tests()
1330 dispatch_pre_run(&g_ctx, limit, i + 1, in zucimpl_run_tests()
1331 (g_ctx.random > 0) ? g_ctx.seed : 0, in zucimpl_run_tests()
1332 g_ctx.filter); in zucimpl_run_tests()
1334 order_cases(g_ctx.case_count, g_ctx.cases); in zucimpl_run_tests()
1335 if (g_ctx.random > 0) in zucimpl_run_tests()
1336 shuffle_cases(g_ctx.case_count, g_ctx.cases, in zucimpl_run_tests()
1337 g_ctx.seed); in zucimpl_run_tests()
1345 g_ctx.seed++; in zucimpl_run_tests()
1366 dispatch_collect_event(&g_ctx, in zucimpl_tracepoint()
1389 mark_failed(g_ctx.curr_test, state); in zucimpl_terminate()
1391 if ((state != ZUC_CHECK_OK) && g_ctx.curr_test) in zucimpl_terminate()
1392 migrate_deferred_events(g_ctx.curr_test, false); in zucimpl_terminate()
1394 dispatch_check_triggered(&g_ctx, in zucimpl_terminate()
1564 mark_failed(g_ctx.curr_test, state); in zucimpl_expect_pred2()
1566 if (g_ctx.curr_test) in zucimpl_expect_pred2()
1567 migrate_deferred_events(g_ctx.curr_test, false); in zucimpl_expect_pred2()
1569 dispatch_check_triggered(&g_ctx, in zucimpl_expect_pred2()