[master] c6bcb02 Messin' around with gcov

Poul-Henning Kamp phk at FreeBSD.org
Sun Jan 8 23:04:05 CET 2017


commit c6bcb0276342a4fe4c3480569a1d9c587793b79f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Sun Jan 8 22:03:22 2017 +0000

    Messin' around with gcov

diff --git a/Makefile.am b/Makefile.am
index 4c97327..0488281 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,4 +42,7 @@ cscope:
 	find . -name '*.[hcS]' > cscope.files
 	cscope -b
 
+gcov_digest:
+	${PYTHON} tools/gcov_digest.py -o _gcov
+
 .PHONY: cscope
diff --git a/tools/gcov_digest.py b/tools/gcov_digest.py
index 5fce2f5..4b24187 100644
--- a/tools/gcov_digest.py
+++ b/tools/gcov_digest.py
@@ -43,7 +43,8 @@ Options:
 
  Arguments:
 
-       directories to process
+	directories to process.
+	default: .
 
 """
 
@@ -95,6 +96,8 @@ def run_gcov(prog, subdir):
 		for i in exclude:
 			if i in dirs:
 				dirs.remove(i)
+		if " ".join(files).find(".gcda") == -1:
+			continue
 		for fn in files:
 			if fn[-2:] != ".o":
 				continue
@@ -106,13 +109,15 @@ def run_gcov(prog, subdir):
 				x = subprocess.check_output(
 				    ["cd " + root + "/.. && " +
 				     "exec " + prog + " -r .libs/" + fn],
-				    stderr=subprocess.STDOUT, shell=True)
+				    stderr=subprocess.STDOUT, shell=True,
+				    universal_newlines=True)
 				pf = ".."
 			else:
 				x = subprocess.check_output(
 				    ["cd " + root + " && " +
 				     "exec " + prog + " -r " + fn],
-				    stderr=subprocess.STDOUT, shell=True)
+				    stderr=subprocess.STDOUT, shell=True,
+				    universal_newlines=True)
 				pf = ""
 
 			for ln in x.split("\n"):
@@ -137,9 +142,9 @@ def produce_output(fdo):
 		"." in count means "same as previous count"
 	"""
 
-	for sn, cnt in counts.iteritems():
+	for sn, cnt in counts.items():
 		fdo.write("/" + sn + " " + str(lengths[sn]) + "\n")
-		lnos = list(cnt.iteritems())
+		lnos = list(cnt.items())
 		lnos.sort()
 		pln = -1
 		pcn = -1
@@ -188,6 +193,8 @@ if __name__ == "__main__":
 			exclude.append(v)
 		else:
 			assert False
+	if len(args) == 0:
+		args = ["."]
 	for dn in args:
 		run_gcov(gcovprog, dn)
 



More information about the varnish-commit mailing list