summaryrefslogtreecommitdiff
path: root/render-test/manifest_parser.cpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2020-01-08 13:41:35 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2020-01-08 14:58:05 +0200
commit5a0f43037fc77d200a3759e15b258fc4e5717b43 (patch)
treed6f88a23fc74cbc93b0c360d936af5c788b2c21d /render-test/manifest_parser.cpp
parent87013ad6e1138af44f5d37d18973ec6c4236db56 (diff)
downloadqtlocation-mapboxgl-5a0f43037fc77d200a3759e15b258fc4e5717b43.tar.gz
[render-test] Remove positional argument
Not in use, for running a single test, use -f instead.
Diffstat (limited to 'render-test/manifest_parser.cpp')
-rw-r--r--render-test/manifest_parser.cpp46
1 files changed, 15 insertions, 31 deletions
diff --git a/render-test/manifest_parser.cpp b/render-test/manifest_parser.cpp
index 45fceebeba..18b4b98cdd 100644
--- a/render-test/manifest_parser.cpp
+++ b/render-test/manifest_parser.cpp
@@ -97,7 +97,6 @@ mbgl::filesystem::path getValidPath(const std::string& manifestPath, const std::
} // namespace
mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manifestPath,
- const std::vector<std::string>& testNames,
std::string testFilter) {
Manifest manifest;
const auto filePath = mbgl::filesystem::path(manifestPath);
@@ -263,43 +262,28 @@ mbgl::optional<Manifest> ManifestParser::parseManifest(const std::string& manife
manifest.resultPath.pop_back();
}
- std::vector<mbgl::filesystem::path> paths;
- for (const auto& id : testNames) {
- paths.emplace_back(manifest.testRootPath + "/" + id);
- }
- if (paths.empty()) {
- paths.emplace_back(manifest.testRootPath);
- }
-
- // Recursively traverse through the test paths and collect test directories containing "style.json".
+ auto& path = manifest.testRootPath;
auto& testPaths = manifest.testPaths;
- testPaths.reserve(paths.size());
- for (const auto& path : paths) {
- if (!mbgl::filesystem::exists(path)) {
- mbgl::Log::Warning(
- mbgl::Event::General, "Provided test folder '%s' does not exist.", path.string().c_str());
+
+ for (auto& testPath : mbgl::filesystem::recursive_directory_iterator(path)) {
+ // Skip paths that fail regexp search.
+ if (!testFilter.empty() && !std::regex_search(testPath.path().string(), std::regex(testFilter))) {
continue;
}
- for (auto& testPath : mbgl::filesystem::recursive_directory_iterator(path)) {
- // Skip paths that fail regexp search.
- if (!testFilter.empty() && !std::regex_search(testPath.path().string(), std::regex(testFilter))) {
- continue;
- }
- if (testPath.path().filename() == "style.json") {
- const auto defaultExpectationPath{std::move(mbgl::filesystem::path(testPath).remove_filename())};
- const auto rootLength = manifest.testRootPath.length();
- auto testId = defaultExpectationPath.string();
- testId = testId.substr(rootLength + 1, testId.length() - rootLength - 1);
+ if (testPath.path().filename() == "style.json") {
+ const auto defaultExpectationPath{std::move(mbgl::filesystem::path(testPath).remove_filename())};
+ const auto rootLength = manifest.testRootPath.length();
+ auto testId = defaultExpectationPath.string();
+ testId = testId.substr(rootLength + 1, testId.length() - rootLength - 1);
- std::vector<mbgl::filesystem::path> expectedMetricPaths{expectedMetricPath};
+ std::vector<mbgl::filesystem::path> expectedMetricPaths{expectedMetricPath};
#if defined(__ANDROID__)
- expectedMetricPaths.emplace_back("/sdcard/baselines/");
+ expectedMetricPaths.emplace_back("/sdcard/baselines/");
#endif
- testPaths.emplace_back(testPath,
- getTestExpectations(defaultExpectationPath, testId, expectationPaths),
- getTestExpectations(defaultExpectationPath, testId, expectedMetricPaths));
- }
+ testPaths.emplace_back(testPath,
+ getTestExpectations(defaultExpectationPath, testId, expectationPaths),
+ getTestExpectations(defaultExpectationPath, testId, expectedMetricPaths));
}
}