glx-oml-sync-control-timing: Perform initial swap / wait before loop
[piglit.git] / framework / options.py
blobf5f32af7880519c174db84b0e9fb4814baec8647
1 # Copyright (c) 2015-2016 Intel Corporation
3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 # SOFTWARE.
21 """Stores global piglit options.
23 This is as close to a true global function as python gets. The only deal here
24 is that while you can mutate
26 """
28 from __future__ import (
29 absolute_import, division, print_function, unicode_literals
31 import os
33 import six
35 __all__ = ['OPTIONS']
37 # pylint: disable=too-few-public-methods
40 class _Options(object): # pylint: disable=too-many-instance-attributes
41 """Contains all options for a piglit run.
43 This is used as a sort of global state object, kinda like piglit.conf. This
44 big difference here is that this object is largely generated internally,
45 and is controlled mostly through command line options rather than through
46 the configuration file.
48 Options are as follows:
49 execute -- False for dry run
50 valgrind -- True if valgrind is to be used
51 env -- environment variables set for each test before run
52 deqp_mustpass -- True to enable the use of the deqp mustpass list feature.
53 """
55 def __init__(self):
56 self.execute = True
57 self.valgrind = False
58 self.sync = False
59 self.deqp_mustpass = False
60 self.process_isolation = True
61 self.jobs = None
63 # env is used to set some base environment variables that are not going
64 # to change across runs, without sending them to os.environ which is
65 # fickle and easy to break
66 self.env = {
67 'PIGLIT_SOURCE_DIR':
68 os.environ.get(
69 'PIGLIT_SOURCE_DIR',
70 os.path.abspath(os.path.join(os.path.dirname(__file__),
71 '..')))
74 def clear(self):
75 """Reinitialize all values to defaults."""
76 self.__init__()
78 def __iter__(self):
79 for key, values in six.iteritems(self.__dict__):
80 if not key.startswith('_'):
81 yield key, values
84 OPTIONS = _Options()