SkQP: fix broken JUnit tests & report output

Switches over to writing output to the sd card.

Change-Id: Ic287a741b9af471f823a7e97eb0c6d3d20f639d6
Reviewed-on: https://skia-review.googlesource.com/96380
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
This commit is contained in:
Hal Canary 2018-01-17 22:45:04 -05:00 committed by Skia Commit-Bot
parent a7f7ee96a7
commit 3af7f6e2ce

View File

@ -16,31 +16,40 @@ import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.Runner;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;
@RunWith(SkQPRunner.class)
public class SkQPRunner extends Runner {
private Description mDescription;
private SkQP impl;
private static final String TAG = SkQP.LOG_PREFIX;
private static void Fail(Description desc, RunNotifier notifier, String failure) {
notifier.fireTestFailure(new Failure(desc, new Throwable(failure)));
}
private static File GetOutputDir() {
Context c = InstrumentationRegistry.getTargetContext();
// File f = c.getFilesDir();
File f = c.getExternalFilesDir(null);
return new File(f, "output");
}
////////////////////////////////////////////////////////////////////////////
public SkQPRunner(Class testClass) {
impl = new SkQP();
Context context = InstrumentationRegistry.getTargetContext();
File filesDir = context.getFilesDir();
File filesDir = SkQPRunner.GetOutputDir();
try {
SkQP.ensureEmtpyDirectory(filesDir);
} catch (IOException e) {
Log.w("org.skis.skqp", "ensureEmtpyDirectory: " + e.getMessage());
Log.w(TAG, "ensureEmtpyDirectory: " + e.getMessage());
}
Log.i(TAG, "output path = " + filesDir.getAbsolutePath());
Resources resources = context.getResources();
Resources resources = InstrumentationRegistry.getTargetContext().getResources();
AssetManager mAssetManager = resources.getAssets();
impl.nInit(mAssetManager, filesDir.getAbsolutePath());