Exemplo n.º 1
0
void Test(void *)
{
  TestRealloc();
  Test3();
  
  Test1<10, true, 100>(); 
  Test1<100, true, 100>();
  Test1<1000, true, 100>();
  Test1<10000, true, 100>();
  Test1<10, true, 100>();
  Test1<100, true, 100>();
  Test1<1000, true, 100>();
  Test1<10000, true, 100>();
  Test1<10, false, 100>();
  Test1<100, false, 100>();
  Test1<1000, false, 100>();
  Test1<10, false, 100>();
  Test1<100, false, 100>();
  Test1<1000, false, 100>();

  TestSTL();
  TestSTL();
  TestSTL2();
  TestSTL2();

  TestRealloc();
}
Exemplo n.º 2
0
int main(int argc, char *argv[]) {
  if (argc == 2) {
    g_num_test_loops = atoi(argv[1]);
  }
  TestTlsAndSync();
  TestManyThreadsJoinable();
  TestManyThreadsDetached();
  TestSemaphores();
  TestSemaphoreInitDestroy();
  TestPthreadOnce();
  TestRecursiveMutex();
  TestErrorCheckingMutex();
  TestTSD();
  TestMalloc();
  TestRealloc();
  TestIntrinsics();
  TestCondvar();

  return g_errors;
}
Exemplo n.º 3
0
int main(int argc, char * argv[])
{
    PIN_Init(argc, argv);


    // Test realloc to larger and smaller sizes
    
    void * ptr1 = malloc(20);
    if (ptr1 == NULL) 
    {
        std::cerr << "Malloc failed\n";
        exit(-1);
    }

    std::cerr << "Malloc : " << hex << ptr1 << dec << std::endl;
    
    if (TestRealloc(ptr1, 20)) 
    {
        std::cerr << "Realloc of simple malloc failed\n";
        return -1;
    }

    // Test realloc of small chunk aligned at small value
    void * ptr2 = memalign(32, 400);
    if (ptr2 == NULL) 
    {
        std::cerr << "Memalign failed\n";
        exit(-1);
    }
    
    std::cerr << "Memalign : " << hex << ptr2 << dec << std::endl;

    if (TestRealloc(ptr2, 400)) 
    {
        std::cerr << "Realloc of small chunk aligned at small boundary failed\n";
        return -1;
    }

    
    // Test realloc of small chunk aligned at large value
    void * ptr3 = memalign(2048, 400);
    if (ptr3 == NULL) 
    {
        std::cerr << "Memalign failed\n";
        exit(-1);
    }
    
    std::cerr << "Memalign : " << hex << ptr3 << dec << std::endl;

    if (TestRealloc(ptr3, 400)) 
    {
        std::cerr << "Realloc of small chunk aligned at large boundary failed\n";
        return -1;
    }
    
    // Test realloc of large chunk aligned at large value
    void * ptr4 = memalign(2048, 400000);
    if (ptr4 == NULL) 
    {
        std::cerr << "Memalign failed\n";
        exit(-1);
    }
    
    std::cerr << "Memalign : " << hex << ptr4 << dec << std::endl;
    
    if (TestRealloc(ptr4, 400000)) 
    {
        std::cerr << "Realloc of large chunk aligned at large boundary failed\n";
        return -1;
    }
    
    // Never returns
    PIN_StartProgram();
    
}