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
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
29 import framework
.core
as core
33 #############################################################################
35 #############################################################################
38 Usage: %(progName)s [options] [profile.tests] [results]
41 -h, --help Show this message
42 -d, --dry-run Do not execute the tests
43 -t regexp, --tests=regexp Run only matching tests (can be used more
45 -x regexp, --exclude-tests=regexp Excludey matching tests (can be used
47 -n name, --name=name Name of the testrun
50 %(progName)s tests/all.tests results/all
51 Run all tests, store the results in the directory results/all
53 %(progName)s -t basic tests/all.tests results/all
54 Run all tests whose path contains the word 'basic'
56 %(progName)s -t ^glean/ -t tex tests/all.tests results/all
57 Run all tests that are in the 'glean' group or whose path contains
60 print USAGE
% {'progName': sys
.argv
[0]}
64 env
= core
.Environment()
67 options
, args
= getopt(sys
.argv
[1:], "hdt:n:x:", [ "help", "dry-run", "tests=", "name=", "exclude-tests=" ])
73 for name
, value
in options
:
74 if name
in ('-h', '--help'):
76 elif name
in ('-d', '--dry-run'):
78 elif name
in ('-t', '--tests'):
79 env
.filter[:0] = [re
.compile(value
)]
80 elif name
in ('-x', '--exclude-tests'):
81 env
.exclude_filter
[:0] = [re
.compile(value
)]
82 elif name
in ('-n', '--name'):
88 profileFilename
= args
[0]
91 core
.checkDir(resultsDir
, False)
93 profile
= core
.loadTestProfile(profileFilename
)
94 env
.file = open(resultsDir
+ '/main', "w")
95 print >>env
.file, "name: %(name)s" % { 'name': core
.encode(OptionName
) }
100 print "Writing summary file..."
101 results
= core
.loadTestResults(resultsDir
)
102 for testname
, result
in results
.allTestResults().items():
104 if len(result
['info']) > 4096:
105 result
['info'] = result
['info'][0:4096]
106 file = open(resultsDir
+ '/summary', "w")
111 print 'Thank you for running Piglit!'
112 print 'Summary for submission has been written to ' + resultsDir
+ '/summary'
115 if __name__
== "__main__":