Skip tests requiring extended precision if not avail
Alpine is running with Musl libc and musl uses extended precision
doubles, while valgrind can't handle extended precision,
2.3 == atof("2.3") won't be true under valgrind.
And therefore the option retrieval methods *_get_double would fail.
Also we have to increase the test verbosity, as `SKIPm` doesn't print
the message when skipping the tests.
See: silentbicycle/greatest#85
			
			
This commit is contained in:
		
							parent
							
								
									22cc3f190d
								
							
						
					
					
						commit
						ec3e47abb5
					
				
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @ -71,7 +71,7 @@ dunstify: dunstify.o | ||||
| 
 | ||||
| .PHONY: test test-valgrind test-coverage | ||||
| test: test/test clean-coverage-run | ||||
| 	./test/test | ||||
| 	./test/test -v | ||||
| 
 | ||||
| test-valgrind: test/test | ||||
| 	valgrind \
 | ||||
| @ -81,7 +81,7 @@ test-valgrind: test/test | ||||
| 		--errors-for-leak-kinds=definite \
 | ||||
| 		--num-callers=40 \
 | ||||
| 		--error-exitcode=123 \
 | ||||
| 		./test/test | ||||
| 		./test/test -v | ||||
| 
 | ||||
| test-coverage: CFLAGS += -fprofile-arcs -ftest-coverage -O0 | ||||
| test-coverage: test | ||||
|  | ||||
| @ -97,6 +97,10 @@ TEST test_ini_get_int(void) | ||||
| 
 | ||||
| TEST test_ini_get_double(void) | ||||
| { | ||||
|         if (2.3 != atof("2.3")) { | ||||
|                 SKIPm("Skipping test_ini_get_double, as it seems we're running under musl+valgrind!"); | ||||
|         } | ||||
| 
 | ||||
|         char *double_section = "double"; | ||||
|         ASSERT_EQ(1, ini_get_double(double_section, "simple", 0)); | ||||
|         ASSERT_EQ(1.5, ini_get_double(double_section, "decimal", 0)); | ||||
| @ -152,6 +156,10 @@ TEST test_cmdline_get_int(void) | ||||
| 
 | ||||
| TEST test_cmdline_get_double(void) | ||||
| { | ||||
|         if (2.3 != atof("2.3")) { | ||||
|                 SKIPm("Skipping test_cmdline_get_double, as it seems we're running under musl+valgrind!"); | ||||
|         } | ||||
| 
 | ||||
|         ASSERT_EQ(2, cmdline_get_double("-simple_double", 0, "")); | ||||
|         ASSERT_EQ(5.2, cmdline_get_double("-double", 0, "")); | ||||
|         ASSERT_EQ(3.14, cmdline_get_double("-nonexistent", 3.14, "")); | ||||
| @ -258,6 +266,10 @@ TEST test_option_get_int(void) | ||||
| 
 | ||||
| TEST test_option_get_double(void) | ||||
| { | ||||
|         if (2.3 != atof("2.3")) { | ||||
|                 SKIPm("Skipping test_option_get_double, as it seems we're running under musl+valgrind!"); | ||||
|         } | ||||
| 
 | ||||
|         char *double_section = "double"; | ||||
|         ASSERT_EQ(2, option_get_double(double_section, "simple", "-simple_double", 0, "")); | ||||
|         ASSERT_EQ(5.2, option_get_double(double_section, "simple", "-double", 0, "")); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Benedikt Heine
						Benedikt Heine