Exemplo n.º 1
0
  def setUp(self):
    self.config_v1= PiraConfiguration()
    self.config_v1.set_build_directories([tempdir + '/home/pira/build_dir'])
    self.config_v1.populate_build_dict(self.config_v1.directories)
    self.config_v1.set_items(['item1', 'item2'], self.config_v1.directories[0])
    self.config_v1.initialize_item_dict(self.config_v1.directories[0], self.config_v1.builds[self.config_v1.directories[0]]['items'])

    for build_dir in self.config_v1.directories:
      for item in self.config_v1.builds[build_dir]['items']:
        self.config_v1.set_item_instrument_analysis(dep_aw_ins_anal[item], build_dir, item)
        self.config_v1.set_item_builders(tempdir + '/home/pira/build_dir/item1/functors', build_dir, item)
        self.config_v1.set_item_args([], build_dir, item)
        self.config_v1.set_item_runner("/" + item + "/runner/functors.dir", build_dir, item)

    self.config_v2 = PiraConfigurationII()

    pira_item1 = PiraItem("item1")
    pira_item1.set_analyzer_dir(tempdir + "/home/pira/build_dir/item1/analyzer")
    pira_item1.set_cubes_dir(tempdir + "/home/pira/build_dir/item1/cubes")
    pira_item1.set_flavors(["ct"])
    pira_item1.set_functors_base_path(tempdir + "/home/pira/build_dir/item1/functors")
    pira_item1.set_mode("CT")
    self.config_v2.add_item(tempdir + "/home/pira/build_dir/item1/",pira_item1)

    pira_item2 = PiraItem("item2")
    pira_item2.set_analyzer_dir(tempdir + "/home/pira/build_dir/item2/analyzer")
    pira_item2.set_cubes_dir(tempdir + "/home/pira/build_dir/item2/cubes")
    pira_item2.set_flavors([])
    pira_item2.set_functors_base_path(tempdir + "/home/pira/build_dir/item2/functors")
    pira_item2.set_mode("CT")
    self.config_v2.add_item(tempdir + "/home/pira/build_dir/item2/",pira_item2)

    self.config_adapter = PiraConfigurationAdapter(self.config_v2)
    self.create_tempfiles(self)
Exemplo n.º 2
0
    def setUp(self):
        self._path_to_config = '/tmp'
        self._pira_dir = os.path.join(os.path.expanduser('~'), '.pira')
        self._compile_t_filter = True
        self._pira_iters = 3
        self._num_reps = 4
        self._ic = InvocationConfiguration(self._path_to_config,
                                           self._compile_t_filter,
                                           self._pira_iters, self._num_reps)
        self._pira_one_cfg = PiraConfiguration()

        self._pira_two_cfg = PiraConfigurationII()
        self._it_dir = '/tmp/test_item'
        item = PiraItem('/tmp/test_item')
        item.set_analyzer_dir('/analyzer')
        item.set_cubes_dir('/cubes')
        item.set_flavors(['dflt'])
        item.set_functors_base_path('/functors')
        item.set_mode('ct')

        run_opts = CmdlineLinearArgumentMapper({'x': [1]})

        item.set_run_options(run_opts)
        self._item = item

        self._pira_two_cfg.add_item(self._it_dir, item)
        self._pira_two_cfg._empty = False  # This is usually done in ConfigurationLoader
        self._pira_two_adapter = PiraConfigurationAdapter(self._pira_two_cfg)
Exemplo n.º 3
0
    def load_conf(self, config_file: str) -> PiraConfiguration:
        if not U.is_file(config_file):
            raise RuntimeError(
                'SimplifiedConfigurationLoader::load_conf: Invalid config file location "'
                + config_file + '" [no such file].')

        config_abs = U.get_absolute_path(config_file)
        config_abs_path = config_abs[:config_abs.rfind('/')]
        self._config.set_absolute_base_path(config_abs_path)

        try:
            file_content = U.read_file(config_file)
            json_tree = json.loads(file_content)
            self.parse_from_json(json_tree)

        except Exception as e:
            L.get_logger().log(
                'SimplifiedConfigurationLoader::load_conf: Caught exception "'
                + str(e))

        return PiraConfigurationAdapter(self._config)
Exemplo n.º 4
0
  def setUp(self):
    # Pira I configuration (we probably drop the support anyway...)
    self._p_cfg = PiraConfiguration()

    # Pira II configuration and adapter
    self._pira_two_cfg = PiraConfigurationII()
    self._it_dir = '/tmp/test_item'
    item = PiraItem('/tmp/test_item')
    item.set_analyzer_dir('/analyzer')
    item.set_cubes_dir('/cubes')
    item.set_flavors(['dflt'])
    item.set_functors_base_path('/functors')
    item.set_mode('ct')

    run_opts = CmdlineLinearArgumentMapper({'x': [1]})

    item.set_run_options(run_opts)
    self._item = item

    self._pira_two_cfg.add_item(self._it_dir, item)
    self._pira_two_cfg._empty = False # This is usually done in ConfigurationLoader
    self._pira_two_adapter = PiraConfigurationAdapter(self._pira_two_cfg)
Exemplo n.º 5
0
 def test_empty_pira_config_adapter(self):
   with self.assertRaises(A.PiraAnalyzerException):
     analyzer = A.Analyzer(PiraConfigurationAdapter(PiraConfigurationII()))