Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jarl
tor
Commits
90701c1d
Commit
90701c1d
authored
9 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Patches
Plain Diff
Add my script to dump per-file or per-function coverage
parent
edaf6817
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/test/cov-display
+72
-0
72 additions, 0 deletions
scripts/test/cov-display
with
72 additions
and
0 deletions
scripts/test/cov-display
0 → 100755
+
72
−
0
View file @
90701c1d
#!/usr/bin/python
import
sys
,
re
none0
,
some0
=
0
,
0
branchTaken0
,
branchNot0
=
0
,
0
BRANCH
=
False
FUNC
=
False
if
sys
.
argv
[
1
]
==
'
-b
'
:
BRANCH
=
True
del
sys
.
argv
[
1
]
if
sys
.
argv
[
1
]
==
'
-f
'
:
FUNC
=
True
del
sys
.
argv
[
1
]
def
show
(
name
,
none
,
some
):
if
some
+
none
==
0
:
none
=
1
print
name
,
none
,
some
,
"
%.02f
"
%
(
100
*
(
float
(
some
)
/
(
some
+
none
)))
for
fn
in
sys
.
argv
[
1
:]:
none
=
some
=
branchTaken
=
branchNot
=
0
inFunc
=
""
for
line
in
open
(
fn
,
'
r
'
):
m
=
re
.
match
(
r
'
^[^:]*:([^:]*):(.*)
'
,
line
)
if
m
:
body
=
m
.
group
(
2
).
rstrip
()
lineno
=
m
.
group
(
1
).
strip
()
else
:
body
=
""
lineno
=
"
?
"
m
=
re
.
match
(
r
'
^([A-Za-z_][A-Za-z0-9_]*)(?:, *)?\(
'
,
body
)
if
m
:
inFunc
=
"
%s:%s %s
"
%
(
fn
,
lineno
,
m
.
group
(
1
))
elif
body
==
"
}
"
:
if
FUNC
and
inFunc
:
show
(
inFunc
,
none
,
some
)
none
=
some
=
0
inFunc
=
None
if
re
.
match
(
r
'
^ *###
'
,
line
):
none
+=
1
elif
re
.
match
(
r
'
^ *\d
'
,
line
):
some
+=
1
else
:
m
=
re
.
match
(
r
'
^branch.*taken (\d+)%
'
,
line
)
if
m
:
if
int
(
m
.
group
(
1
))
==
0
:
branchNot
+=
1
else
:
branchTaken
+=
1
none0
+=
none
some0
+=
some
branchTaken0
+=
branchTaken
branchNot0
+=
branchNot
if
FUNC
:
pass
elif
BRANCH
:
if
branchTaken
or
branchNot
:
show
(
fn
,
branchNot
,
branchTaken
)
else
:
if
some
or
none
:
show
(
fn
,
none
,
some
)
if
BRANCH
:
if
branchTaken0
or
branchNot0
:
show
(
"
TOTAL
"
,
branchNot0
,
branchTaken0
)
else
:
if
some0
or
none0
:
show
(
"
TOTAL
"
,
none0
,
some0
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment