diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-12-03 13:15:45 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-12-03 16:26:22 +0200 |
commit | 41324842b294d9d38eb42f1b8726e270510614e0 (patch) | |
tree | b92364de715385bbb05e5a45e4448b48507ce062 /render-test | |
parent | 75f8530ed1d9213691b652cd6fa4ce22054645b1 (diff) | |
download | qtlocation-mapboxgl-41324842b294d9d38eb42f1b8726e270510614e0.tar.gz |
[test-runner] Allow to define filter inside manifest file
Command line option is still available and allows to override filter
that is defined in a manifest file.
Diffstat (limited to 'render-test')
-rw-r--r-- | render-test/android-manifest-probe-memory.json | 3 | ||||
-rw-r--r-- | render-test/linux-manifest-probe-memory.json | 3 | ||||
-rw-r--r-- | render-test/manifest_parser.cpp | 13 | ||||
-rw-r--r-- | render-test/manifest_parser.hpp | 2 | ||||
-rw-r--r-- | render-test/render_test.cpp | 3 |
5 files changed, 17 insertions, 7 deletions
diff --git a/render-test/android-manifest-probe-memory.json b/render-test/android-manifest-probe-memory.json index bc94465761..a3562088f4 100644 --- a/render-test/android-manifest-probe-memory.json +++ b/render-test/android-manifest-probe-memory.json @@ -6,5 +6,6 @@ "asset_path": "mapbox-gl-js/test/integration", "result_path":"/sdcard/", "probes": ["probeMemory"], - "metric_path":"render-test/metrics/android" + "metric_path":"render-test/metrics/android", + "filter": "real-world" }
\ No newline at end of file diff --git a/render-test/linux-manifest-probe-memory.json b/render-test/linux-manifest-probe-memory.json index 1f9fa1ca5c..25b59e4a44 100644 --- a/render-test/linux-manifest-probe-memory.json +++ b/render-test/linux-manifest-probe-memory.json @@ -5,5 +5,6 @@ "vendor_path":"../vendor", "asset_path": "../mapbox-gl-js/test/integration", "probes": ["probeMemory"], - "metric_path":"metrics/linux-gcc8" + "metric_path":"metrics/linux-gcc8", + "filter": "real-world" }
\ No newline at end of file diff --git a/render-test/manifest_parser.cpp b/render-test/manifest_parser.cpp index bcc10c91d4..e3217f0f50 100644 --- a/render-test/manifest_parser.cpp +++ b/render-test/manifest_parser.cpp @@ -257,7 +257,7 @@ mbgl::filesystem::path getValidPath(const std::string& manifestPath, const std:: mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manifestPath, const std::vector<std::string>& testNames, - const std::string& testFilter) { + std::string testFilter) { Manifest manifest; const auto filePath = mbgl::filesystem::path(manifestPath); manifest.manifestPath = manifestPath.substr(0, manifestPath.find(filePath.filename())); @@ -412,6 +412,17 @@ mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manife } } + if (testFilter.empty() && document.HasMember("filter")) { + const auto& filterValue = document["filter"]; + if (!filterValue.IsString()) { + mbgl::Log::Warning( + mbgl::Event::General, "Invalid filter is provoided inside the manifest file: %s", filePath.c_str()); + return mbgl::nullopt; + } + + testFilter = filterValue.GetString(); + } + manifest.testRootPath = enbaleProbeTest ? probeTestPath.string() : baseTestPath.string(); if (manifest.testRootPath.back() == '/') { manifest.testRootPath.pop_back(); diff --git a/render-test/manifest_parser.hpp b/render-test/manifest_parser.hpp index 8e2c45efde..cf5644d316 100644 --- a/render-test/manifest_parser.hpp +++ b/render-test/manifest_parser.hpp @@ -56,5 +56,5 @@ class ManifestParser { public: static mbgl::optional<Manifest> parseManifest(const std::string& manifestPath, const std::vector<std::string>& testNames, - const std::string& testFilter); + std::string testFilter); }; diff --git a/render-test/render_test.cpp b/render-test/render_test.cpp index b0b2c745ec..89536a0605 100644 --- a/render-test/render_test.cpp +++ b/render-test/render_test.cpp @@ -101,9 +101,6 @@ ArgumentsTuple parseArguments(int argc, char** argv) { mbgl::Log::Info(mbgl::Event::General, stream.str()); mbgl::Log::Error(mbgl::Event::General, e.what()); exit(2); - } catch (const std::regex_error& e) { - mbgl::Log::Error(mbgl::Event::General, "Invalid filter regular expression: %s", e.what()); - exit(3); } mbgl::filesystem::path manifestPath{testPathValue ? args::get(testPathValue) : std::string{TEST_RUNNER_ROOT_PATH}}; |