sholsapp / gallocy

A distributed shared memory infrastructure.
27 stars 9 forks source link

Add multithreaded unit tests. #21

Closed sholsapp closed 8 years ago

sholsapp commented 8 years ago

Add tests that use the various allocators in parallel.

sholsapp commented 8 years ago

Under some conditions when actually interposing the allocator, we blow up at random spots, so adding bug tag.

sholsapp commented 8 years ago

Confirmed using a test case like the following that this is an issue for the main application heap.

  282 TEST_F(MallocTests, ParallelCheck) {                                                                                                                    
  283   std::vector<std::thread> threads;                                                                                                                     
  284   for (int i = 0; i < 2; i++) {                                                                                                                         
  285     threads.push_back(std::thread(parallel_test_work));                                                                                                 
  286   }                                                                                                                                                     
  287   for (auto &thread : threads) {                                                                                                                        
  288     fprintf(stderr, "Joining\n");                                                                                                                       
  289     thread.detach();                                                                                                                                    
  290   }                                                                                                                                                     
  291 } 

Where parallel_test_work just does some random allocation/free work.

sholsapp commented 8 years ago

An example of a parallel test exists in test_malloc.cpp in ParallelTest. Use this as a template.