Fix missing dependency on sparse binds
[platform/upstream/VK-GL-CTS.git] / scripts / list_test_changes.py
1 #!/usr/bin/env python3
2
3 # VK-GL-CTS log scrubber
4 # ----------------------
5 #
6 # Copyright (c) 2019 The Khronos Group Inc.
7 # Copyright (c) 2019 Google LLC
8 #
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12 #
13 #      http://www.apache.org/licenses/LICENSE-2.0
14 #
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20
21 # This script attempts to find out which tests have changed since a
22 # certain time, release or changelist. The commit messages are scrubbed
23 # for dEQP test names, and these are merged to find a suitable set.
24 #
25 # The changelists that claim to change all tests are ignored.
26
27 import subprocess
28 import sys
29 import fnmatch
30 import re
31
32 assert sys.version_info >= (3, 0)
33
34 if len(sys.argv) == 1:
35         print("""
36 VK-GL-CTS log scrubber
37 ----------------------
38 This script attempts to list changed tests since certain time or
39 git revision. It does this by looking at git log.
40
41 Caveat: git log messages are written by humans, so there may be
42 errors. Overly broad changes are ignored (e.g, dEQP-VK.*).
43
44 Usage: Give the git log parameters
45
46 Examples:""")
47         print(sys.argv[0], '--since="two months ago"')
48         print(sys.argv[0], '--since="7.7.2019"')
49         print(sys.argv[0], 'vulkan-cts-1.1.3.1..HEAD')
50         quit()
51
52 params = ""
53 first = True
54 for x in sys.argv[1:]:
55         if not first:
56                 params = params + " "
57         params = params + x
58         first = False
59
60 res = []
61
62 rawlogoutput = subprocess.check_output(['git', 'log', params, '--pretty=format:"%B"'])
63 logoutput = rawlogoutput.decode().split()
64 for x in logoutput:
65         xs = x.strip()
66         # regexp matches various over-large test masks like "dEQP-*", "dEQP-VK*", "dEQP-VK.*",
67         # but not "dEQP-VK.a" or "dEQP-VK.*a"
68         if xs.startswith('dEQP-') and not re.search('dEQP-\w*\**\.*\**$',xs):
69                 found = False
70                 killlist = []
71                 for y in res:
72                         if fnmatch.fnmatch(xs, y):
73                                 found = True
74                         if fnmatch.fnmatch(y, xs):
75                                 killlist.append(y)
76                 for y in killlist:
77                         res.remove(y)
78                 if not found:
79                         res.append(xs)
80 for x in sorted(res):
81         print(x)
82 print(len(res), 'total')