summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-06-23 16:39:27 +0200
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2016-11-27 18:50:24 +0200
commitc810d16f0d2787f15e06651ea595020415d5a8d5 (patch)
tree216b098897a887f5c1a8fff0aa78350e75445e52
parent5ae92de618e5242f6a8a30485b5ecaa9ef0ebb5e (diff)
downloadqtlocation-mapboxgl-c810d16f0d2787f15e06651ea595020415d5a8d5.tar.gz
[android][build] core tests - initial setup for rendering tests
-rw-r--r--.gitignore2
m---------.mason0
-rw-r--r--Makefile44
-rw-r--r--platform/android/config.cmake206
-rwxr-xr-xplatform/android/src/jni.cpp12
-rw-r--r--platform/android/src/jni.hpp6
-rw-r--r--platform/android/src/main.cpp9
-rw-r--r--platform/android/src/test/Main.java15
-rw-r--r--platform/android/src/test/main.jni.cpp76
-rw-r--r--test/fixtures/annotations/assets.zipbin481374 -> 0 bytes
-rw-r--r--test/fixtures/api/assets.zipbin167696 -> 0 bytes
-rw-r--r--test/fixtures/storage/assets.zipbin1243 -> 0 bytes
-rw-r--r--test/map/transform.test.cpp6
-rw-r--r--test/src/mbgl/test/util.hpp5
-rw-r--r--test/storage/asset_file_source.test.cpp2
15 files changed, 305 insertions, 78 deletions
diff --git a/.gitignore b/.gitignore
index ecd9b7ec57..873b80fae8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,5 @@ xcuserdata
/platform/macos/macos.xcworkspace/xcshareddata/macos.xcscmblueprint
/platform/ios/ios.xcworkspace/xcshareddata/ios.xcscmblueprint
/documentation
+test/fixtures/api/assets.zip
+test/fixtures/storage/assets.zip
diff --git a/.mason b/.mason
-Subproject 4fff08aefa99f79252c4bb5a0c6c42ca32534eb
+Subproject af4a2c693e6647ae78ccea23504af6e96d265b5
diff --git a/Makefile b/Makefile
index 999a4efa79..d0986f5e60 100644
--- a/Makefile
+++ b/Makefile
@@ -467,8 +467,9 @@ test-node: node
#### Android targets ###########################################################
-ANDROID_ENV = platform/android/scripts/toolchain.sh
-ANDROID_ABIS = arm-v5 arm-v7 arm-v8 x86 x86-64 mips
+MBGL_ANDROID_ENV = platform/android/scripts/toolchain.sh
+MBGL_ANDROID_ABIS = arm-v5 arm-v7 arm-v8 x86 x86-64 mips
+MBGL_ANDROID_LOCAL_WORK_DIR = /data/local/tmp/core-tests
.PHONY: android-style-code
android-style-code:
@@ -481,7 +482,7 @@ build/android-$1/$(BUILDTYPE): $(BUILD_DEPS)
mkdir -p build/android-$1/$(BUILDTYPE)
build/android-$1/$(BUILDTYPE)/toolchain.cmake: platform/android/scripts/toolchain.sh build/android-$1/$(BUILDTYPE)
- $(ANDROID_ENV) $1 > build/android-$1/$(BUILDTYPE)/toolchain.cmake
+ $(MBGL_ANDROID_ENV) $1 > build/android-$1/$(BUILDTYPE)/toolchain.cmake
build/android-$1/$(BUILDTYPE)/Makefile: build/android-$1/$(BUILDTYPE)/toolchain.cmake platform/android/config.cmake
cd build/android-$1/$(BUILDTYPE) && cmake ../../.. -G Ninja \
@@ -490,6 +491,10 @@ build/android-$1/$(BUILDTYPE)/Makefile: build/android-$1/$(BUILDTYPE)/toolchain.
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DMBGL_PLATFORM=android
+.PHONY: android-test-lib-$1
+android-test-lib-$1: build/android-$1/$(BUILDTYPE)/Makefile
+ $(NINJA) $(NINJA_ARGS) -j$(JOBS) -C build/android-$1/$(BUILDTYPE) mbgl-test-stripped
+
.PHONY: android-lib-$1
android-lib-$1: build/android-$1/$(BUILDTYPE)/Makefile
$(NINJA) $(NINJA_ARGS) -j$(JOBS) -C build/android-$1/$(BUILDTYPE) all
@@ -498,6 +503,37 @@ android-lib-$1: build/android-$1/$(BUILDTYPE)/Makefile
android-$1: android-lib-$1
cd platform/android && ./gradlew --parallel --max-workers=$(JOBS) assemble$(BUILDTYPE)
+run-android-core-test-$1: android-lib-$1 android-test-lib-$1
+ # Compile main sources and extract the classes (using the test app to get all transitive dependencies in one place)
+ cd platform/android && ./gradlew assembleDebug
+ unzip -o platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug.apk classes.dex -d build/android-$1/$(BUILDTYPE)
+
+ #Compile Test runner
+ find platform/android/src/test -name "*.java" > build/android-$1/$(BUILDTYPE)/java-sources.txt
+ javac -sourcepath platform/android/src/test -d build/android-$1/$(BUILDTYPE) -source 1.7 -target 1.7 @build/android-$1/$(BUILDTYPE)/java-sources.txt
+ #Combine and dex
+ cd build/android-$1/$(BUILDTYPE) && $(ANDROID_HOME)/build-tools/25.0.0/dx --dex --output=test.jar *.class classes.dex
+
+ #Ensure clean state on the device
+ adb shell "rm -Rf $(MBGL_ANDROID_LOCAL_WORK_DIR) && mkdir -p $(MBGL_ANDROID_LOCAL_WORK_DIR)/test"
+
+ # Generate zipped asset files
+ cd test/fixtures/api && zip -r assets.zip assets && cd -
+ cd test/fixtures/storage && zip -r assets.zip assets && cd -
+
+ #Push all needed files to the device
+ adb push build/android-$1/$(BUILDTYPE)/test.jar $(MBGL_ANDROID_LOCAL_WORK_DIR) > /dev/null 2>&1
+ adb push test/fixtures $(MBGL_ANDROID_LOCAL_WORK_DIR)/test > /dev/null 2>&1
+ adb push build/android-$1/$(BUILDTYPE)/stripped/libmapbox-gl.so $(MBGL_ANDROID_LOCAL_WORK_DIR) > /dev/null 2>&1
+ adb push build/android-$1/$(BUILDTYPE)/stripped/libmbgl-test.so $(MBGL_ANDROID_LOCAL_WORK_DIR) > /dev/null 2>&1
+
+ #Kick off the tests
+ adb shell "export LD_LIBRARY_PATH=/system/lib:$(MBGL_ANDROID_LOCAL_WORK_DIR) && cd $(MBGL_ANDROID_LOCAL_WORK_DIR) && dalvikvm32 -cp $(MBGL_ANDROID_LOCAL_WORK_DIR)/test.jar Main"
+
+ #Gather the results
+ adb shell "cd $(MBGL_ANDROID_LOCAL_WORK_DIR) && tar -cvzf results.tgz test/fixtures/* > /dev/null 2>&1"
+ adb pull $(MBGL_ANDROID_LOCAL_WORK_DIR)/results.tgz build/android-$1/$(BUILDTYPE)/ > /dev/null 2>&1
+
.PHONY: run-android-$1
run-android-$1: android-$1
cd platform/android && ./gradlew :MapboxGLAndroidSDKTestApp:installDebug && adb shell am start -n com.mapbox.mapboxsdk.testapp/.activity.FeatureOverviewActivity
@@ -505,7 +541,7 @@ run-android-$1: android-$1
apackage: android-lib-$1
endef
-$(foreach abi,$(ANDROID_ABIS),$(eval $(call ANDROID_RULES,$(abi))))
+$(foreach abi,$(MBGL_ANDROID_ABIS),$(eval $(call ANDROID_RULES,$(abi))))
.PHONY: android
android: android-arm-v7
diff --git a/platform/android/config.cmake b/platform/android/config.cmake
index 9156054de0..3ab695e7e1 100644
--- a/platform/android/config.cmake
+++ b/platform/android/config.cmake
@@ -1,5 +1,7 @@
add_definitions(-DMBGL_USE_GLES2=1)
+include(cmake/test-files.cmake)
+
#Include to use build specific variables
include(${CMAKE_CURRENT_BINARY_DIR}/toolchain.cmake)
@@ -15,6 +17,9 @@ mason_use(libpng VERSION 1.6.25)
mason_use(libzip VERSION 1.1.3)
mason_use(nunicode VERSION 1.7.1)
mason_use(sqlite VERSION 3.14.2)
+mason_use(gtest VERSION 1.7.0)
+
+## mbgl core ##
macro(mbgl_platform_core)
@@ -52,12 +57,72 @@ macro(mbgl_platform_core)
PRIVATE platform/default/png_reader.cpp
PRIVATE platform/default/jpeg_reader.cpp
- # Headless view
- # TODO
-
# Thread pool
PRIVATE platform/default/mbgl/util/default_thread_pool.cpp
- PRIVATE platform/default/mbgl/util/default_thread_pool.cpp
+ PRIVATE platform/default/mbgl/util/default_thread_pool.hpp
+
+ # Conversion C++ -> Java
+ platform/android/src/conversion/constant.hpp
+ platform/android/src/conversion/conversion.hpp
+ platform/android/src/style/conversion/function.hpp
+ platform/android/src/style/conversion/property_value.hpp
+ platform/android/src/style/conversion/types.hpp
+ platform/android/src/style/conversion/types_string_values.hpp
+
+ # Style conversion Java -> C++
+ platform/android/src/style/android_conversion.hpp
+ platform/android/src/style/conversion/geojson.hpp
+ platform/android/src/style/value.cpp
+ platform/android/src/style/value.hpp
+ platform/android/src/style/conversion/url_or_tileset.hpp
+
+ # Style
+ platform/android/src/style/layers/background_layer.cpp
+ platform/android/src/style/layers/background_layer.hpp
+ platform/android/src/style/layers/circle_layer.cpp
+ platform/android/src/style/layers/circle_layer.hpp
+ platform/android/src/style/layers/custom_layer.cpp
+ platform/android/src/style/layers/custom_layer.hpp
+ platform/android/src/style/layers/fill_layer.cpp
+ platform/android/src/style/layers/fill_layer.hpp
+ platform/android/src/style/layers/layer.cpp
+ platform/android/src/style/layers/layer.hpp
+ platform/android/src/style/layers/layers.cpp
+ platform/android/src/style/layers/layers.hpp
+ platform/android/src/style/layers/line_layer.cpp
+ platform/android/src/style/layers/line_layer.hpp
+ platform/android/src/style/layers/raster_layer.cpp
+ platform/android/src/style/layers/raster_layer.hpp
+ platform/android/src/style/layers/symbol_layer.cpp
+ platform/android/src/style/layers/symbol_layer.hpp
+ platform/android/src/style/sources/geojson_source.cpp
+ platform/android/src/style/sources/geojson_source.hpp
+ platform/android/src/style/sources/source.cpp
+ platform/android/src/style/sources/source.hpp
+ platform/android/src/style/sources/sources.cpp
+ platform/android/src/style/sources/sources.hpp
+ platform/android/src/style/sources/raster_source.cpp
+ platform/android/src/style/sources/raster_source.hpp
+ platform/android/src/style/sources/vector_source.cpp
+ platform/android/src/style/sources/vector_source.hpp
+
+ # Connectivity
+ platform/android/src/connectivity_listener.cpp
+ platform/android/src/connectivity_listener.hpp
+
+ # Native map
+ platform/android/src/native_map_view.cpp
+ platform/android/src/native_map_view.hpp
+
+ # Main jni bindings
+ platform/android/src/attach_env.cpp
+ platform/android/src/attach_env.hpp
+ platform/android/src/java_types.cpp
+ platform/android/src/java_types.hpp
+
+ # Main entry point
+ platform/android/src/jni.hpp
+ platform/android/src/jni.cpp
)
target_include_directories(mbgl-core
@@ -71,6 +136,7 @@ macro(mbgl_platform_core)
target_add_mason_package(mbgl-core PUBLIC libzip)
target_add_mason_package(mbgl-core PUBLIC geojson)
target_add_mason_package(mbgl-core PUBLIC jni.hpp)
+ target_add_mason_package(mbgl-core PUBLIC rapidjson)
target_compile_options(mbgl-core
PRIVATE -fvisibility=hidden
@@ -91,71 +157,12 @@ macro(mbgl_platform_core)
)
endmacro()
+## Main library ##
+
add_library(mapbox-gl SHARED
- # Conversion C++ -> Java
- platform/android/src/conversion/constant.hpp
- platform/android/src/conversion/conversion.hpp
- platform/android/src/style/conversion/function.hpp
- platform/android/src/style/conversion/property_value.hpp
- platform/android/src/style/conversion/types.hpp
- platform/android/src/style/conversion/types_string_values.hpp
-
- # Style conversion Java -> C++
- platform/android/src/style/android_conversion.hpp
- platform/android/src/style/conversion/geojson.hpp
- platform/android/src/style/value.cpp
- platform/android/src/style/value.hpp
- platform/android/src/style/conversion/url_or_tileset.hpp
-
- # Style
- platform/android/src/style/layers/background_layer.cpp
- platform/android/src/style/layers/background_layer.hpp
- platform/android/src/style/layers/circle_layer.cpp
- platform/android/src/style/layers/circle_layer.hpp
- platform/android/src/style/layers/custom_layer.cpp
- platform/android/src/style/layers/custom_layer.hpp
- platform/android/src/style/layers/fill_layer.cpp
- platform/android/src/style/layers/fill_layer.hpp
- platform/android/src/style/layers/layer.cpp
- platform/android/src/style/layers/layer.hpp
- platform/android/src/style/layers/layers.cpp
- platform/android/src/style/layers/layers.hpp
- platform/android/src/style/layers/line_layer.cpp
- platform/android/src/style/layers/line_layer.hpp
- platform/android/src/style/layers/raster_layer.cpp
- platform/android/src/style/layers/raster_layer.hpp
- platform/android/src/style/layers/symbol_layer.cpp
- platform/android/src/style/layers/symbol_layer.hpp
- platform/android/src/style/sources/geojson_source.cpp
- platform/android/src/style/sources/geojson_source.hpp
- platform/android/src/style/sources/source.cpp
- platform/android/src/style/sources/source.hpp
- platform/android/src/style/sources/sources.cpp
- platform/android/src/style/sources/sources.hpp
- platform/android/src/style/sources/raster_source.cpp
- platform/android/src/style/sources/raster_source.hpp
- platform/android/src/style/sources/vector_source.cpp
- platform/android/src/style/sources/vector_source.hpp
-
- # Native map
- platform/android/src/native_map_view.cpp
- platform/android/src/native_map_view.hpp
-
- # Connectivity
- platform/android/src/connectivity_listener.cpp
- platform/android/src/connectivity_listener.hpp
-
- # Main jni bindings
- platform/android/src/jni.cpp
- platform/android/src/jni.hpp
- platform/android/src/attach_env.cpp
- platform/android/src/attach_env.hpp
- platform/android/src/java_types.cpp
- platform/android/src/java_types.hpp
+ platform/android/src/main.cpp
)
-target_add_mason_package(mapbox-gl PUBLIC rapidjson)
-
target_compile_options(mapbox-gl
PRIVATE -fvisibility=hidden
PRIVATE -ffunction-sections
@@ -168,6 +175,62 @@ target_link_libraries(mapbox-gl
PUBLIC -Wl,--gc-sections
)
+## Test library ##
+
+add_library(mbgl-test SHARED
+ # Actual tests
+ ${MBGL_TEST_FILES}
+
+ # Main test entry point
+ platform/android/src/test/main.jni.cpp
+
+)
+
+target_sources(mbgl-test
+ # Headless view
+ PRIVATE platform/default/mbgl/gl/headless_backend.cpp
+ PRIVATE platform/default/mbgl/gl/headless_backend.hpp
+ PRIVATE platform/default/mbgl/gl/offscreen_view.cpp
+ PRIVATE platform/default/mbgl/gl/offscreen_view.hpp
+
+ PRIVATE platform/linux/src/headless_backend_egl.cpp
+ PRIVATE platform/linux/src/headless_display_egl.cpp
+)
+
+target_compile_options(mbgl-test
+ PRIVATE -fvisibility=hidden
+ PRIVATE -Os
+)
+
+target_compile_definitions(mbgl-test
+ PRIVATE MBGL_ASSET_ZIP=1
+)
+
+target_include_directories(mbgl-test
+ PRIVATE include
+ PRIVATE src # TODO: eliminate
+ PRIVATE test/include
+ PRIVATE test/src
+ PRIVATE platform/default
+ PRIVATE ${MBGL_GENERATED}/include
+)
+
+target_link_libraries(mbgl-test
+ PRIVATE mbgl-core
+)
+
+target_add_mason_package(mbgl-test PRIVATE geometry)
+target_add_mason_package(mbgl-test PRIVATE variant)
+target_add_mason_package(mbgl-test PRIVATE unique_resource)
+target_add_mason_package(mbgl-test PRIVATE rapidjson)
+target_add_mason_package(mbgl-test PRIVATE gtest)
+target_add_mason_package(mbgl-test PRIVATE pixelmatch)
+target_add_mason_package(mbgl-test PRIVATE boost)
+target_add_mason_package(mbgl-test PRIVATE geojson)
+target_add_mason_package(mbgl-test PRIVATE geojsonvt)
+
+## Custom layer example ##
+
add_library(example-custom-layer SHARED
platform/android/src/example_custom_layer.cpp
)
@@ -184,6 +247,8 @@ target_link_libraries(example-custom-layer
PUBLIC -Wl,--gc-sections
)
+## Strip and copy ##
+
set(ANDROID_SDK_PROJECT_DIR ${CMAKE_SOURCE_DIR}/platform/android/MapboxGLAndroidSDK)
set(ANDROID_JNI_TARGET_DIR ${ANDROID_SDK_PROJECT_DIR}/src/main/jniLibs/${ANDROID_JNIDIR}/)
set(ANDROID_ASSETS_TARGET_DIR ${ANDROID_SDK_PROJECT_DIR}/src/main/assets/)
@@ -203,8 +268,17 @@ add_custom_target(copy-files
COMMAND ${STRIP_COMMAND} $<TARGET_FILE:example-custom-layer> -o ${ANDROID_TEST_APP_JNI_TARGET_DIR}$<TARGET_FILE_NAME:example-custom-layer>
)
+add_custom_target(mbgl-test-stripped
+ DEPENDS mapbox-gl
+ DEPENDS mbgl-test
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/stripped
+ COMMAND ${STRIP_COMMAND} $<TARGET_FILE:mapbox-gl> -o ${CMAKE_CURRENT_BINARY_DIR}/stripped/$<TARGET_FILE_NAME:mapbox-gl>
+ COMMAND ${STRIP_COMMAND} $<TARGET_FILE:mbgl-test> -o ${CMAKE_CURRENT_BINARY_DIR}/stripped/$<TARGET_FILE_NAME:mbgl-test>
+)
+
add_custom_target(_all ALL
DEPENDS mapbox-gl
+ DEPENDS mbgl-test
DEPENDS example-custom-layer
DEPENDS copy-files
)
diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp
index 0c740d7fdd..5471fb5508 100755
--- a/platform/android/src/jni.cpp
+++ b/platform/android/src/jni.cpp
@@ -1703,9 +1703,12 @@ void updateOfflineRegionMetadata(JNIEnv *env, jni::jobject* offlineRegion_, jni:
// Offline calls end
-}
+} // anonymous
-extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+namespace mbgl {
+namespace android {
+
+void registerNatives(JavaVM *vm) {
theJVM = vm;
jni::JNIEnv& env = jni::GetEnv(*vm, jni::jni_version_1_6);
@@ -1988,6 +1991,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
char release[PROP_VALUE_MAX] = "";
__system_property_get("ro.build.version.release", release);
androidRelease = std::string(release);
-
- return JNI_VERSION_1_6;
}
+
+} // android
+} // mbgl
diff --git a/platform/android/src/jni.hpp b/platform/android/src/jni.hpp
index 0810ee656d..90ec914cf2 100644
--- a/platform/android/src/jni.hpp
+++ b/platform/android/src/jni.hpp
@@ -23,6 +23,8 @@ extern jmethodID onSnapshotReadyId;
extern bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName);
extern void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach);
+
+extern void registerNatives(JavaVM* vm);
-}
-}
+} //android
+} //mbgl
diff --git a/platform/android/src/main.cpp b/platform/android/src/main.cpp
new file mode 100644
index 0000000000..03a8288719
--- /dev/null
+++ b/platform/android/src/main.cpp
@@ -0,0 +1,9 @@
+#include "jni.hpp"
+#include <jni/jni.hpp>
+
+extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *) {
+ assert(vm != nullptr);
+ mbgl::android::registerNatives(vm);
+ return JNI_VERSION_1_6;
+}
+
diff --git a/platform/android/src/test/Main.java b/platform/android/src/test/Main.java
new file mode 100644
index 0000000000..2abcf2bfdb
--- /dev/null
+++ b/platform/android/src/test/Main.java
@@ -0,0 +1,15 @@
+
+public class Main {
+ public native void runAllTests();
+
+ public static void main(String[] args) throws Exception {
+ //Load the tests
+ System.loadLibrary("mbgl-test");
+
+ //Run the tests
+ new Main().runAllTests();
+
+ //Exit explicitly otherwise dalvikvm won't quit
+ System.exit(0);
+ }
+}
diff --git a/platform/android/src/test/main.jni.cpp b/platform/android/src/test/main.jni.cpp
new file mode 100644
index 0000000000..d37b908202
--- /dev/null
+++ b/platform/android/src/test/main.jni.cpp
@@ -0,0 +1,76 @@
+#include "../jni.hpp"
+
+#include <android/log.h>
+#include <jni/jni.hpp>
+
+#include <mbgl/util/logging.hpp>
+#include <mbgl/test.hpp>
+
+#pragma clang diagnostic ignored "-Wunused-parameter"
+
+#define MAKE_NATIVE_METHOD(name, sig) jni::MakeNativeMethod<decltype(name), name>( #name, sig )
+
+namespace {
+
+/**
+ * JNI Bound to Main#runAllTests()
+ */
+void runAllTests(JNIEnv *env, jni::jobject* obj) {
+ mbgl::Log::Info(mbgl::Event::JNI, "Starting tests");
+ mbgl::runTests(0, nullptr);
+}
+
+}
+
+// JNI Bindings to stub the android.util.Log implementation
+
+static jboolean isLoggable(JNIEnv* env, jni::jobject* clazz, jni::jstring* tag, jint level) {
+ return true;
+}
+
+static jint println_native(JNIEnv* env, jni::jobject* clazz, jint bufID, jint priority, jni::jstring* jtag, jni::jstring* jmessage) {
+ if (jtag == nullptr || jmessage == nullptr) {
+ return false;
+ }
+
+ std::string tag = jni::Make<std::string>(*env, jni::String(jtag));
+ std::string message = jni::Make<std::string>(*env, jni::String(jmessage));
+
+ return __android_log_print(priority, tag.c_str(), "%s", message.c_str());
+}
+
+static jint logger_entry_max_payload_native(JNIEnv* env, jni::jobject* clazz) {
+ return static_cast<jint>(4068);
+}
+
+
+// Main entry point
+
+extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
+ //Load the main library jni bindings
+ mbgl::Log::Info(mbgl::Event::JNI, "Registering main JNI Methods");
+ mbgl::android::registerNatives(vm);
+
+ //Load the test library jni bindings
+ mbgl::Log::Info(mbgl::Event::JNI, "Registering test JNI Methods");
+
+ jni::JNIEnv& env = jni::GetEnv(*vm, jni::jni_version_1_6);
+
+ //Main class (entry point for tests from dalvikvm)
+ struct Main { static constexpr auto Name() { return "Main"; } };
+ jni::RegisterNatives(env, jni::Class<Main>::Find(env), MAKE_NATIVE_METHOD(runAllTests, "()V"));
+
+ //Bindings for system classes
+ struct Log { static constexpr auto Name() { return "android/util/Log"; } };
+ try {
+ jni::RegisterNatives(env, jni::Class<Log>::Find(env),
+ MAKE_NATIVE_METHOD(isLoggable, "(Ljava/lang/String;I)Z"),
+ MAKE_NATIVE_METHOD(logger_entry_max_payload_native, "()I"),
+ MAKE_NATIVE_METHOD(println_native, "(IILjava/lang/String;Ljava/lang/String;)I")
+ );
+ } catch (jni::PendingJavaException ex) {
+ env.ThrowNew(jni::JavaErrorClass(env), "Could not register Log mocks");
+ }
+
+ return JNI_VERSION_1_6;
+}
diff --git a/test/fixtures/annotations/assets.zip b/test/fixtures/annotations/assets.zip
deleted file mode 100644
index 869380034f..0000000000
--- a/test/fixtures/annotations/assets.zip
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/api/assets.zip b/test/fixtures/api/assets.zip
deleted file mode 100644
index fe00443f61..0000000000
--- a/test/fixtures/api/assets.zip
+++ /dev/null
Binary files differ
diff --git a/test/fixtures/storage/assets.zip b/test/fixtures/storage/assets.zip
deleted file mode 100644
index 4006ee10f2..0000000000
--- a/test/fixtures/storage/assets.zip
+++ /dev/null
Binary files differ
diff --git a/test/map/transform.test.cpp b/test/map/transform.test.cpp
index 0cd92bfc2f..7f3a5e0556 100644
--- a/test/map/transform.test.cpp
+++ b/test/map/transform.test.cpp
@@ -109,7 +109,13 @@ TEST(Transform, IntegerZoom) {
auto checkIntegerZoom = [&transform](uint8_t zoomInt, double zoom) {
double scale = transform.getState().zoomScale(zoom);
transform.setScale(scale);
+#if __ANDROID__
+ // Android uses log(x) / M_LN2 instead of log2(x) because the latter
+ // is _broken in ARMv5 - that approach being less precise than log2(x).
+ ASSERT_NEAR(transform.getScale(), scale, 0.0001);
+#else
ASSERT_DOUBLE_EQ(transform.getScale(), scale);
+#endif
ASSERT_NEAR(transform.getZoom(), zoom, 0.0001);
ASSERT_EQ(transform.getState().getIntegerZoom(), zoomInt);
ASSERT_NEAR(transform.getState().getZoomFraction(), zoom - zoomInt, 0.0001);
diff --git a/test/src/mbgl/test/util.hpp b/test/src/mbgl/test/util.hpp
index 8445822699..34d8969d3c 100644
--- a/test/src/mbgl/test/util.hpp
+++ b/test/src/mbgl/test/util.hpp
@@ -4,7 +4,10 @@
#include <TargetConditionals.h>
#endif
-#if TARGET_OS_IOS
+#if __ANDROID__
+#define TEST_READ_ONLY 0
+#define TEST_HAS_SERVER 0
+#elif TARGET_OS_IOS
#define TEST_READ_ONLY 1
#define TEST_HAS_SERVER 0
#else
diff --git a/test/storage/asset_file_source.test.cpp b/test/storage/asset_file_source.test.cpp
index b275cfc05a..7e634fc68e 100644
--- a/test/storage/asset_file_source.test.cpp
+++ b/test/storage/asset_file_source.test.cpp
@@ -27,7 +27,7 @@ TEST(AssetFileSource, Load) {
AssetFileSource fs(getFileSourceRoot());
// iOS seems to run out of file descriptors...
-#if TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE || __ANDROID__
unsigned numThreads = 30;
#else
unsigned numThreads = 50;