Add more structure constructor tests.
[piglit/hramrach.git] / piglit-create-summary.py
blob914d09eed4c92767d679e13a4f7b90f1186271f0
1 #!/usr/bin/env python
3 # Permission is hereby granted, free of charge, to any person
4 # obtaining a copy of this software and associated documentation
5 # files (the "Software"), to deal in the Software without
6 # restriction, including without limitation the rights to use,
7 # copy, modify, merge, publish, distribute, sublicense, and/or
8 # sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following
10 # conditions:
12 # This permission notice shall be included in all copies or
13 # substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
18 # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21 # OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 # DEALINGS IN THE SOFTWARE.
25 from getopt import getopt, GetoptError
26 import sys
28 import framework.core as core
32 #############################################################################
33 ##### Main program
34 #############################################################################
35 def usage():
36 USAGE = """\
37 Usage: %(progName)s [options] [main results file]
39 Options:
40 -h, --help Show this message
42 Example:
43 %(progName)s results/main > results/summary
44 """
45 print USAGE % {'progName': sys.argv[0]}
46 sys.exit(1)
48 def main():
49 env = core.Environment()
51 try:
52 options, args = getopt(sys.argv[1:], "h", [ "help" ])
53 except GetoptError:
54 usage()
56 OptionName = ''
58 for name, value in options:
59 if name in ('-h', '--help'):
60 usage()
62 if len(args) != 1:
63 usage()
65 resultsFilename = args[0]
67 results = core.loadTestResults(resultsFilename)
68 for testname, result in results.allTestResults().items():
69 if 'info' in result:
70 if len(result['info']) > 4096:
71 result['info'] = result['info'][0:4096]
72 results.write(sys.stdout)
75 if __name__ == "__main__":
76 main()