summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-10-17 11:56:42 +0300
committerzmiao <miao.zhao@mapbox.com>2019-10-17 16:18:15 +0300
commit5b1a52c90dfaa56bb38b686201bb1c1550c1b6d7 (patch)
tree465cf653a4a8af2c2538c8f4c26ba1047b131541
parentf1e9f6ed0259fbec01f12e69b00ea4b5305403ea (diff)
downloadqtlocation-mapboxgl-5b1a52c90dfaa56bb38b686201bb1c1550c1b6d7.tar.gz
[test-runner] Add changes
-rw-r--r--render-test/include/mbgl/render_test.hpp5
-rw-r--r--render-test/parser.cpp14
-rw-r--r--render-test/render_test.cpp15
-rwxr-xr-xrender_test_setup.sh18
4 files changed, 41 insertions, 11 deletions
diff --git a/render-test/include/mbgl/render_test.hpp b/render-test/include/mbgl/render_test.hpp
index 42a539603d..8a82079bee 100644
--- a/render-test/include/mbgl/render_test.hpp
+++ b/render-test/include/mbgl/render_test.hpp
@@ -1,9 +1,6 @@
#pragma once
-
-#include <mbgl/util/util.hpp>
-
namespace mbgl {
-MBGL_EXPORT int runRenderTests(int argc, char* argv[]);
+int runRenderTests(int argc, char* argv[]);
} // namespace mbgl
diff --git a/render-test/parser.cpp b/render-test/parser.cpp
index 41c9b83298..c9343fdd26 100644
--- a/render-test/parser.cpp
+++ b/render-test/parser.cpp
@@ -97,7 +97,7 @@ std::string prependFileScheme(const std::string &url) {
}
mbgl::optional<std::string> getVendorPath(const std::string& url, const std::regex& regex, bool glyphsPath = false) {
- static const mbgl::filesystem::path vendorPath(std::string(TEST_RUNNER_ROOT_PATH) + "/vendor/");
+ static const mbgl::filesystem::path vendorPath(std::string("/sdcard/render-test") + "/vendor/");
mbgl::filesystem::path file = std::regex_replace(url, regex, vendorPath.string());
if (mbgl::filesystem::exists(file.parent_path())) {
@@ -112,7 +112,7 @@ mbgl::optional<std::string> getVendorPath(const std::string& url, const std::reg
}
mbgl::optional<std::string> getIntegrationPath(const std::string& url, const std::string& parent, const std::regex& regex, bool glyphsPath = false) {
- static const mbgl::filesystem::path integrationPath(std::string(TEST_RUNNER_ROOT_PATH) + "/mapbox-gl-js/test/integration/");
+ static const mbgl::filesystem::path integrationPath(std::string("/sdcard/render-test") + "/mapbox-gl-js/test/integration/");
mbgl::filesystem::path file = std::regex_replace(url, regex, integrationPath.string() + parent);
if (mbgl::filesystem::exists(file.parent_path())) {
@@ -435,16 +435,16 @@ ArgumentsTuple parseArguments(int argc, char** argv) {
std::vector<std::pair<std::string, std::string>> parseIgnores() {
std::vector<std::pair<std::string, std::string>> ignores;
- auto mainIgnoresPath = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("platform/node/test/ignores.json");
+ auto mainIgnoresPath = mbgl::filesystem::path("/sdcard/render-test").append("platform/node/test/ignores.json");
mbgl::filesystem::path platformSpecificIgnores;
mbgl::filesystem::path ownTestsIgnores =
- mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/tests/should-fail.json");
+ mbgl::filesystem::path("/sdcard/render-test").append("render-test/tests/should-fail.json");
#ifdef __APPLE__
- platformSpecificIgnores = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/mac-ignores.json");
+ platformSpecificIgnores = mbgl::filesystem::path("/sdcard/render-test").append("render-test/mac-ignores.json");
#elif __linux__
- platformSpecificIgnores = mbgl::filesystem::path(TEST_RUNNER_ROOT_PATH).append("render-test/linux-ignores.json");
+ platformSpecificIgnores = mbgl::filesystem::path("/sdcard/render-test").append("render-test/linux-ignores.json");
#endif
std::vector<mbgl::filesystem::path> ignoresPaths = {mainIgnoresPath, platformSpecificIgnores, ownTestsIgnores};
@@ -703,7 +703,7 @@ std::string createResultItem(const TestMetadata& metadata, bool hasFailedTests)
html.append(" src=\"data:image/png;base64," + encodeBase64(metadata.actual) + "\">\n");
}
} else {
- assert(!metadata.errorMessage.empty());
+// assert(!metadata.errorMessage.empty());
html.append("<p style=\"color: red\"><strong>Error:</strong> " + metadata.errorMessage + "</p>\n");
}
if (metadata.difference != 0.0) {
diff --git a/render-test/render_test.cpp b/render-test/render_test.cpp
index bac193237d..f1945058b7 100644
--- a/render-test/render_test.cpp
+++ b/render-test/render_test.cpp
@@ -8,7 +8,10 @@
#include "parser.hpp"
#include "runner.hpp"
+#include <mbgl/util/logging.hpp>
+
#include <random>
+#include <sstream>
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
@@ -120,16 +123,25 @@ int runRenderTests(int argc, char** argv) {
color = "green";
stats.passedTests++;
printf(ANSI_COLOR_GREEN "* passed %s" ANSI_COLOR_RESET "\n", id.c_str());
+ std::stringstream ss;
+ ss << " passed: " << id.c_str() << ".";
+ mbgl::Log::Warning(mbgl::Event::General, ss.str());
} else if (errored) {
status = "errored";
color = "red";
stats.erroredTests++;
printf(ANSI_COLOR_RED "* errored %s" ANSI_COLOR_RESET "\n", id.c_str());
+ std::stringstream ss;
+ ss << " errored: " << id.c_str() << ".";
+ mbgl::Log::Warning(mbgl::Event::General, ss.str());
} else {
status = "failed";
color = "red";
stats.failedTests++;
printf(ANSI_COLOR_RED "* failed %s" ANSI_COLOR_RESET "\n", id.c_str());
+ std::stringstream ss;
+ ss << " failed: " << id.c_str() << ".";
+ mbgl::Log::Warning(mbgl::Event::General, ss.str());
}
}
@@ -145,6 +157,9 @@ int runRenderTests(int argc, char** argv) {
if (stats.passedTests) {
printf(ANSI_COLOR_GREEN "%u passed (%.1lf%%)" ANSI_COLOR_RESET "\n", stats.passedTests, 100.0 * stats.passedTests / count);
+ std::stringstream ss;
+ ss << " passed tests: " << stats.passedTests << ", percentage: " << (100.0 * stats.passedTests / count);
+ mbgl::Log::Warning(mbgl::Event::General, ss.str());
}
if (stats.ignorePassedTests) {
printf(ANSI_COLOR_YELLOW "%u passed but were ignored (%.1lf%%)" ANSI_COLOR_RESET "\n", stats.ignorePassedTests, 100.0 * stats.ignorePassedTests / count);
diff --git a/render_test_setup.sh b/render_test_setup.sh
new file mode 100755
index 0000000000..a06a8ea07a
--- /dev/null
+++ b/render_test_setup.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+adb shell rm -rf /sdcard/render-test
+adb shell mkdir /sdcard/render-test
+
+# adb push mapbox-gl-js/test/integration/render-tests /sdcard/render-test/mapbox-gl-js/test/integration/render-tests
+# adb push mapbox-gl-js/test/integration/query-tests /sdcard/render-test/mapbox-gl-js/test/integration/query-tests
+adb push mapbox-gl-js/test/integration/tiles /sdcard/render-test/mapbox-gl-js/test/integration/tiles
+adb push mapbox-gl-js/test/integration/glyphs /sdcard/render-test/mapbox-gl-js/test/integration/glyphs
+adb push mapbox-gl-js/test/integration/sprites /sdcard/render-test/mapbox-gl-js/test/integration/sprites
+adb push mapbox-gl-js/test/integration/styles /sdcard/render-test/mapbox-gl-js/test/integration/styles
+adb push mapbox-gl-js/test/integration/tilesets /sdcard/render-test/mapbox-gl-js/test/integration/tilesets
+adb push mapbox-gl-js/test/integration/image /sdcard/render-test/mapbox-gl-js/test/integration/image
+adb push mapbox-gl-js/test/integration/video /sdcard/render-test/mapbox-gl-js/test/integration/video
+adb push vendor/mapbox-gl-styles/styles /sdcard/render-test/mapbox-gl-js/test/integration/mapbox-gl-styles/styles
+adb push render-test/expected /sdcard/render-test/render-test/expected
+
+adb shell ls /sdcard/render-test/mapbox-gl-js/test/integration \ No newline at end of file