Commit 06b92174 authored by Dylan Baker's avatar Dylan Baker Committed by Tom Stellard

framework/ Add a config parser

The config parser will read options from a file called piglit.conf
in the root of piglit's source directory or from a file specified
by the -f option to

Tom Stellard:
  - Added command-line option
Reviewed-by: Dylan Baker's avatarDylan Baker <>
parent 3a05f362
......@@ -39,6 +39,8 @@ from threads import synchronized_self
import multiprocessing
import multiprocessing.dummy
import importlib
# TODO: ConfigParser is known as configparser in python3
import ConfigParser
import simplejson as json
except ImportError:
......@@ -46,7 +48,8 @@ except ImportError:
import status
__all__ = ['Environment',
__all__ = ['PIGLIT_CONFIG',
......@@ -58,6 +61,8 @@ __all__ = ['Environment',
PIGLIT_CONFIG = ConfigParser.SafeConfigParser()
class PiglitJSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, status.Status):
......@@ -31,6 +31,7 @@ import traceback
import framework.core as core
from framework.core import PIGLIT_CONFIG
from framework.threads import synchronized_self
......@@ -72,6 +73,11 @@ def main():
parser.add_argument("-p", "--platform",
choices=["glx", "x11_egl", "wayland", "gbm"],
help="Name of windows system passed to waffle")
parser.add_argument("-f", "--config",
help="Optionally specify a piglit config file to use. "
"Default is piglit.conf")
help="Run tests in valgrind's memcheck")
......@@ -93,6 +99,13 @@ def main():
if args.platform:
os.environ['PIGLIT_PLATFORM'] = args.platform
# Read the config file
if args.config_file:
else:, 'piglit.conf'))
# Pass arguments into Environment
env = core.Environment(concurrent=args.concurrency,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment