Base framework and liblttng-ust-ctl test
[deliverable/lttng-ivc.git] / lttng_ivc / utils / ProjectFactory.py
1 import os
2 import logging
3 import yaml
4
5 import lttng_ivc.utils.project as Project
6
7
8 _logger = logging.getLogger('project.factory')
9 _conf_file = os.path.dirname(os.path.abspath(__file__)) + "/../run_configuration.yaml"
10 _project_constructor = {
11 'babeltrace': Project.Babeltrace,
12 'lttng-modules': Project.Lttng_modules,
13 'lttng-tools': Project.Lttng_tools,
14 'lttng-ust': Project.Lttng_ust,
15 }
16
17 _markers = None
18 with open(_conf_file, 'r') as stream:
19 # This is voluntary static across call, no need to perform this
20 # every time.
21 _markers = yaml.load(stream)
22
23
24 def get(label, tmpdir):
25 if label not in _markers:
26 # TODO: specialized exception, handle it caller-side so the caller
27 # can decide to skip or fail test.
28 raise Exception('Label is no present')
29 marker = _markers[label]
30 constructor = _project_constructor[marker['project']]
31 path = marker['path']
32 sha1 = marker['sha1']
33 return constructor(label, path, sha1, tmpdir)
This page took 0.030992 seconds and 5 git commands to generate.