mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-10-31 05:10:41 +01:00 
			
		
		
		
	tests: Use MOCK_FD instead of NON_ZERO for file operations
NON_ZERO can be a negative number, so MOCK_FD is safer option to use as a mock file descriptor. Also it is more readable. BUG=b:237606255 TEST=ninja test (on linux) Change-Id: I097dd59f69c3fb532ac136796fcf5cae8839af7b TICKET: https://ticket.coreboot.org/issues/411 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67310 Reviewed-by: Felix Singer <felixsinger@posteo.net> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Alexander Goncharov <chat@joursoir.net> Reviewed-by: Thomas Heijligen <src@posteo.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		 Anastasia Klimchuk
					Anastasia Klimchuk
				
			
				
					committed by
					
						 Thomas Heijligen
						Thomas Heijligen
					
				
			
			
				
	
			
			
			 Thomas Heijligen
						Thomas Heijligen
					
				
			
						parent
						
							75d327c550
						
					
				
				
					commit
					73c0a1d878
				
			| @@ -24,7 +24,7 @@ | |||||||
|  |  | ||||||
| void *not_null(void) | void *not_null(void) | ||||||
| { | { | ||||||
| 	return (void *)NON_ZERO; | 	return (void *)MOCK_FD; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* Workaround for https://github.com/clibs/cmocka/issues/17 */ | /* Workaround for https://github.com/clibs/cmocka/issues/17 */ | ||||||
| @@ -253,7 +253,7 @@ int __wrap_fflush(FILE *fp) | |||||||
| int __wrap_fileno(FILE *fp) | int __wrap_fileno(FILE *fp) | ||||||
| { | { | ||||||
| 	LOG_ME; | 	LOG_ME; | ||||||
| 	return NON_ZERO; | 	return MOCK_FD; | ||||||
| } | } | ||||||
|  |  | ||||||
| int __wrap_fsync(int fd) | int __wrap_fsync(int fd) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user