Example #1
0
int
uwvmstatstest(int nargs, char **args)
{
	int i, result;
  char name[NAME_LEN];

	(void)nargs;
	(void)args;

	inititems();
	kprintf("Starting uwvmstatstest...\n");

  kprintf("Initializing vmstats\n");
  vmstats_init();

	for (i=0; i<NTESTTHREADS; i++) {
    snprintf(name, NAME_LEN, "vmstatsthread %d", i);
		result = thread_fork(name, NULL, vmstats_thread, NULL, i);
		if (result) {
			panic("uwvmstatstest: thread_fork failed: %s\n",
			      strerror(result));
		}
	}

	for (i=0; i<NTESTTHREADS; i++) {
		P(donesem);
	}

  vmstats_print();

	cleanitems();
	kprintf("uwvmstatstest done.\n");

	return 0;
}
Example #2
0
int
uwlocktest1(int nargs, char **args)
{
	int i, result;
  char name[NAME_LEN];

	(void)nargs;
	(void)args;

	inititems();
	kprintf("Starting uwlocktest1...\n");

	for (i=0; i<NTESTTHREADS; i++) {
    snprintf(name, NAME_LEN, "add_thread %d", i);
		result = thread_fork(name, NULL, add_thread, NULL, i);
		if (result) {
			panic("uwlocktest1: thread_fork failed: %s\n",
			      strerror(result));
		}
	}

	for (i=0; i<NTESTTHREADS; i++) {
    snprintf(name, NAME_LEN, "sub_thread %d", i);
		result = thread_fork(name, NULL, sub_thread, NULL, i);
		if (result) {
			panic("uwlocktest1: thread_fork failed: %s\n",
			      strerror(result));
		}
	}

	for (i=0; i<NTESTTHREADS*2; i++) {
		P(donesem);
	}

	kprintf("value of test_value = %d should be %d\n", test_value, START_VALUE);
	if (test_value == START_VALUE) {
  	kprintf("TEST SUCCEEDED\n");
  } else {
  	kprintf("TEST FAILED\n");
  }
	KASSERT(test_value == START_VALUE);

	cleanitems();
	kprintf("uwlocktest1 done.\n");

	return 0;
}