Exemplo n.º 1
0
int
main(int argc, char **argv)
{
	suite_fn suites[] = {
#define SUITE(name) &suite_ ## name,
#include "test/suites.h"
#undef SUITE
		NULL
	};
	static const struct option options[] = {
		{"help", no_argument, NULL, 'h'},
		{"verbose", no_argument, NULL, 'v'},
		{NULL, 0, NULL, 0}
	};
	int verbose = 0;
	int c;
	char *testdir, *dir_before;
	int result;

#ifdef _WIN32
	putenv("CCACHE_DETECT_SHEBANG=1");
#endif

	while ((c = getopt_long(argc, argv, "hv", options, NULL)) != -1) {
		switch (c) {
		case 'h':
			fprintf(stdout, USAGE_TEXT);
			return 0;

		case 'v':
			verbose = 1;
			break;

		default:
			fprintf(stderr, USAGE_TEXT);
			return 1;
		}
	}

	if (getenv("RUN_FROM_BUILD_FARM")) {
		verbose = 1;
	}

	testdir = format("testdir.%d", (int)getpid());
	cct_create_fresh_dir(testdir);
	dir_before = gnu_getcwd();
	cct_chdir(testdir);
	result = cct_run(suites, verbose);
	if (result == 0) {
		cct_chdir(dir_before);
		cct_wipe(testdir);
	}
	free(testdir);
	free(dir_before);
	return result;
}
Exemplo n.º 2
0
void
cct_suite_end()
{
	cct_chdir(dir_before_suite);
	free(dir_before_suite);
	dir_before_suite = NULL;
}
Exemplo n.º 3
0
void
cct_test_end()
{
	if (dir_before_test) {
		cct_chdir(dir_before_test);
		free(dir_before_test);
		dir_before_test = NULL;
	}
}
Exemplo n.º 4
0
void
cct_suite_begin(const char *name)
{
	++total_suites;
	if (verbose) {
		printf("=== SUITE: %s ===\n", name);
	}
	dir_before_suite = gnu_getcwd();
	create_dir(name);
	cct_chdir(name);
	current_suite = name;
}
Exemplo n.º 5
0
void
cct_test_begin(const char *name)
{
	++total_tests;
	if (verbose) {
		printf("--- TEST: %s ---\n", name);
	}
	dir_before_test = gnu_getcwd();
	create_dir(name);
	cct_chdir(name);
	current_test = name;

	putenv("CCACHE_CONFIG_PATH=/dev/null");
	cc_reset();
}