Previously the lock-free tests were actually testing guarded allocator because the main entry point of tests was switching allocator to the guarded one. There seems to be no allocations happening between the initialization sequence and the fixture's SetUp(), so easiest seems to be just to switch to lockfree implementation in the fixture's SetUp(). The test are passing locally, so the "should work" has high chance of actually being truth :) Differential Revision: https://developer.blender.org/D9584
		
			
				
	
	
		
			27 lines
		
	
	
		
			481 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			481 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* Apache License, Version 2.0 */
 | |
| 
 | |
| #ifndef __GUARDEDALLOC_TEST_UTIL_H__
 | |
| #define __GUARDEDALLOC_TEST_UTIL_H__
 | |
| 
 | |
| #include "testing/testing.h"
 | |
| 
 | |
| #include "MEM_guardedalloc.h"
 | |
| 
 | |
| class LockFreeAllocatorTest : public ::testing::Test {
 | |
|  protected:
 | |
|   virtual void SetUp()
 | |
|   {
 | |
|     MEM_use_lockfree_allocator();
 | |
|   }
 | |
| };
 | |
| 
 | |
| class GuardedAllocatorTest : public ::testing::Test {
 | |
|  protected:
 | |
|   virtual void SetUp()
 | |
|   {
 | |
|     MEM_use_guarded_allocator();
 | |
|   }
 | |
| };
 | |
| 
 | |
| #endif  // __GUARDEDALLOC_TEST_UTIL_H__
 |