mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	tests: prevent busted from reloading the ffi module and others
It turns out that Busted started cleaning the environment in 2.0rc5 as a result of Olivine-Labs/busted#62. This, in turn, caused the ffi module to be reloaded for each spec file, and LuaJIT doesn't appreciate it. The net effect is an assertion error in LuaJIT. By using the --helper feature of Busted, we can pre-load some modules ahead of Busted and prevent it from reloading them--making LuaJIT happy again.
This commit is contained in:
		@@ -15,6 +15,7 @@ endif()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
execute_process(
 | 
					execute_process(
 | 
				
			||||||
  COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
 | 
					  COMMAND ${BUSTED_PRG} -v -o ${BUSTED_OUTPUT_TYPE}
 | 
				
			||||||
 | 
					    --helper=${TEST_DIR}/${TEST_TYPE}/preload.lua
 | 
				
			||||||
    --lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
 | 
					    --lpath=${BUILD_DIR}/?.lua ${TEST_PATH}
 | 
				
			||||||
  WORKING_DIRECTORY ${WORKING_DIR}
 | 
					  WORKING_DIRECTORY ${WORKING_DIR}
 | 
				
			||||||
  ERROR_VARIABLE err
 | 
					  ERROR_VARIABLE err
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								test/functional/preload.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								test/functional/preload.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					-- Modules loaded here will not be cleared and reloaded by Busted.
 | 
				
			||||||
 | 
					-- Busted started doing this to help provide more isolation.  See issue #62
 | 
				
			||||||
 | 
					-- for more information about this.
 | 
				
			||||||
 | 
					local ffi = require('ffi')
 | 
				
			||||||
 | 
					local helpers = require('test.functional.helpers')
 | 
				
			||||||
							
								
								
									
										7
									
								
								test/unit/preload.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								test/unit/preload.lua
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					-- Modules loaded here will not be cleared and reloaded by Busted.
 | 
				
			||||||
 | 
					-- Busted started doing this to help provide more isolation.  See issue #62
 | 
				
			||||||
 | 
					-- for more information about this.
 | 
				
			||||||
 | 
					local ffi = require('ffi')
 | 
				
			||||||
 | 
					local helpers = require('test.unit.helpers')
 | 
				
			||||||
 | 
					local lfs = require('lfs')
 | 
				
			||||||
 | 
					local preprocess = require('test.unit.preprocess')
 | 
				
			||||||
		Reference in New Issue
	
	Block a user