summaryrefslogtreecommitdiff
path: root/render-test
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 /render-test
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
Diffstat (limited to 'render-test')
-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
18 files changed, 388 insertions, 5 deletions
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) {