blob: 04c0d6a188e601051ca81025faf1fc0593098e6c [file] [log] [blame]
epoger@google.com9d331542013-05-28 15:25:38 +00001#!/usr/bin/env python
2# Copyright (c) 2013 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Schema of the JSON summary file written out by the GM tool.
7
8This must be kept in sync with the kJsonKey_ constants in gm_expectations.cpp !
9"""
10
11__author__ = 'Elliot Poger'
12
13
14# system-level imports
15import json
16
17
18# These constants must be kept in sync with the kJsonKey_ constants in
19# gm_expectations.cpp !
20JSONKEY_ACTUALRESULTS = 'actual-results'
21JSONKEY_ACTUALRESULTS_FAILED = 'failed'
22JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored'
23JSONKEY_ACTUALRESULTS_NOCOMPARISON = 'no-comparison'
24JSONKEY_ACTUALRESULTS_SUCCEEDED = 'succeeded'
25
26def Load(filepath):
27 """Loads the JSON summary written out by the GM tool.
28 Returns a dictionary keyed by the values listed as JSONKEY_ constants
29 above."""
30 # In the future, we should add a version number to the JSON file to ensure
31 # that the writer and reader agree on the schema (raising an exception
32 # otherwise).
33 json_dict = json.load(open(filepath))
34 return json_dict