Skip to content

Commit

Permalink
covermode should be atomic if there are goroutines
Browse files Browse the repository at this point in the history
Signed-off-by: Ying Li <ying.li@docker.com>
  • Loading branch information
cyli committed Sep 23, 2016
1 parent eb802aa commit 7717956
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion buildscripts/covertest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_coverprofile_filename(pkg, buildtags):
buildtags = "." + buildtags.replace(' ', '.')
return pkg.replace('/', '-').replace(' ', '_') + buildtags + ".coverage.txt"

def run_test_with_coverage(buildtags="", coverdir=".cover", pkgs=None, opts="", covermode="count"):
def run_test_with_coverage(buildtags="", coverdir=".cover", pkgs=None, opts="", covermode="atomic"):
"""
Run go test with coverage over the the given packages, with the following options
"""
Expand All @@ -51,6 +51,7 @@ def run_test_with_coverage(buildtags="", coverdir=".cover", pkgs=None, opts="",

for pkg in pkgs:
cmd = base_cmd + ["-coverprofile", os.path.join(coverdir, get_coverprofile_filename(pkg, buildtags)), pkg]
print(" ".join(cmd))
app = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in app.stdout:
# we are trying to generate coverage reports for everything in the base package, and some may not be
Expand Down

0 comments on commit 7717956

Please sign in to comment.