mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-08 12:18:30 +09:00
[Feat] (trace-replay): test retrace APK on Android
This commit is contained in:
@@ -26,6 +26,7 @@ Intent extras:
|
||||
trace_path absolute path to the apitrace file
|
||||
golden_path optional absolute path to a golden PNG
|
||||
output_dir directory for result.json and actual.png
|
||||
diff_path optional absolute path for a golden-difference PNG
|
||||
backend DirectGLES or DirectVulkan; defaults to the backend flavor
|
||||
target_frame target frame index, or -1
|
||||
target_call target call number, or -1
|
||||
@@ -61,6 +62,7 @@ adb shell am start -a top.mobilegl.plugin.TRACE_REPLAY \
|
||||
--es trace_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/input/app.trace \
|
||||
--es golden_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/input/app.golden.png \
|
||||
--es output_dir /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/output \
|
||||
--es diff_path /data/user/0/top.mobilegl.plugin.espryt.trace/files/trace-replay/output/app-diff.png \
|
||||
--es backend DirectGLES \
|
||||
--el target_call 31249 \
|
||||
--ei tolerance 0 \
|
||||
|
||||
@@ -17,6 +17,12 @@ def releaseSigningReady = signingStoreFile.exists()
|
||||
&& signingStorePassword
|
||||
&& signingKeyAlias
|
||||
&& signingKeyPassword
|
||||
def mobileGlAbiFilters = {
|
||||
((findProperty('mobilegl.abis') ?: System.getenv('MOBILEGL_ABIS') ?: 'arm64-v8a') as String)
|
||||
.split(',')
|
||||
.collect { it.trim() }
|
||||
.findAll { !it.isEmpty() }
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'top.mobilegl.plugin'
|
||||
@@ -30,7 +36,7 @@ android {
|
||||
versionName 'dev'
|
||||
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a'
|
||||
abiFilters(*mobileGlAbiFilters())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.22.1)
|
||||
|
||||
project(trace_replay_runner)
|
||||
|
||||
set(APITRACE_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../third_party/apitrace")
|
||||
set(APITRACE_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../../3rdparty/apitrace")
|
||||
set(APITRACE_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/apitrace")
|
||||
set(APITRACE_VERSION "mobilegl-trace")
|
||||
|
||||
|
||||
@@ -28,18 +28,21 @@ jobject MakeResult(JNIEnv* env, const mobilegl_trace::Result& result) {
|
||||
if (clazz == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
jmethodID ctor = env->GetMethodID(clazz, "<init>", "(ZILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
jmethodID ctor = env->GetMethodID(clazz, "<init>",
|
||||
"(ZILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
|
||||
if (ctor == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
jstring message = env->NewStringUTF(result.message.c_str());
|
||||
jstring resultPath = env->NewStringUTF(result.resultPath.c_str());
|
||||
jstring actualPath = env->NewStringUTF(result.actualPath.c_str());
|
||||
jstring diffPath = env->NewStringUTF(result.diffPath.c_str());
|
||||
jobject object = env->NewObject(clazz, ctor, result.passed ? JNI_TRUE : JNI_FALSE, result.statusCode, message,
|
||||
resultPath, actualPath);
|
||||
resultPath, actualPath, diffPath);
|
||||
env->DeleteLocalRef(message);
|
||||
env->DeleteLocalRef(resultPath);
|
||||
env->DeleteLocalRef(actualPath);
|
||||
env->DeleteLocalRef(diffPath);
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -52,6 +55,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
|
||||
jstring tracePath,
|
||||
jstring goldenPath,
|
||||
jstring outputDir,
|
||||
jstring diffPath,
|
||||
jstring backend,
|
||||
jint targetFrame,
|
||||
jlong targetCall,
|
||||
@@ -67,6 +71,7 @@ Java_top_mobilegl_plugin_trace_TraceReplayActivity_nativeRunTraceReplay(JNIEnv*
|
||||
request.tracePath = ToString(env, tracePath);
|
||||
request.goldenPath = ToString(env, goldenPath);
|
||||
request.outputDir = ToString(env, outputDir);
|
||||
request.diffPath = ToString(env, diffPath);
|
||||
request.backend = ToString(env, backend);
|
||||
request.targetFrame = targetFrame;
|
||||
request.targetCall = targetCall;
|
||||
|
||||
+12
-1
@@ -98,6 +98,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
request.tracePath,
|
||||
request.goldenPath,
|
||||
request.outputDir,
|
||||
request.diffPath,
|
||||
request.backend,
|
||||
request.targetFrame,
|
||||
request.targetCall,
|
||||
@@ -123,6 +124,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
String tracePath,
|
||||
String goldenPath,
|
||||
String outputDir,
|
||||
String diffPath,
|
||||
String backend,
|
||||
int targetFrame,
|
||||
long targetCall,
|
||||
@@ -140,6 +142,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
final String tracePath;
|
||||
final String goldenPath;
|
||||
final String outputDir;
|
||||
final String diffPath;
|
||||
final String backend;
|
||||
final int targetFrame;
|
||||
final long targetCall;
|
||||
@@ -156,6 +159,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
String tracePath,
|
||||
String goldenPath,
|
||||
String outputDir,
|
||||
String diffPath,
|
||||
String backend,
|
||||
int targetFrame,
|
||||
long targetCall,
|
||||
@@ -171,6 +175,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
this.tracePath = tracePath;
|
||||
this.goldenPath = goldenPath;
|
||||
this.outputDir = outputDir;
|
||||
this.diffPath = diffPath;
|
||||
this.backend = backend;
|
||||
this.targetFrame = targetFrame;
|
||||
this.targetCall = targetCall;
|
||||
@@ -186,10 +191,12 @@ public final class TraceReplayActivity extends Activity {
|
||||
|
||||
static TraceReplayRequest from(Intent intent, File filesDir, String defaultBackend) {
|
||||
String outputDir = readString(intent, "output_dir", new File(filesDir, "trace-replay").getAbsolutePath());
|
||||
String diffPath = readString(intent, "diff_path", "");
|
||||
return new TraceReplayRequest(
|
||||
readString(intent, "trace_path", ""),
|
||||
readString(intent, "golden_path", ""),
|
||||
outputDir,
|
||||
diffPath,
|
||||
readString(intent, "backend", defaultBackend),
|
||||
intent.getIntExtra("target_frame", -1),
|
||||
intent.getLongExtra("target_call", -1L),
|
||||
@@ -216,19 +223,22 @@ public final class TraceReplayActivity extends Activity {
|
||||
public final String message;
|
||||
public final String resultPath;
|
||||
public final String actualPath;
|
||||
public final String diffPath;
|
||||
|
||||
public TraceReplayResult(
|
||||
boolean passed,
|
||||
int statusCode,
|
||||
String message,
|
||||
String resultPath,
|
||||
String actualPath
|
||||
String actualPath,
|
||||
String diffPath
|
||||
) {
|
||||
this.passed = passed;
|
||||
this.statusCode = statusCode;
|
||||
this.message = message;
|
||||
this.resultPath = resultPath;
|
||||
this.actualPath = actualPath;
|
||||
this.diffPath = diffPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -239,6 +249,7 @@ public final class TraceReplayActivity extends Activity {
|
||||
", message='" + message + '\'' +
|
||||
", resultPath='" + resultPath + '\'' +
|
||||
", actualPath='" + actualPath + '\'' +
|
||||
", diffPath='" + diffPath + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,19 @@ plugins {
|
||||
id 'com.android.library' version '8.6.0' apply false
|
||||
}
|
||||
|
||||
def mobileGlAbiFilters = {
|
||||
((rootProject.findProperty('mobilegl.abis') ?: System.getenv('MOBILEGL_ABIS') ?: 'arm64-v8a') as String)
|
||||
.split(',')
|
||||
.collect { it.trim() }
|
||||
.findAll { !it.isEmpty() }
|
||||
}
|
||||
|
||||
subprojects { subproject ->
|
||||
subproject.plugins.withId('com.android.library') {
|
||||
subproject.android {
|
||||
defaultConfig {
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a'
|
||||
abiFilters(*mobileGlAbiFilters())
|
||||
}
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
|
||||
Vendored
-1
Submodule android-plugin/third_party/apitrace deleted from 055c4573af
Reference in New Issue
Block a user