Remove GM support from Java portions of SkQP.
We no longer intend to run visual GMs from SkQP. Change-Id: Ib04958a3d445078d65b72e852afc69781873b93c Bug: skia:13031 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/520546 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
23cb294413
commit
9b70eeb4f8
@ -15,12 +15,9 @@ import android.content.res.AssetManager;
|
||||
*/
|
||||
public class SkQP {
|
||||
protected native void nInit(AssetManager assetManager, String dataDir);
|
||||
protected native long nExecuteGM(int gm, int backend) throws SkQPException;
|
||||
protected native String[] nExecuteUnitTest(int test);
|
||||
protected native void nMakeReport();
|
||||
|
||||
protected String[] mGMs;
|
||||
protected String[] mBackends;
|
||||
protected String[] mUnitTests;
|
||||
|
||||
protected static final String kSkiaGM = "skqp_";
|
||||
|
@ -34,35 +34,15 @@ public class SkQPActivity extends AppCompatActivity implements Runnable {
|
||||
Log.i(SkQP.LOG_PREFIX, "Output Dir: " + outputDirPath);
|
||||
File outputDir = new File(outputDirPath);
|
||||
try {
|
||||
SkQPActivity.ensureEmtpyDirectory(outputDir);
|
||||
SkQPActivity.ensureEmptyDirectory(outputDir);
|
||||
} catch (IOException e) {
|
||||
Log.e(SkQP.LOG_PREFIX, "ensureEmtpyDirectory:" + e.getMessage());
|
||||
Log.e(SkQP.LOG_PREFIX, "ensureEmptyDirectory:" + e.getMessage());
|
||||
}
|
||||
|
||||
// Note: nInit will initialize the mGMs, mBackends and mUnitTests fields.
|
||||
// Note: nInit will initialize the mUnitTests field.
|
||||
AssetManager assetManager = context.getResources().getAssets();
|
||||
impl.nInit(assetManager, outputDirPath);
|
||||
|
||||
for (int backend = 0; backend < impl.mBackends.length; backend++) {
|
||||
for (int gm = 0; gm < impl.mGMs.length; gm++) {
|
||||
String testName = SkQP.kSkiaGM + impl.mBackends[backend] + "_" + impl.mGMs[gm];
|
||||
long value = java.lang.Long.MAX_VALUE;
|
||||
String error = null;
|
||||
Log.i(SkQP.LOG_PREFIX, "Running: " + testName);
|
||||
try {
|
||||
value = impl.nExecuteGM(gm, backend);
|
||||
} catch (SkQPException exept) {
|
||||
error = exept.getMessage();
|
||||
}
|
||||
if (error != null) {
|
||||
Log.w(SkQP.LOG_PREFIX, "Error: " + testName + " " + error);
|
||||
} else if (value != 0) {
|
||||
Log.w(SkQP.LOG_PREFIX, String.format("Fail: %s %d", testName, value));
|
||||
} else {
|
||||
Log.i(SkQP.LOG_PREFIX, "Pass: " + testName);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int unitTest = 0; unitTest < impl.mUnitTests.length; unitTest++) {
|
||||
String testName = SkQP.kSkiaUnitTests + "_" + impl.mUnitTests[unitTest];
|
||||
Log.w(SkQP.LOG_PREFIX, "Running: " + testName);
|
||||
@ -78,11 +58,10 @@ public class SkQPActivity extends AppCompatActivity implements Runnable {
|
||||
Log.i(SkQP.LOG_PREFIX, "Finished running all tests.");
|
||||
impl.nMakeReport();
|
||||
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
private static void ensureEmtpyDirectory(File f) throws IOException {
|
||||
private static void ensureEmptyDirectory(File f) throws IOException {
|
||||
if (f.exists()) {
|
||||
SkQPActivity.delete(f);
|
||||
}
|
||||
|
@ -53,16 +53,10 @@ public class SkQPRunner extends Runner implements Filterable {
|
||||
AssetManager assetManager = context.getResources().getAssets();
|
||||
mImpl.nInit(assetManager, mOutputDirectory);
|
||||
|
||||
int totalCount = mImpl.mUnitTests.length + mImpl.mGMs.length * mImpl.mBackends.length;
|
||||
int totalCount = mImpl.mUnitTests.length;
|
||||
mTests = new Description[totalCount];
|
||||
mShouldSkipTest = new boolean[totalCount]; // = {false, false, ....};
|
||||
int index = 0;
|
||||
for (int backend = 0; backend < mImpl.mBackends.length; backend++) {
|
||||
for (int gm = 0; gm < mImpl.mGMs.length; gm++) {
|
||||
mTests[index++] = Description.createTestDescription(SkQPRunner.class,
|
||||
mImpl.mBackends[backend] + "_" + mImpl.mGMs[gm]);
|
||||
}
|
||||
}
|
||||
for (int unitTest = 0; unitTest < mImpl.mUnitTests.length; unitTest++) {
|
||||
mTests[index++] = Description.createTestDescription(SkQPRunner.class,
|
||||
"unitTest_" + mImpl.mUnitTests[unitTest]);
|
||||
@ -102,38 +96,6 @@ public class SkQPRunner extends Runner implements Filterable {
|
||||
public void run(RunNotifier notifier) {
|
||||
int testNumber = 0; // out of number of actually run tests.
|
||||
int testIndex = 0; // out of potential tests.
|
||||
for (int backend = 0; backend < mImpl.mBackends.length; backend++) {
|
||||
for (int gm = 0; gm < mImpl.mGMs.length; gm++, testIndex++) {
|
||||
Description desc = mTests[testIndex];
|
||||
String name = desc.getMethodName();
|
||||
if (mShouldSkipTest[testIndex]) {
|
||||
continue;
|
||||
}
|
||||
++testNumber;
|
||||
notifier.fireTestStarted(desc);
|
||||
long value = java.lang.Long.MAX_VALUE;
|
||||
String error = null;
|
||||
try {
|
||||
value = mImpl.nExecuteGM(gm, backend);
|
||||
} catch (SkQPException exept) {
|
||||
error = exept.getMessage();
|
||||
}
|
||||
String result = "pass";
|
||||
if (error != null) {
|
||||
SkQPRunner.Fail(desc, notifier, String.format("Exception: %s", error));
|
||||
Log.w(TAG, String.format("[ERROR] '%s': %s", name, error));
|
||||
result = "ERROR";
|
||||
} else if (value != 0) {
|
||||
SkQPRunner.Fail(desc, notifier, String.format(
|
||||
"Image mismatch: max channel diff = %d", value));
|
||||
Log.w(TAG, String.format("[FAIL] '%s': %d > 0", name, value));
|
||||
result = "FAIL";
|
||||
}
|
||||
notifier.fireTestFinished(desc);
|
||||
Log.i(TAG, String.format("Rendering Test '%s' complete (%d/%d). [%s]",
|
||||
name, testNumber, mShouldRunTestCount, result));
|
||||
}
|
||||
}
|
||||
for (int unitTest = 0; unitTest < mImpl.mUnitTests.length; unitTest++, testIndex++) {
|
||||
Description desc = mTests[testIndex];
|
||||
String name = desc.getMethodName();
|
||||
|
@ -21,7 +21,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" {
|
||||
JNIEXPORT void JNICALL Java_org_skia_skqp_SkQP_nInit(JNIEnv*, jobject, jobject, jstring);
|
||||
JNIEXPORT jlong JNICALL Java_org_skia_skqp_SkQP_nExecuteGM(JNIEnv*, jobject, jint, jint);
|
||||
JNIEXPORT jobjectArray JNICALL Java_org_skia_skqp_SkQP_nExecuteUnitTest(JNIEnv*, jobject, jint);
|
||||
JNIEXPORT void JNICALL Java_org_skia_skqp_SkQP_nMakeReport(JNIEnv*, jobject);
|
||||
} // extern "C"
|
||||
@ -116,24 +115,11 @@ void Java_org_skia_skqp_SkQP_nInit(JNIEnv* env, jobject object, jobject assetMan
|
||||
std::lock_guard<std::mutex> lock(gMutex);
|
||||
gSkQP.init(&gAndroidAssetManager, reportDirectory.c_str());
|
||||
|
||||
auto backends = gSkQP.getSupportedBackends();
|
||||
jassert(env, backends.size() > 0,);
|
||||
const std::vector<SkQP::UnitTest>& unitTests = gSkQP.getUnitTests();
|
||||
|
||||
constexpr char kStringArrayType[] = "[Ljava/lang/String;";
|
||||
env->SetObjectField(object, env->GetFieldID(SkQP_class, "mBackends", kStringArrayType),
|
||||
to_java_string_array(env, backends, SkQP::GetBackendName));
|
||||
env->SetObjectField(object, env->GetFieldID(SkQP_class, "mUnitTests", kStringArrayType),
|
||||
to_java_string_array(env, unitTests, SkQP::GetUnitTestName));
|
||||
env->SetObjectField(object, env->GetFieldID(SkQP_class, "mGMs", kStringArrayType),
|
||||
make_java_string_array(env, 0));
|
||||
}
|
||||
|
||||
jlong Java_org_skia_skqp_SkQP_nExecuteGM(JNIEnv* env,
|
||||
jobject object,
|
||||
jint gmIndex,
|
||||
jint backendIndex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
jobjectArray Java_org_skia_skqp_SkQP_nExecuteUnitTest(JNIEnv* env,
|
||||
|
@ -175,15 +175,6 @@ TestHarness CurrentTestHarness() {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
const char* SkQP::GetBackendName(SkQP::SkiaBackend b) {
|
||||
switch (b) {
|
||||
case SkQP::SkiaBackend::kGL: return "gl";
|
||||
case SkQP::SkiaBackend::kGLES: return "gles";
|
||||
case SkQP::SkiaBackend::kVulkan: return "vk";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* SkQP::GetUnitTestName(SkQP::UnitTest t) { return t->fName; }
|
||||
|
||||
SkQP::SkQP() {}
|
||||
|
@ -50,7 +50,6 @@ public:
|
||||
|
||||
/** These functions provide a descriptive name for the given value.*/
|
||||
static const char* GetUnitTestName(UnitTest);
|
||||
static const char* GetBackendName(SkiaBackend);
|
||||
|
||||
SkQP();
|
||||
~SkQP();
|
||||
@ -70,8 +69,6 @@ public:
|
||||
report directory. */
|
||||
void makeReport();
|
||||
|
||||
/** @return a list of backends that this version of SkQP supports. */
|
||||
const std::vector<SkiaBackend>& getSupportedBackends() const { return fSupportedBackends; }
|
||||
/** @return a list of all Skia GPU unit tests in lexicographic order. */
|
||||
const std::vector<UnitTest>& getUnitTests() const { return fUnitTests; }
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user