summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-10-22 16:32:21 +0300
committerGitHub <noreply@github.com>2019-10-22 16:32:21 +0300
commit068befa9df1c55904ec7e26bee062e5e33aecbce (patch)
treeb805b79750e0986fb2821fed1c0bd1c5d8cc5b18
parent2cdc09dbb13964ffd2af1e8776a56c70f80e0360 (diff)
downloadqtlocation-mapboxgl-068befa9df1c55904ec7e26bee062e5e33aecbce.tar.gz
[test-runner] Run render test runner as a NativeActivity app on android device (#15827)
* [test-runner]Add android render-test-runner NativeActivity app * [test-runner] Fix cmake for CI build failure * [test-runner] Update folder location, change app configureation * [test-runner] Add running instruction
-rw-r--r--benchmark/fixtures/api/cache.dbbin1298432 -> 1298432 bytes
-rw-r--r--next/benchmark/CMakeLists.txt6
-rw-r--r--next/platform/android/android.cmake68
-rw-r--r--next/render-test/CMakeLists.txt6
-rw-r--r--next/test/CMakeLists.txt1
-rw-r--r--platform/android/src/test/render_test_collator.cpp40
-rw-r--r--platform/android/src/test/render_test_number_format.cpp15
-rw-r--r--platform/android/src/test/render_test_runner.cpp57
-rw-r--r--render-test/android/README.md9
-rw-r--r--render-test/android/app/build.gradle29
-rw-r--r--render-test/android/app/src/main/AndroidManifest.xml26
-rw-r--r--render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.pngbin0 -> 3418 bytes
-rw-r--r--render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.pngbin0 -> 2206 bytes
-rw-r--r--render-test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.pngbin0 -> 4842 bytes
-rw-r--r--render-test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.pngbin0 -> 7718 bytes
-rw-r--r--render-test/android/app/src/main/res/values/strings.xml4
-rw-r--r--render-test/android/build.gradle16
-rw-r--r--render-test/android/gradle.properties1
-rw-r--r--render-test/android/gradle/wrapper/gradle-wrapper.jarbin0 -> 49896 bytes
-rw-r--r--render-test/android/gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xrender-test/android/gradlew164
-rw-r--r--render-test/android/gradlew.bat90
-rwxr-xr-xrender-test/android/render_test_setup.sh38
-rw-r--r--render-test/android/settings.gradle2
-rw-r--r--render-test/include/mbgl/render_test.hpp5
-rw-r--r--render-test/parser.cpp3
26 files changed, 565 insertions, 21 deletions
diff --git a/benchmark/fixtures/api/cache.db b/benchmark/fixtures/api/cache.db
index fc51eca3b9..64cd376892 100644
--- a/benchmark/fixtures/api/cache.db
+++ b/benchmark/fixtures/api/cache.db
Binary files differ
diff --git a/next/benchmark/CMakeLists.txt b/next/benchmark/CMakeLists.txt
index 2ae1227d91..117d556041 100644
--- a/next/benchmark/CMakeLists.txt
+++ b/next/benchmark/CMakeLists.txt
@@ -31,7 +31,11 @@ get_target_property(MBGL_CORE_PRIVATE_LIBRARIES mbgl-core LINK_LIBRARIES)
target_link_libraries(
mbgl-benchmark
- PRIVATE ${MBGL_CORE_PRIVATE_LIBRARIES} mbgl-core mbgl-vendor-benchmark
+ PRIVATE
+ ${MBGL_CORE_PRIVATE_LIBRARIES}
+ mbgl-vendor-benchmark
+ mbgl-core
+ $<$<PLATFORM_ID:Android>:mbgl-core-android>
)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
diff --git a/next/platform/android/android.cmake b/next/platform/android/android.cmake
index 6032294ff7..06183291db 100644
--- a/next/platform/android/android.cmake
+++ b/next/platform/android/android.cmake
@@ -40,8 +40,6 @@ target_sources(
${MBGL_ROOT}/platform/android/src/conversion/constant.cpp
${MBGL_ROOT}/platform/android/src/conversion/constant.hpp
${MBGL_ROOT}/platform/android/src/conversion/conversion.hpp
- ${MBGL_ROOT}/platform/android/src/file_source.cpp
- ${MBGL_ROOT}/platform/android/src/file_source.hpp
${MBGL_ROOT}/platform/android/src/geojson/feature.cpp
${MBGL_ROOT}/platform/android/src/geojson/feature.hpp
${MBGL_ROOT}/platform/android/src/geojson/feature_collection.cpp
@@ -85,10 +83,6 @@ target_sources(
${MBGL_ROOT}/platform/android/src/gson/json_primitive.cpp
${MBGL_ROOT}/platform/android/src/gson/json_primitive.hpp
${MBGL_ROOT}/platform/android/src/http_file_source.cpp
- ${MBGL_ROOT}/platform/android/src/i18n/collator.cpp
- ${MBGL_ROOT}/platform/android/src/i18n/collator_jni.hpp
- ${MBGL_ROOT}/platform/android/src/i18n/number_format.cpp
- ${MBGL_ROOT}/platform/android/src/i18n/number_format_jni.hpp
${MBGL_ROOT}/platform/android/src/image.cpp
${MBGL_ROOT}/platform/android/src/java/util.cpp
${MBGL_ROOT}/platform/android/src/java/util.hpp
@@ -98,9 +92,6 @@ target_sources(
${MBGL_ROOT}/platform/android/src/jni.hpp
${MBGL_ROOT}/platform/android/src/jni_native.cpp
${MBGL_ROOT}/platform/android/src/jni_native.hpp
- ${MBGL_ROOT}/platform/android/src/logger.cpp
- ${MBGL_ROOT}/platform/android/src/logger.hpp
- ${MBGL_ROOT}/platform/android/src/logging_android.cpp
${MBGL_ROOT}/platform/android/src/mapbox.cpp
${MBGL_ROOT}/platform/android/src/mapbox.hpp
${MBGL_ROOT}/platform/android/src/map/camera_position.cpp
@@ -193,8 +184,6 @@ target_sources(
${MBGL_ROOT}/platform/android/src/style/transition_options.hpp
${MBGL_ROOT}/platform/android/src/style/value.cpp
${MBGL_ROOT}/platform/android/src/style/value.hpp
- ${MBGL_ROOT}/platform/android/src/text/local_glyph_rasterizer.cpp
- ${MBGL_ROOT}/platform/android/src/text/local_glyph_rasterizer_jni.hpp
${MBGL_ROOT}/platform/android/src/thread.cpp
${MBGL_ROOT}/platform/android/src/timer.cpp
${MBGL_ROOT}/platform/default/src/mbgl/gfx/headless_backend.cpp
@@ -244,13 +233,43 @@ target_link_libraries(
)
add_library(
+ mbgl-core-android STATIC
+ ${MBGL_ROOT}/platform/android/src/file_source.cpp
+ ${MBGL_ROOT}/platform/android/src/file_source.hpp
+ ${MBGL_ROOT}/platform/android/src/i18n/collator.cpp
+ ${MBGL_ROOT}/platform/android/src/i18n/collator_jni.hpp
+ ${MBGL_ROOT}/platform/android/src/i18n/number_format.cpp
+ ${MBGL_ROOT}/platform/android/src/i18n/number_format_jni.hpp
+ ${MBGL_ROOT}/platform/android/src/logger.cpp
+ ${MBGL_ROOT}/platform/android/src/logger.hpp
+ ${MBGL_ROOT}/platform/android/src/logging_android.cpp
+ ${MBGL_ROOT}/platform/android/src/text/local_glyph_rasterizer.cpp
+ ${MBGL_ROOT}/platform/android/src/text/local_glyph_rasterizer_jni.hpp
+)
+
+target_include_directories(
+ mbgl-core-android
+ PRIVATE ${MBGL_ROOT}/platform/default/include ${MBGL_ROOT}/src
+)
+
+target_link_libraries(
+ mbgl-core-android
+ PRIVATE Mapbox::Base::jni.hpp mbgl-core
+)
+
+add_library(
mapbox-gl SHARED
${MBGL_ROOT}/platform/android/src/main.cpp
)
+target_include_directories(
+ mapbox-gl
+ PRIVATE ${MBGL_ROOT}/platform/default/include ${MBGL_ROOT}/src
+)
+
target_link_libraries(
mapbox-gl
- PRIVATE Mapbox::Base::jni.hpp mbgl-core
+ PRIVATE Mapbox::Base::jni.hpp mbgl-core mbgl-core-android
)
add_library(
@@ -296,15 +315,40 @@ target_link_libraries(
PRIVATE Mapbox::Base::jni.hpp mapbox-gl mbgl-benchmark
)
+add_library(
+ mbgl-render-test-runner SHARED
+ ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c
+ ${MBGL_ROOT}/platform/android/src/test/render_test_runner.cpp
+ ${MBGL_ROOT}/platform/default/src/mbgl/text/local_glyph_rasterizer.cpp
+ ${MBGL_ROOT}/platform/android/src/test/render_test_collator.cpp
+ ${MBGL_ROOT}/platform/android/src/test/render_test_number_format.cpp
+)
+
+target_include_directories(
+ mbgl-render-test-runner
+ PRIVATE ${ANDROID_NDK}/sources/android/native_app_glue ${MBGL_ROOT}/platform/android/src ${MBGL_ROOT}/src
+)
+
+target_link_libraries(
+ mbgl-render-test-runner
+ PRIVATE
+ Mapbox::Base::jni.hpp
+ android
+ log
+ mbgl-render-test
+)
+
# Android has no concept of MinSizeRel on android.toolchain.cmake and provides configurations tuned for binary size. We can push it a bit
# more with code folding and LTO.
set_target_properties(example-custom-layer PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
set_target_properties(mapbox-gl PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
set_target_properties(mbgl-benchmark-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
+set_target_properties(mbgl-render-test-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
set_target_properties(mbgl-test-runner PROPERTIES LINK_FLAGS_RELEASE "-fuse-ld=gold -O2 -flto -Wl,--icf=safe")
target_compile_options(example-custom-layer PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mapbox-gl PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-core PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
+target_compile_options(mbgl-render-test-runner PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-icu PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
target_compile_options(mbgl-vendor-sqlite PRIVATE $<$<CONFIG:Release>:-Qunused-arguments -flto>)
diff --git a/next/render-test/CMakeLists.txt b/next/render-test/CMakeLists.txt
index b3aa20ba62..02ee6141cf 100644
--- a/next/render-test/CMakeLists.txt
+++ b/next/render-test/CMakeLists.txt
@@ -1,5 +1,5 @@
add_library(
- mbgl-render-test SHARED EXCLUDE_FROM_ALL
+ mbgl-render-test STATIC EXCLUDE_FROM_ALL
${MBGL_ROOT}/expression-test/test_runner_common.cpp
${MBGL_ROOT}/expression-test/test_runner_common.hpp
${MBGL_ROOT}/render-test/allocation_index.cpp
@@ -24,7 +24,7 @@ target_compile_definitions(
# FIXME: Should not use core private interface
target_include_directories(
mbgl-render-test
- PRIVATE ${MBGL_ROOT}/src
+ PRIVATE ${MBGL_ROOT}/src ${MBGL_ROOT}/platform/default/include
)
target_include_directories(
@@ -40,8 +40,8 @@ target_link_libraries(
Mapbox::Base::Extras::args
Mapbox::Base::Extras::filesystem
Mapbox::Base::pixelmatch-cpp
- mbgl-core
mbgl-vendor-boost
+ PUBLIC mbgl-core
)
if(CMAKE_SYSTEM_NAME STREQUAL Android)
diff --git a/next/test/CMakeLists.txt b/next/test/CMakeLists.txt
index 586e2bbdaa..4995fa4e56 100644
--- a/next/test/CMakeLists.txt
+++ b/next/test/CMakeLists.txt
@@ -153,6 +153,7 @@ target_link_libraries(
Mapbox::Base::Extras::args
Mapbox::Base::pixelmatch-cpp
mbgl-core
+ $<$<PLATFORM_ID:Android>:mbgl-core-android>
)
target_link_libraries(
diff --git a/platform/android/src/test/render_test_collator.cpp b/platform/android/src/test/render_test_collator.cpp
new file mode 100644
index 0000000000..e6e3b27b48
--- /dev/null
+++ b/platform/android/src/test/render_test_collator.cpp
@@ -0,0 +1,40 @@
+#include <mbgl/i18n/collator.hpp>
+
+#include <memory>
+
+namespace mbgl {
+namespace platform {
+
+class Collator::Impl {
+public:
+ Impl(bool caseSensitive_, bool diacriticSensitive_, optional<std::string>)
+ : caseSensitive(caseSensitive_), diacriticSensitive(diacriticSensitive_) {}
+
+ bool operator==(const Impl& other) const { return true; }
+
+ int compare(const std::string& lhs, const std::string& rhs) const { return 0; }
+
+ std::string resolvedLocale() const { return ""; }
+
+private:
+ bool caseSensitive;
+ bool diacriticSensitive;
+};
+
+Collator::Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale_)
+ : impl(std::make_shared<Impl>(caseSensitive, diacriticSensitive, std::move(locale_))) {}
+
+int Collator::compare(const std::string& lhs, const std::string& rhs) const {
+ return impl->compare(lhs, rhs);
+}
+
+bool Collator::operator==(const Collator& other) const {
+ return *impl == *(other.impl);
+}
+
+std::string Collator::resolvedLocale() const {
+ return impl->resolvedLocale();
+}
+
+} // namespace platform
+} // namespace mbgl
diff --git a/platform/android/src/test/render_test_number_format.cpp b/platform/android/src/test/render_test_number_format.cpp
new file mode 100644
index 0000000000..57710c8558
--- /dev/null
+++ b/platform/android/src/test/render_test_number_format.cpp
@@ -0,0 +1,15 @@
+#include <mbgl/i18n/number_format.hpp>
+
+namespace mbgl {
+namespace platform {
+
+std::string formatNumber(double /*number*/,
+ const std::string& /*localeId */,
+ const std::string& /*currency*/,
+ uint8_t /*minFractionDigits*/,
+ uint8_t /*maxFractionDigits*/) {
+ return "";
+}
+
+} // namespace platform
+} // namespace mbgl
diff --git a/platform/android/src/test/render_test_runner.cpp b/platform/android/src/test/render_test_runner.cpp
new file mode 100644
index 0000000000..3f85140128
--- /dev/null
+++ b/platform/android/src/test/render_test_runner.cpp
@@ -0,0 +1,57 @@
+#include <android_native_app_glue.h>
+#include <mbgl/render_test.hpp>
+#include "jni.hpp"
+#include "logger.hpp"
+
+#include <string>
+#include <vector>
+
+#include <mbgl/util/logging.hpp>
+
+#include <android/log.h>
+
+namespace mbgl {
+
+namespace {
+
+int severityToPriority(EventSeverity severity) {
+ switch (severity) {
+ case EventSeverity::Debug:
+ return ANDROID_LOG_DEBUG;
+
+ case EventSeverity::Info:
+ return ANDROID_LOG_INFO;
+
+ case EventSeverity::Warning:
+ return ANDROID_LOG_WARN;
+
+ case EventSeverity::Error:
+ return ANDROID_LOG_ERROR;
+
+ default:
+ return ANDROID_LOG_VERBOSE;
+ }
+}
+
+} // namespace
+
+void Log::platformRecord(EventSeverity severity, const std::string& msg) {
+ __android_log_print(severityToPriority(severity), "mbgl", "%s", msg.c_str());
+}
+
+} // namespace mbgl
+
+void android_main(struct android_app* app) {
+ mbgl::android::theJVM = app->activity->vm;
+ JNIEnv* env;
+ app->activity->vm->AttachCurrentThread(&env, NULL);
+
+ std::vector<std::string> arguments = {"mbgl-render-test-runner", "-p", "/sdcard/render-test"};
+ std::vector<char*> argv;
+ for (const auto& arg : arguments) {
+ argv.push_back((char*)arg.data());
+ }
+ argv.push_back(nullptr);
+ (void)mbgl::runRenderTests(argv.size() - 1, argv.data());
+ app->activity->vm->DetachCurrentThread();
+} \ No newline at end of file
diff --git a/render-test/android/README.md b/render-test/android/README.md
new file mode 100644
index 0000000000..270c970fce
--- /dev/null
+++ b/render-test/android/README.md
@@ -0,0 +1,9 @@
+# RenderTestRunner
+
+This app is a purely native application, with no Java source code, that can run **mbgl-render-test-runner** on android devices.
+
+
+## Setup the test environment
+- Run render_test_setup.sh so that all the necessary test resources are pushed to the device.
+
+- Switch on storage permission of the app so that it can read/write data on SD card. \ No newline at end of file
diff --git a/render-test/android/app/build.gradle b/render-test/android/app/build.gradle
new file mode 100644
index 0000000000..60609e3ba2
--- /dev/null
+++ b/render-test/android/app/build.gradle
@@ -0,0 +1,29 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 28
+
+ defaultConfig {
+ applicationId = 'com.mapbox.mapboxsdk.maps.render_test_runner'
+ minSdkVersion 14
+ targetSdkVersion 28
+ externalNativeBuild {
+ cmake {
+ arguments '-DANDROID_CCACHE=ccache'
+ arguments '-DANDROID_STL=c++_static'
+ targets 'mbgl-render-test-runner'
+ }
+ }
+ }
+ externalNativeBuild {
+ cmake {
+ version '3.10.2'
+ path '../../../next/CMakeLists.txt'
+ }
+ }
+}
+
+dependencies {
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
+}
diff --git a/render-test/android/app/src/main/AndroidManifest.xml b/render-test/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..6c7af7ed8f
--- /dev/null
+++ b/render-test/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.native_activity"
+ android:versionCode="1"
+ android:versionName="1.0">
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <application
+ android:allowBackup="false"
+ android:fullBackupContent="false"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:hasCode="false">
+
+ <activity android:name="android.app.NativeActivity"
+ android:label="@string/app_name"
+ android:screenOrientation="portrait">
+ <meta-data android:name="android.app.lib_name"
+ android:value="mbgl-render-test-runner" />
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
diff --git a/render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000000..cde69bccce
--- /dev/null
+++ b/render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000000..c133a0cbd3
--- /dev/null
+++ b/render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/render-test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/render-test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000000..bfa42f0e7b
--- /dev/null
+++ b/render-test/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/render-test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/render-test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000000..324e72cdd7
--- /dev/null
+++ b/render-test/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/render-test/android/app/src/main/res/values/strings.xml b/render-test/android/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..00b181ca34
--- /dev/null
+++ b/render-test/android/app/src/main/res/values/strings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">RenderTestRunner</string>
+</resources>
diff --git a/render-test/android/build.gradle b/render-test/android/build.gradle
new file mode 100644
index 0000000000..e58b831f71
--- /dev/null
+++ b/render-test/android/build.gradle
@@ -0,0 +1,16 @@
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.5.1'
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
diff --git a/render-test/android/gradle.properties b/render-test/android/gradle.properties
new file mode 100644
index 0000000000..2427fd0bf4
--- /dev/null
+++ b/render-test/android/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx1536m \ No newline at end of file
diff --git a/render-test/android/gradle/wrapper/gradle-wrapper.jar b/render-test/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000000..8c0fb64a86
--- /dev/null
+++ b/render-test/android/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/render-test/android/gradle/wrapper/gradle-wrapper.properties b/render-test/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000000..2e4993ee89
--- /dev/null
+++ b/render-test/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Mon Oct 21 12:45:47 EEST 2019
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/render-test/android/gradlew b/render-test/android/gradlew
new file mode 100755
index 0000000000..91a7e269e1
--- /dev/null
+++ b/render-test/android/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/render-test/android/gradlew.bat b/render-test/android/gradlew.bat
new file mode 100644
index 0000000000..aec99730b4
--- /dev/null
+++ b/render-test/android/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/render-test/android/render_test_setup.sh b/render-test/android/render_test_setup.sh
new file mode 100755
index 0000000000..e34d71df3b
--- /dev/null
+++ b/render-test/android/render_test_setup.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+adb shell rm -rf /sdcard/render-test
+adb shell mkdir /sdcard/render-test
+adb shell mkdir /sdcard/render-test/vendor
+adb shell mkdir /sdcard/render-test/expected
+adb shell mkdir /sdcard/render-test/ignores
+
+# push test sources
+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/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/vendor/mapbox-gl-styles/styles
+adb push ../../vendor/mapbox-gl-styles/sprites /sdcard/render-test/vendor/mapbox-gl-styles/sprites
+adb push ../../mapbox-gl-js/test/integration/data /sdcard/render-test/mapbox-gl-js/test/integration/data
+adb push ../../mapbox-gl-js/test/integration/geojson /sdcard/render-test/mapbox-gl-js/test/integration/geojson
+mkdir sprites
+cp -r ../../mapbox-gl-js/test/integration/sprites/ sprites
+adb push sprites /sdcard/render-test/mapbox-gl-js/test/integration/sprites
+rm -rf sprites
+
+# push extra expectations
+adb push ../../render-test/expected /sdcard/render-test/render-test/expected
+
+# push default ignore lists
+adb shell mkdir /sdcard/render-test/platform
+adb shell mkdir /sdcard/render-test/platform/node
+adb shell mkdir /sdcard/render-test/platform/node/test
+adb push ../../platform/node/test/ignores.json /sdcard/render-test/platform/node/test
+adb shell mkdir /sdcard/render-test/render-test
+adb push ../../render-test/linux-ignores.json /sdcard/render-test/render-test
+
+adb shell ls /sdcard/render-test/ \ No newline at end of file
diff --git a/render-test/android/settings.gradle b/render-test/android/settings.gradle
new file mode 100644
index 0000000000..573abcb323
--- /dev/null
+++ b/render-test/android/settings.gradle
@@ -0,0 +1,2 @@
+include ':app'
+
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 69d6981c02..d6ba561950 100644
--- a/render-test/parser.cpp
+++ b/render-test/parser.cpp
@@ -767,7 +767,8 @@ std::string createResultItem(const TestMetadata& metadata, bool hasFailedTests)
}
}
} else {
- assert(!metadata.errorMessage.empty());
+ // FIXME: there are several places that errorMessage is not filled
+ // comment out assert(!metadata.errorMessage.empty());
html.append("<p style=\"color: red\"><strong>Error:</strong> " + metadata.errorMessage + "</p>\n");
}
if (metadata.difference != 0.0) {