Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 430982376a544bbccaef5006fab94bbc2f1d1711 Mon Sep 17 00:00:00 2001 |
| 2 | From: Mingli Yu <mingli.yu@windriver.com> |
| 3 | Date: Mon, 13 Apr 2020 07:12:44 +0000 |
| 4 | Subject: [PATCH] gcov_merge.py/scov_merge.py: switch to python3 |
| 5 | |
| 6 | Make gcov_merge.py and scov_merge.py port to python3. |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | |
| 10 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> |
| 11 | --- |
| 12 | tools/scripts/gcov_merge.py | 12 ++++++------ |
| 13 | tools/scripts/scov_merge.py | 12 ++++++------ |
| 14 | 2 files changed, 12 insertions(+), 12 deletions(-) |
| 15 | |
| 16 | diff --git a/tools/scripts/gcov_merge.py b/tools/scripts/gcov_merge.py |
| 17 | index 0ac9bed..9f1cb8c 100644 |
| 18 | --- a/tools/scripts/gcov_merge.py |
| 19 | +++ b/tools/scripts/gcov_merge.py |
| 20 | @@ -1,4 +1,4 @@ |
| 21 | -#!/usr/bin/env python |
| 22 | +#!/usr/bin/env python3 |
| 23 | # |
| 24 | # Merge gcov graph from several test cases. This can be used to check |
| 25 | # the coverage of several test cases. |
| 26 | @@ -11,7 +11,7 @@ |
| 27 | import sys |
| 28 | |
| 29 | def die(str): |
| 30 | - print str |
| 31 | + print(str) |
| 32 | sys.exit(-1) |
| 33 | |
| 34 | def die_on(cond, str): |
| 35 | @@ -55,11 +55,11 @@ def merge(gcls1, gcls2): |
| 36 | gcl1.merge(gcl2) |
| 37 | |
| 38 | def gcov_merge(fns, of): |
| 39 | - f = file(fns[0]) |
| 40 | + f = open(fns[0]) |
| 41 | gcls_base = parse(f) |
| 42 | |
| 43 | for fn in fns[1:]: |
| 44 | - f = file(fn) |
| 45 | + f = open(fn) |
| 46 | gcls = parse(f) |
| 47 | merge(gcls_base, gcls) |
| 48 | |
| 49 | @@ -67,10 +67,10 @@ def gcov_merge(fns, of): |
| 50 | gcl.write(of) |
| 51 | |
| 52 | def usage(): |
| 53 | - print 'Usage: %s <gcov graph files>' % (sys.argv[0]) |
| 54 | + print('Usage: %s <gcov graph files>' % (sys.argv[0])) |
| 55 | |
| 56 | if __name__ == '__main__': |
| 57 | if len(sys.argv) <= 1: |
| 58 | usage() |
| 59 | - exit -1 |
| 60 | + sys.exit(-1) |
| 61 | gcov_merge(sys.argv[1:], sys.stdout) |
| 62 | diff --git a/tools/scripts/scov_merge.py b/tools/scripts/scov_merge.py |
| 63 | index f83b922..bbcf760 100644 |
| 64 | --- a/tools/scripts/scov_merge.py |
| 65 | +++ b/tools/scripts/scov_merge.py |
| 66 | @@ -1,4 +1,4 @@ |
| 67 | -#!/usr/bin/env python |
| 68 | +#!/usr/bin/env python3 |
| 69 | # |
| 70 | # Merge mce serverity coverage file from several test cases. This can |
| 71 | # be used to check the coverage of several test cases. |
| 72 | @@ -11,7 +11,7 @@ |
| 73 | import sys |
| 74 | |
| 75 | def die(str): |
| 76 | - print str |
| 77 | + print(str) |
| 78 | sys.exit(-1) |
| 79 | |
| 80 | def die_on(cond, str): |
| 81 | @@ -47,11 +47,11 @@ def merge(gcls1, gcls2): |
| 82 | gcl1.merge(gcl2) |
| 83 | |
| 84 | def scov_merge(fns, of): |
| 85 | - f = file(fns[0]) |
| 86 | + f = open(fns[0]) |
| 87 | gcls_base = parse(f) |
| 88 | |
| 89 | for fn in fns[1:]: |
| 90 | - f = file(fn) |
| 91 | + f = open(fn) |
| 92 | gcls = parse(f) |
| 93 | merge(gcls_base, gcls) |
| 94 | |
| 95 | @@ -59,10 +59,10 @@ def scov_merge(fns, of): |
| 96 | gcl.write(of) |
| 97 | |
| 98 | def usage(): |
| 99 | - print 'Usage: %s <severities coverage files>' % (sys.argv[0]) |
| 100 | + print('Usage: %s <severities coverage files>' % (sys.argv[0])) |
| 101 | |
| 102 | if __name__ == '__main__': |
| 103 | if len(sys.argv) <= 1: |
| 104 | usage() |
| 105 | - exit -1 |
| 106 | + sys.exit(-1) |
| 107 | scov_merge(sys.argv[1:], sys.stdout) |
| 108 | -- |
| 109 | 2.24.1 |
| 110 | |