[render-test] Add metric_paths into Manifest (#15973)

* [render-test]Add expected metrics path in manifest file

* seperate metrics.json and expected.png

* fix expected path parsing

* keep expectation path if update is enabled
This commit is contained in:
zmiao
2019-11-27 11:08:55 +02:00
committed by GitHub
parent 5c271dba24
commit 11321497da
12 changed files with 290 additions and 211 deletions

View File

@@ -275,16 +275,16 @@ std::string serializeMetrics(const TestMetrics& metrics) {
namespace {
std::vector<std::string> readExpectedEntries(const std::regex& regex, const mbgl::filesystem::path& base) {
std::vector<std::string> expectedImages;
std::vector<std::string> expectedEntries;
for (const auto& entry : mbgl::filesystem::directory_iterator(base)) {
if (entry.is_regular_file()) {
const std::string path = entry.path().string();
if (std::regex_match(path, regex)) {
expectedImages.emplace_back(std::move(path));
expectedEntries.emplace_back(std::move(path));
}
}
}
return expectedImages;
return expectedEntries;
}
} // namespace
@@ -293,6 +293,11 @@ std::vector<std::string> readExpectedImageEntries(const mbgl::filesystem::path&
return readExpectedEntries(regex, base);
}
std::vector<std::string> readExpectedMetricEntries(const mbgl::filesystem::path& base) {
static const std::regex regex(".*metrics.*.json");
return readExpectedEntries(regex, base);
}
std::vector<std::string> readExpectedJSONEntries(const mbgl::filesystem::path& base) {
static const std::regex regex(".*expected.*.json");
return readExpectedEntries(regex, base);