1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 from collections
import defaultdict
6 from mozperftest
.utils
import MachLogger
9 class Metadata(MachLogger
):
10 def __init__(self
, mach_cmd
, env
, flavor
, script
):
11 MachLogger
.__init
__(self
, mach_cmd
)
12 self
._mach
_cmd
= mach_cmd
14 self
.options
= defaultdict(dict)
20 def run_hook(self
, name
, *args
, **kw
):
21 # this bypasses layer restrictions on args,
22 # which is fine since it's a user script
23 return self
._env
.hooks
.run(name
, *args
, **kw
)
25 def set_output(self
, output
):
31 def add_result(self
, result
):
32 self
._results
.append(result
)
34 def get_results(self
):
37 def clear_results(self
):
40 def update_options(self
, name
, options
):
41 self
.options
[name
].update(options
)
43 def get_options(self
, name
):
44 return self
.options
[name
]