Sequoia
Loading...
Searching...
No Matches
DependencyAnalyzer.hpp
Go to the documentation of this file.
1
2// Copyright Oliver J. Rosten 2021. //
3// Distributed under the GNU GENERAL PUBLIC LICENSE, Version 3.0. //
4// (See accompanying file LICENSE.md or copy at //
5// https://www.gnu.org/licenses/gpl-3.0.en.html) //
7
8#pragma once
9
16
17#include <iostream>
18#include <chrono>
19#include <format>
20#include <limits>
21
22namespace sequoia::testing
23{
24 enum class prune_mode { passive, active };
25
27 {
28 using stamp_t = std::filesystem::file_time_type;
29 using duration_t = stamp_t::duration;
30
31 std::filesystem::path test_path;
32 stamp_t time_stamp;
33
34 friend std::ostream& operator<<(std::ostream& s, const prune_record& record) {
35 return s << record.test_path.generic_string()
36 << ' '
37 << std::format("{}", record.time_stamp.time_since_epoch().count());
38 }
39
40 [[nodiscard]]
41 friend auto operator<=>(const prune_record&, const prune_record&) noexcept = default;
42
43 friend std::istream& operator>>(std::istream& s, prune_record& record) {
44 std::size_t duration{};
45 s >> record.test_path >> duration;
46
47 record.time_stamp = {stamp_t{} + duration_t{duration}};
48 return s;
49 }
50 };
51
52 [[nodiscard]]
53 std::vector<prune_record> read_tests(const std::filesystem::path& file);
54
55 void write_tests(const project_paths& projPaths, const std::filesystem::path& file, std::span<const prune_record> tests);
56
57 [[nodiscard]]
58 std::optional<std::vector<std::filesystem::path>> tests_to_run(const project_paths& projPaths, std::string_view cutoff);
59
60 void update_prune_files(const project_paths& projPaths,
61 std::span<const std::filesystem::path> failedTests,
62 std::filesystem::file_time_type updateTime,
63 std::optional<std::size_t> id);
64
65 void update_prune_files(const project_paths& projPaths,
66 std::span<const std::filesystem::path> executedTests,
67 std::span<const std::filesystem::path> failedTests,
68 std::filesystem::file_time_type updateTime,
69 std::optional<std::size_t> id);
70
71 void setup_instability_analysis_prune_folder(const project_paths& projPaths);
72
73 void aggregate_instability_analysis_prune_files(const project_paths& projPaths, prune_mode mode, std::filesystem::file_time_type timeStamp, std::size_t numReps);
74}
File paths pertaining to a sequoia project.
Paths used by the project.
Definition: ProjectPaths.hpp:467
Definition: DependencyAnalyzer.hpp:27