Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/platform/update_engine/local_coverage_rate.sh

Issue 465067: Missed new files in last commit
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Calculates the test-coverage percentage for non-test files in the
8 # update_engine directory. Requires a file 'app.info' to contain the
9 # results of running the unittests while collecting coverage data.
10
11 cat app.info | awk -F '[,:]' '
12
13 BEGIN { OFS = ":"; }
14
15 /^SF:/{ FILEN = $2; }
16
17 /^end_of_record$/{ FILEN = ""; }
18
19 /^DA:/{ print FILEN, $2, $3; }
20
21 ' | sort | awk -F : '
22 BEGIN {
23 OFS = ":";
24 FILEN = "";
25 LINE = "";
26 HITS = 0;
27 }
28 {
29 NEWFILEN = $1;
30 NEWLINE = $2;
31 if ((NEWFILEN == FILEN) && (NEWLINE == LINE)) {
32 HITS += $3
33 } else {
34 if (FILEN != "") {
35 print FILEN, LINE, HITS;
36 }
37 FILEN = NEWFILEN;
38 LINE = NEWLINE;
39 HITS = $3;
40 }
41 }
42 ' | grep '^.*\/trunk\/src\/platform\/update_engine\/' | \
43 fgrep -v '_unittest.cc:' | \
44 fgrep -v '/test_utils.' | \
45 fgrep -v '/test_http_server.cc' | \
46 fgrep -v '/testrunner.cc' | \
47 fgrep -v '/mock' | \
48 fgrep -v '.pb.cc' | \
49 awk -F : '
50
51 function printfile() {
52 if (FNAME != "")
53 printf "%-40s %4d / %4d: %5.1f%%\n", FNAME, FILE_GOOD_LINES,
54 (FILE_BAD_LINES + FILE_GOOD_LINES),
55 (FILE_GOOD_LINES * 100) / (FILE_BAD_LINES + FILE_GOOD_LINES);
56 }
57
58 BEGIN {
59 FNAME = "";
60 FILE_BAD_LINES = 0;
61 FILE_GOOD_LINES = 0;
62 }
63 {
64 // calc filename
65 ARR_SIZE = split($1, PARTS, "/");
66 NEWFNAME = PARTS[ARR_SIZE];
67 if (NEWFNAME != FNAME) {
68 printfile();
69 FILE_BAD_LINES = 0;
70 FILE_GOOD_LINES = 0;
71 FNAME = NEWFNAME;
72 }
73 if ($3 == "0") {
74 BAD_LINES += 1;
75 FILE_BAD_LINES += 1;
76 } else {
77 GOOD_LINES += 1;
78 FILE_GOOD_LINES += 1;
79 }
80 }
81
82 END {
83 printfile();
84 print "---\nSummary: tested " GOOD_LINES " / " (BAD_LINES + GOOD_LINES);
85 printf "Test coverage: %.1f%%\n", ((GOOD_LINES * 100) / (BAD_LINES + GOOD_LINE S));
86 }
87 '
OLDNEW
« no previous file with comments | « src/platform/update_engine/integration_unittest.cc ('k') | src/platform/update_engine/omaha_request_prep_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698