Fix coverage report
Previously the coverage.txt file was never populated Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
		
							
								
								
									
										26
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								Makefile
									
									
									
									
									
								
							| @@ -169,24 +169,30 @@ uninstall: | |||||||
| coverage: ## generate coverprofiles from the unit tests, except tests that require root | coverage: ## generate coverprofiles from the unit tests, except tests that require root | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| 	@rm -f coverage.txt | 	@rm -f coverage.txt | ||||||
|  | 	go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}) | ||||||
| 	( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \ | 	( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${PACKAGES}); do \ | ||||||
| 		go test -i ${TESTFLAGS} -test.short -coverprofile=coverage.out -covermode=atomic $$pkg || exit; \ | 		go test ${TESTFLAGS} \ | ||||||
| 		if [ -f profile.out ]; then \ | 			-cover \ | ||||||
| 			cat profile.out >> coverage.txt; \ | 			-coverprofile=profile.out \ | ||||||
| 			rm profile.out; \ | 			-covermode=atomic $$pkg || exit; \ | ||||||
| 		fi; \ |  | ||||||
| 		go test ${TESTFLAGS} -test.short -coverprofile=coverage.out -covermode=atomic $$pkg || exit; \ |  | ||||||
| 		if [ -f profile.out ]; then \ | 		if [ -f profile.out ]; then \ | ||||||
| 			cat profile.out >> coverage.txt; \ | 			cat profile.out >> coverage.txt; \ | ||||||
| 			rm profile.out; \ | 			rm profile.out; \ | ||||||
| 		fi; \ | 		fi; \ | ||||||
| 	done ) | 	done ) | ||||||
|  |  | ||||||
| root-coverage: ## generae coverage profiles for the unit tests | root-coverage: ## generate coverage profiles for unit tests that require root | ||||||
| 	@echo "$(WHALE) $@" | 	@echo "$(WHALE) $@" | ||||||
| 	@( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES}); do \ | 	go test -i ${TESTFLAGS} $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES}) | ||||||
| 		go test -i ${TESTFLAGS} -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg -test.root || exit; \ | 	( for pkg in $(filter-out ${INTEGRATION_PACKAGE},${TEST_REQUIRES_ROOT_PACKAGES}); do \ | ||||||
| 		go test ${TESTFLAGS} -test.short -coverprofile="../../../$$pkg/coverage.txt" -covermode=atomic $$pkg -test.root || exit; \ | 		go test ${TESTFLAGS} \ | ||||||
|  | 			-cover \ | ||||||
|  | 			-coverprofile=profile.out \ | ||||||
|  | 			-covermode=atomic $$pkg -test.root || exit; \ | ||||||
|  | 		if [ -f profile.out ]; then \ | ||||||
|  | 			cat profile.out >> coverage.txt; \ | ||||||
|  | 			rm profile.out; \ | ||||||
|  | 		fi; \ | ||||||
| 	done ) | 	done ) | ||||||
|  |  | ||||||
| coverage-integration: ## generate coverprofiles from the integration tests | coverage-integration: ## generate coverprofiles from the integration tests | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Nephin
					Daniel Nephin