VectorN	*VectorAlloc(int n)
{
    VectorN	*v = (VectorN *)malloc_test(sizeof(VectorN), "VectorAlloc");
    v->len = n;
    v->elem = (double *)malloc_test(sizeof(double) * n,
				    "VectorAlloc 2");

    return v;
}
Matrix	*MatrixAlloc(int n, int m)
{
    Matrix	*a = (Matrix *)malloc_test(sizeof(Matrix), "MatrixAlloc");
    a->nrows = n;
    a->ncols = m;
    a->elem = (double *)malloc_test(sizeof(double) * n * m,
				    "MatrixAlloc 2");

    return a;
}
Example #3
0
int main()
{
	init(50);
  
	int *p = malloc_test(array, 5);
	malloc_test(array, 10);
	free_test(array, p, 5);
	malloc_test(array, 4);
	
	
	gui_show_array(array);
  
	return 0;
}
void run_library_tests(int *run, int *passed)
{
   /*(*run)++; (*passed) += stricmp_test();*/
   /*(*run)++; (*passed) += time_test();*/
   (*run)++; (*passed) += malloc_test();
   (*run)++; (*passed) += calloc_test();
   (*run)++; (*passed) += malloc_aligned_test();
}
Example #5
0
int
main (int argc, char **argv)
{
  malloc_test();
  calloc_test();
  malloc_plus_memset_test();

  return 0;
}
Example #6
0
int main(int argc, char *argv[])
{
  (void) argc;
  (void) argv;

  // NOTE: don't use unbuffered IO - it crashes the threads lib
  //setlinebuf(stdout);
  //setlinebuf(stderr);
  //  thread_init();

  // FIXME: doing a fork() seems to completely hose aio.  

  if( 0 ) {
    system_test();
    sockio_test();
    exit(0);
  }

  system_test();
  sockio_test();
  diskio_test();
  syscall_mapping_test();

  readdir_test();

  malloc_test();
  
//  malloc(10);
//  output("after malloc()\n");
//  strdup("abc");
//  output("after strdup()\n");

  output("DONE\n\n");

  if( 0 ) {
    sleep(2);
    output("sending USR1 to pid=%d\n", getpid());
    kill(getpid(), SIGUSR1);
    sleep(2);
    output("exiting\n");
  }

  return 0;
}
Example #7
0
int main()
{
	// Case 1: malloc tests.
	//	This crashes the kernel when more than 1 thread is doing malloc/
	//	free operations.  Using only one thread, or using my own locks,
	//	reduces the problem, although I still see a reboot once in a while.
	malloc_test();

	// Case 2: single producer, single consumer
	//	The system quickly wedges when I do this.
//	prodcons(1, 1);
	
	// case 3: multi-producer, single consumer
	//	The kernel code looks like it might not handle this case properly.
//	prodcons(2, 1);
	
	// Case 4: multi-consumer, single producer
//	prodcons(1, 2);

	return 0;	
}
Example #8
0
int add_test(int N,FILE* file){
  vector x={malloc(N*sizeof(double)),N};
  vector y={malloc(N*sizeof(double)),N};
  malloc_test(x.vals==NULL || y.vals==NULL);
  for (int i=0; i<N; i++){
    x.vals[i]=(double)i;
    y.vals[i]=(double)(N+i);
  }
  vector z=vec_add(x,y);
  for (int i=0;i<N;i++){
    if(i==N/2){
      fprintf(file,
              "|%6.3f| + |%6.3f| = |%6.3f|\n",x.vals[i],y.vals[i],z.vals[i]);
    } else{
      fprintf(file,
              "|%6.3f|   |%6.3f|   |%6.3f|\n",x.vals[i],y.vals[i],z.vals[i]);
    }
  }
  if (N==3){
    assert(z.vals[0]==3 && z.vals[1]==5 && z.vals[2]==7);
  }
  return 0;
}
Example #9
0
int main() {
    int a = 0;
    array_test();
    int z = 0;
    malloc_test();
}