From 08f03b1bbbf420ad866c08de250800bd793d3889 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Sat, 21 Dec 2019 00:53:25 +0200 Subject: [PATCH] [render-test] Add cache database path to the manifest A path relative to the manifest pointing at the data cache. --- render-test/manifest_parser.cpp | 16 ++++++++++++++++ render-test/manifest_parser.hpp | 2 ++ 2 files changed, 18 insertions(+) diff --git a/render-test/manifest_parser.cpp b/render-test/manifest_parser.cpp index 34be621a7..6aec4b359 100644 --- a/render-test/manifest_parser.cpp +++ b/render-test/manifest_parser.cpp @@ -44,6 +44,10 @@ const std::string& Manifest::getResultPath() const { return resultPath; } +const std::string& Manifest::getCachePath() const { + return cachePath; +} + const std::set& Manifest::getProbes() const { return probes; } @@ -305,6 +309,18 @@ mbgl::optional ManifestParser::parseManifest(const std::string& manife return mbgl::nullopt; } } + if (document.HasMember("cache_path")) { + const auto& cachePathValue = document["cache_path"]; + if (!cachePathValue.IsString()) { + mbgl::Log::Warning( + mbgl::Event::General, "Invalid cache_path is provided inside the manifest file: %s", filePath.c_str()); + return mbgl::nullopt; + } + manifest.cachePath = (getValidPath(manifest.manifestPath, ".") / cachePathValue.GetString()).string(); + if (manifest.cachePath.empty()) { + return mbgl::nullopt; + } + } mbgl::filesystem::path baseTestPath; if (document.HasMember("base_test_path")) { const auto& testPathValue = document["base_test_path"]; diff --git a/render-test/manifest_parser.hpp b/render-test/manifest_parser.hpp index cf5644d31..55249896c 100644 --- a/render-test/manifest_parser.hpp +++ b/render-test/manifest_parser.hpp @@ -20,6 +20,7 @@ public: const std::string& getAssetPath() const; const std::string& getManifestPath() const; const std::string& getResultPath() const; + const std::string& getCachePath() const; const std::set& getProbes() const; void doShuffle(uint32_t seed); @@ -47,6 +48,7 @@ private: std::string vendorPath; std::string assetPath; std::string resultPath; + std::string cachePath; std::vector> ignores; std::vector testPaths; std::set probes;