| 
									
										
										
										
											2015-04-29 01:27:47 +02:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # This script runs all package tests and merges the resulting coverage | 
					
						
							|  |  |  | # profiles. Coverage is accounted per package under test. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if [ ! -f "build/env.sh" ]; then | 
					
						
							|  |  |  |     echo "$0 must be run from the root of the repository." | 
					
						
							|  |  |  |     exit 2 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo "mode: count" > profile.cov | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | for pkg in $(go list ./...); do | 
					
						
							|  |  |  |     # drop the namespace prefix. | 
					
						
							|  |  |  |     dir=${pkg##github.com/ethereum/go-ethereum/} | 
					
						
							|  |  |  |      | 
					
						
							| 
									
										
										
										
											2015-06-18 22:38:17 +02:00
										 |  |  |     if [[ $dir != "tests" ]]; then | 
					
						
							| 
									
										
										
										
											2015-04-29 01:27:47 +02:00
										 |  |  |         go test -covermode=count -coverprofile=$dir/profile.tmp $pkg | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  |     if [[ -f $dir/profile.tmp ]]; then | 
					
						
							|  |  |  |         tail -n +2 $dir/profile.tmp >> profile.cov | 
					
						
							|  |  |  |         rm $dir/profile.tmp | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | done |