[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
This commit is contained in:
Binary file not shown.
@@ -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)
|
||||
|
||||
@@ -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
|
||||
@@ -243,14 +232,44 @@ target_link_libraries(
|
||||
z
|
||||
)
|
||||
|
||||
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>)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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(
|
||||
|
||||
40
platform/android/src/test/render_test_collator.cpp
Normal file
40
platform/android/src/test/render_test_collator.cpp
Normal file
@@ -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
|
||||
15
platform/android/src/test/render_test_number_format.cpp
Normal file
15
platform/android/src/test/render_test_number_format.cpp
Normal file
@@ -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
|
||||
57
platform/android/src/test/render_test_runner.cpp
Normal file
57
platform/android/src/test/render_test_runner.cpp
Normal file
@@ -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();
|
||||
}
|
||||
9
render-test/android/README.md
Normal file
9
render-test/android/README.md
Normal file
@@ -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.
|
||||
29
render-test/android/app/build.gradle
Normal file
29
render-test/android/app/build.gradle
Normal file
@@ -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'
|
||||
}
|
||||
26
render-test/android/app/src/main/AndroidManifest.xml
Normal file
26
render-test/android/app/src/main/AndroidManifest.xml
Normal file
@@ -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>
|
||||
BIN
render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
render-test/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
render-test/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
4
render-test/android/app/src/main/res/values/strings.xml
Normal file
4
render-test/android/app/src/main/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">RenderTestRunner</string>
|
||||
</resources>
|
||||
16
render-test/android/build.gradle
Normal file
16
render-test/android/build.gradle
Normal file
@@ -0,0 +1,16 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.5.1'
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
1
render-test/android/gradle.properties
Normal file
1
render-test/android/gradle.properties
Normal file
@@ -0,0 +1 @@
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
BIN
render-test/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
render-test/android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
render-test/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
render-test/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -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
|
||||
164
render-test/android/gradlew
vendored
Executable file
164
render-test/android/gradlew
vendored
Executable file
@@ -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 "$@"
|
||||
90
render-test/android/gradlew.bat
vendored
Normal file
90
render-test/android/gradlew.bat
vendored
Normal file
@@ -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
|
||||
38
render-test/android/render_test_setup.sh
Executable file
38
render-test/android/render_test_setup.sh
Executable file
@@ -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/
|
||||
2
render-test/android/settings.gradle
Normal file
2
render-test/android/settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
||||
include ':app'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user