Add new large constant array indexing tests am: fc35227a44
[platform/upstream/VK-GL-CTS.git] / external / vulkancts / scripts / verify_submission.py
1 # -*- coding: utf-8 -*-
2
3 #-------------------------------------------------------------------------
4 # Vulkan CTS
5 # ----------
6 #
7 # Copyright (c) 2016 Google Inc.
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 #-------------------------------------------------------------------------
22
23 import os
24 import sys
25
26 sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "scripts", "verify"))
27
28 from package import getPackageDescription
29 from verify import *
30 from message import *
31
32 def verifyGitStatusFiles (package):
33         messages = []
34
35         if len(package.gitStatus) > 1:
36                 messages.append(error(package.basePath, "Exactly one git status file must be present, found %s" % len(package.gitStatus)))
37
38         messages += verifyGitStatus(package)
39
40         return messages
41
42 def verifyGitLogFiles (package):
43         messages = []
44
45         if len(package.gitLog) > 1:
46                 messages.append(error(package.basePath, "Exactly one git log file must be present, found %s" % len(package.gitLog)))
47
48         messages += verifyGitLog(package)
49
50         return messages
51
52 def verifyTestLogs (package, mustpass):
53         messages        = []
54
55         for testLogFile in package.testLogs:
56                 messages += verifyTestLog(os.path.join(package.basePath, testLogFile), mustpass)
57
58         if len(package.testLogs) == 0:
59                 messages.append(error(package.basePath, "No test log files found"))
60
61         return messages
62
63 def verifyPackage (package, mustpass):
64         messages = []
65
66         messages += verifyStatement(package)
67         messages += verifyGitStatusFiles(package)
68         messages += verifyGitLogFiles(package)
69         messages += verifyPatches(package)
70         messages += verifyTestLogs(package, mustpass)
71
72         for item in package.otherItems:
73                 messages.append(warning(os.path.join(package.basePath, item), "Unknown file"))
74
75         return messages
76
77 if __name__ == "__main__":
78         if len(sys.argv) != 3:
79                 print "%s: [extracted submission package] [mustpass]" % sys.argv[0]
80                 sys.exit(-1)
81
82         packagePath             = os.path.normpath(sys.argv[1])
83         mustpassPath    = sys.argv[2]
84         package                 = getPackageDescription(packagePath)
85         mustpass                = readMustpass(mustpassPath)
86         messages                = verifyPackage(package, mustpass)
87
88         errors                  = [m for m in messages if m.type == ValidationMessage.TYPE_ERROR]
89         warnings                = [m for m in messages if m.type == ValidationMessage.TYPE_WARNING]
90
91         for message in messages:
92                 print str(message)
93
94         print ""
95
96         if len(errors) > 0:
97                 print "Found %d validation errors and %d warnings!" % (len(errors), len(warnings))
98                 sys.exit(-2)
99         elif len(warnings) > 0:
100                 print "Found %d warnings, manual review required" % len(warnings)
101                 sys.exit(-1)
102         else:
103                 print "All validation checks passed"