File: runner.hpp

package info (click to toggle)
mapnik 4.2.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,592 kB
  • sloc: cpp: 163,859; python: 1,332; sh: 690; xml: 161; makefile: 123; perl: 28; lisp: 13
file content (69 lines) | stat: -rw-r--r-- 2,567 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2025 Artem Pavlenko
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

#ifndef VISUAL_TEST_RUNNER_HPP
#define VISUAL_TEST_RUNNER_HPP

#include "config.hpp"
#include "report.hpp"
#include "renderer.hpp"

namespace visual_tests {

class runner
{
    using path_type = mapnik::fs::path;
    using files_iterator = std::vector<path_type>::const_iterator;

  public:
    using renderer_container = std::vector<renderer_type>;

    runner(path_type const& styles_dir,
           config const& cfg,
           std::size_t iterations,
           std::size_t fail_limit,
           std::size_t jobs,
           renderer_container const& renderers);

    result_list test_all(report_type& report) const;
    result_list test(std::vector<std::string> const& style_names, report_type& report) const;

  private:
    result_list test_parallel(std::vector<path_type> const& files, report_type& report, std::size_t jobs) const;
    result_list test_range(files_iterator begin,
                           files_iterator end,
                           std::reference_wrapper<report_type> report,
                           std::reference_wrapper<std::atomic<std::size_t>> fail_limit) const;
    result_list test_one(path_type const& style_path, report_type& report, std::atomic<std::size_t>& fail_limit) const;
    void parse_params(mapnik::parameters const& params, config& cfg) const;

    path_type const styles_dir_;
    config const defaults_;
    std::size_t const jobs_;
    std::size_t const iterations_;
    std::size_t const fail_limit_;
    renderer_container const renderers_;
};

} // namespace visual_tests

#endif // VISUAL_TEST_RUNNER_HPP