Пример #1
0
/* *INDENT-OFF* */
END_PARAMETRIZED_TEST
/* *INDENT-ON* */

/* --------------------------------------------------------------------------------------------- */

int
main (void)
{
    int number_failed;

    Suite *s = suite_create (TEST_SUITE_NAME);
    TCase *tc_core = tcase_create ("Core");
    SRunner *sr;

    tcase_add_checked_fixture (tc_core, setup, teardown);

    /* Add new tests here: *************** */
    mctest_add_parameterized_test (tc_core, test_path_recode, test_path_recode_ds);
    mctest_add_parameterized_test (tc_core, test_path_to_str_flags, test_path_to_str_flags_ds);
    /* *********************************** */

    suite_add_tcase (s, tc_core);
    sr = srunner_create (s);
    srunner_print (sr, CK_VERBOSE);
    srunner_set_log (sr, "path_recode.log");
    srunner_run_all (sr, CK_NORMAL);
    number_failed = srunner_ntests_failed (sr);
    srunner_free (sr);
    return (number_failed == 0) ? 0 : 1;
}
Пример #2
0
END_TEST

/* --------------------------------------------------------------------------------------------- */


int
main (void)
{
    int number_failed;

    Suite *s = suite_create (TEST_SUITE_NAME);
    TCase *tc_core = tcase_create ("Core");
    SRunner *sr;

    tcase_add_checked_fixture (tc_core, setup, teardown);

    /* Add new tests here: *************** */
    tcase_add_test (tc_core, test_path_recode_base_utf8);
    tcase_add_test (tc_core, test_path_recode_base_koi8r);
    tcase_add_test (tc_core, test_path_to_str_flags);
    tcase_add_test (tc_core, test_encode_info_at_start);
    /* *********************************** */

    suite_add_tcase (s, tc_core);
    sr = srunner_create (s);
    srunner_print (sr, CK_VERBOSE);
    srunner_set_log (sr, "path_recode.log");
    srunner_run_all (sr, CK_NORMAL);
    number_failed = srunner_ntests_failed (sr);
    srunner_free (sr);
    return (number_failed == 0) ? 0 : 1;
}
Пример #3
0
int main(int argc, char* argv[]) {
	int failed;
	SRunner* runner;

	Suite* suite = suite_create("Cardy");
	add_memory_tests(suite);
	add_card_tests(suite);
	add_rule_tests(suite);
	add_theme_tests(suite);
	add_render_tests(suite);
	add_sol_heirship_tests(suite);
	add_sol_theidiot_tests(suite);
	add_sol_malteser_tests(suite);
	add_sol_noname1_tests(suite);
	add_sol_test1_tests(suite);
	add_ease_tests(suite);
	add_expression_tests(suite);
	add_expression_lib_tests(suite);
	add_render_widget_tests(suite);
	add_game_registry_tests(suite);
	add_game_system_tests(suite);
	add_network_tests(suite);

	runner = srunner_create(suite);
	if(argc == 2 && strcmp(argv[1], "--debug") == 0) {
		srunner_set_fork_status(runner, CK_NOFORK);
	}
	srunner_run_all(runner, CK_VERBOSE);

	/* We want a summary at the end as well */
	srunner_print(runner, CK_MINIMAL);

	failed = srunner_ntests_failed(runner);
	srunner_free(runner);

	return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
Пример #4
0
int main(int argc, char *argv[]) {

	SRunner *sr;
	int_t failed = 0;
	time_t prog_start, test_start, test_end;

	if (process_kill(PLACER("magmad", 18), SIGTERM, 10) < 0) {
		log_unit("Another instance of the Magma Daemon is already running and refuses to die.");
		exit(EXIT_FAILURE);
	}

	// Setup
	prog_start = time(NULL);

	// Updates the location of the config file if it was specified on the command line.
	check_args_parse(argc, argv);

	if (do_virus_check && !virus_check_data_path) {
		virus_check_data_path = ns_dupe(VIRUS_CHECK_DATA_PATH);
	}

	if (do_tank_check && !tank_check_data_path) {
		tank_check_data_path = ns_dupe(TANK_CHECK_DATA_PATH);
	}

	if (do_dspam_check && !dspam_check_data_path) {
		dspam_check_data_path = ns_dupe(DSPAM_CHECK_DATA_PATH);
	}

	/*if (do_virus_check) printf("doing virus check: [%s]\n", !virus_check_data_path ? "NONE" : virus_check_data_path); else printf ("skipping virus check\n");
	if (do_tank_check) printf("doing tank check: [%s]\n", !tank_check_data_path ? "NONE" : tank_check_data_path); else printf ("skipping tank check\n");
	if (do_dspam_check) printf("doing dspam check: [%s]\n", !dspam_check_data_path ? "NONE" : dspam_check_data_path); else printf ("skipping dspam check\n");
	printf("config file: [%s]\n", magma.config.file);
	exit(EXIT_SUCCESS);*/

	if (!process_start()) {
		log_unit("Initialization error. Exiting.\n");
		status_set(-1);
		process_stop();
		exit(EXIT_FAILURE);
	}

	// Only during development...
	cache_flush();

	// Unit Test Config
	sr = srunner_create(suite_check_magma());

	// Add the suites.
	srunner_add_suite(sr, suite_check_core());
	srunner_add_suite(sr, suite_check_provide());
	srunner_add_suite(sr, suite_check_network());
	srunner_add_suite(sr, suite_check_objects());
	srunner_add_suite(sr, suite_check_users());

	// If were being run under Valgrind, we need to disable forking and increase the default timeout.
	// Under Valgrind, forked checks appear to improperly timeout.
	if (RUNNING_ON_VALGRIND == 0 && (failed = running_on_debugger()) == 0) {
		log_unit("Not being traced or profiled...\n");
		srunner_set_fork_status (sr, CK_FORK);
		case_timeout = RUN_TEST_CASE_TIMEOUT;
	}
	else {
		// Trace detection attempted was thwarted.
		if (failed == -1)	log_unit("Trace detection was thwarted.\n");
		else log_unit("Tracing or debugging is active...\n");
		srunner_set_fork_status (sr, CK_NOFORK);
		case_timeout = PROFILE_TEST_CASE_TIMEOUT;
	}

	// Execute
	log_unit("--------------------------------------------------------------------------\n");

	test_start = time(NULL);
	srunner_run_all(sr, CK_SILENT);
	test_end = time(NULL);

	// Output timing.
	log_unit("--------------------------------------------------------------------------\n");
	log_unit("%-63.63s %9lus\n", "TEST DURATION:", test_end - test_start);
	log_unit("%-63.63s %9lus\n", "TOTAL DURATION:", test_end - prog_start);

	// Summary
	log_unit("--------------------------------------------------------------------------\n");
	failed = srunner_ntests_failed(sr);
	srunner_print(sr, CK_NORMAL);

	// The Check Output Ending
	log_unit("--------------------------------------------------------------------------\n");

	// Cleanup and free the resources allocated by the check code.
	status_set(-1);
	srunner_free(sr);

	ns_cleanup(virus_check_data_path);
	ns_cleanup(tank_check_data_path);
	ns_cleanup(dspam_check_data_path);

	// Cleanup and free the resources allocated by the magma code.
	process_stop();
	system_init_umask();

	exit((failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
}