示例#1
0
int main(int argc, char **argv)
{
	dynbuffer_t sourcebuf=dynbuffer_init();
	dynbuffer_t dest=dynbuffer_init();
	void (*testproc)();
	char *testname;

	if (argc<3) {
		printf("Expected test and input file\n");
		return 3;
	}

	testname=argv[2];

	stdin=fopen(argv[1], "r");
	if (!stdin) {
		printf("Error opening file\n");
		return 3;
	}

	dynbuffer_read_file(&sourcebuf, stdin);
	source=sourcebuf.contents;
	sourcelen=sourcebuf.pos;

	if (strcmp("tojson", testname)==0) testproc=test_json_to_json;
	else if (strcmp("tobinary", testname)==0) testproc=test_json_to_binary;
	else if (strcmp("dummy", testname)==0) testproc=dummy;
	else if (strcmp("validate", testname)==0) testproc=test_validate;
	else if (strcmp("frombinary", testname)==0) {
		setup_binary_to_json();
		testproc=test_json_from_binary;
	}
	else {
		printf("Unrecognized test name\n");
		return 4;
	}

	testproc();

	start_timer();
	for (iterations=0; iterations<100000; iterations++) {
		testproc();
	}
	print_stats();
	return 0;
}
示例#2
0
文件: kmain.c 项目: dan-boa/kernel2
	int fabertest(kshell_t *kshell, int argc, char **argv)
	{

		KASSERT(kshell!=NULL);
		testproc();
		return 0;

	}
示例#3
0
文件: kmain.c 项目: meganesu/OS-HW2
/**
 * The init thread's function changes depending on how far along your Weenix is
 * developed. Before VM/FI, you'll probably just want to have this run whatever
 * tests you've written (possibly in a new process). After VM/FI, you'll just
 * exec "/bin/init".
 *
 * Both arguments are unused.
 *
 * @param arg1 the first argument (unused)
 * @param arg2 the second argument (unused)
 */
static void *
initproc_run(int arg1, void *arg2)
{
        testproc(arg1, arg2);
        return NULL;
}