Example #1
0
static int
clay_test(int argc, char **argv)
{
	clay_print_init(
		(int)_clay_callback_count,
		(int)_clay_suite_count,
		""
	);

	if (clay_sandbox() < 0) {
		clay_print_onabort("Failed to sandbox the test runner.\n");
		exit(-1);
	}

	clay_on_init();

	if (argc > 1) {
		clay_parse_args(argc, argv);
	} else {
		size_t i;
		for (i = 0; i < _clay_suite_count; ++i)
			clay_run_suite(&_clay_suites[i]);
	}

	clay_print_shutdown(
		_clay.test_count,
		(int)_clay_suite_count,
		_clay.total_errors
	);

	clay_on_shutdown();

	clay_unsandbox();
	return _clay.total_errors;
}
Example #2
0
static int
clay_test(
	int argc, char **argv,
	const char *suites_str,
	const struct clay_func *callbacks,
	size_t cb_count,
	const struct clay_suite *suites,
	size_t suite_count)
{
	clay_print("Loaded %d suites: %s\n", (int)suite_count, suites_str);

	if (clay_sandbox() < 0) {
		fprintf(stderr,
			"Failed to sandbox the test runner.\n"
			"Testing will proceed without sandboxing.\n");
	}

	if (argc > 1) {
		clay_parse_args(argc, argv,
			callbacks, cb_count, suites, suite_count);

	} else {
		size_t i;
		clay_print("Started\n");

		for (i = 0; i < suite_count; ++i) {
			const struct clay_suite *s = &suites[i];
			clay_run_suite(s);
		}
	}

	clay_print("\n\n");
	clay_report_errors();

	clay_unsandbox();
	return _clay.total_errors;
}
Example #3
0
void
cl_fs_cleanup(void)
{
	clay_unsandbox();
	clay_sandbox();
}