Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47fd3302 authored by Makoto Onuki's avatar Makoto Onuki Committed by Gerrit Code Review
Browse files

Merge "Make Ravenwood less verbose" into main

parents fc1fc9a8 ee09ecef
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase

        mTestClass = new TestClass(testClass);

        Log.v(TAG, "RavenwoodAwareTestRunner starting for " + testClass.getCanonicalName());
        Log.v(TAG, "RavenwoodAwareTestRunner initializing for " + testClass.getCanonicalName());

        // Hook point to allow more customization.
        runAnnotatedMethodsOnRavenwood(RavenwoodTestRunnerInitializing.class, null);
@@ -146,7 +146,9 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase

    private void runAnnotatedMethodsOnRavenwood(Class<? extends Annotation> annotationClass,
            Object instance) {
        if (RAVENWOOD_VERBOSE_LOGGING) {
            Log.v(TAG, "runAnnotatedMethodsOnRavenwood() " + annotationClass.getName());
        }

        for (var method : mTestClass.getAnnotatedMethods(annotationClass)) {
            ensureIsPublicVoidMethod(method.getMethod(), /* isStatic=*/ instance == null);
@@ -169,12 +171,14 @@ public final class RavenwoodAwareTestRunner extends RavenwoodAwareTestRunnerBase
        RavenwoodTestStats.getInstance().attachToRunNotifier(notifier);

        if (mRealRunner instanceof ClassSkippingTestRunner) {
            Log.i(TAG, "onClassSkipped: description=" + description);
            Log.v(TAG, "onClassSkipped: description=" + description);
            mRealRunner.run(notifier);
            return;
        }

        Log.v(TAG, "Starting " + mTestJavaClass.getCanonicalName());
        if (RAVENWOOD_VERBOSE_LOGGING) {
            Log.v(TAG, "Running " + mTestJavaClass.getCanonicalName());
        }
        if (RAVENWOOD_VERBOSE_LOGGING) {
            dumpDescription(description);
        }
+11 −3
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package android.platform.test.ravenwood;

import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -59,16 +61,22 @@ public final class RavenwoodRunnerState {
    private Description mMethodDescription;

    public void enterTestRunner() {
        Log.i(TAG, "enterTestRunner: " + mRunner);
        if (RAVENWOOD_VERBOSE_LOGGING) {
            Log.v(TAG, "enterTestRunner: " + mRunner);
        }
        RavenwoodRuntimeEnvironmentController.initForRunner();
    }

    public void enterTestClass() {
        Log.i(TAG, "enterTestClass: " + mRunner.mTestJavaClass.getName());
        if (RAVENWOOD_VERBOSE_LOGGING) {
            Log.v(TAG, "enterTestClass: " + mRunner.mTestJavaClass.getName());
        }
    }

    public void exitTestClass() {
        Log.i(TAG, "exitTestClass: " + mRunner.mTestJavaClass.getName());
        if (RAVENWOOD_VERBOSE_LOGGING) {
            Log.v(TAG, "exitTestClass: " + mRunner.mTestJavaClass.getName());
        }
        assertTrue(RAVENWOOD_RULE_ERROR, sActiveProperties.isEmpty());
        RavenwoodRuntimeEnvironmentController.exitTestClass();
    }
+2 −2
Original line number Diff line number Diff line
@@ -552,7 +552,7 @@ public class RavenwoodRuntimeEnvironmentController {
    }

    private static void dumpCommandLineArgs() {
        Log.i(TAG, "JVM arguments:");
        Log.v(TAG, "JVM arguments:");

        // Note, we use the wrapper in JUnit4, not the actual class (
        // java.lang.management.ManagementFactory), because we can't see the later at the build
@@ -561,7 +561,7 @@ public class RavenwoodRuntimeEnvironmentController {
        var args = ManagementFactory.getRuntimeMXBean().getInputArguments();

        for (var arg : args) {
            Log.i(TAG, "  " + arg);
            Log.v(TAG, "  " + arg);
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public class RavenwoodSystemProperties {
        var ravenwoodProps = readProperties(path + RAVENWOOD_BUILD_PROP);
        var deviceProps = readProperties(path + DEVICE_BUILD_PROP);

        Log.i(TAG, "Default system properties:");
        Log.v(TAG, "Default system properties:");
        ravenwoodProps.forEach((key, origValue) -> {
            final String value;

@@ -100,7 +100,7 @@ public class RavenwoodSystemProperties {
            } else {
                value = origValue;
            }
            Log.i(TAG, key + "=" + value);
            Log.v(TAG, key + "=" + value);
            sDefaultValues.put(key, value);
        });

+5 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package android.platform.test.ravenwood;

import static com.android.ravenwood.common.RavenwoodCommonUtils.RAVENWOOD_VERBOSE_LOGGING;

import android.platform.test.annotations.internal.InnerRunner;
import android.util.Log;

@@ -53,7 +55,9 @@ abstract class RavenwoodAwareTestRunnerBase extends Runner implements Filterable
        }

        try {
            Log.i(TAG, "Initializing the inner runner: " + runnerClass);
            if (RAVENWOOD_VERBOSE_LOGGING) {
                Log.v(TAG, "Initializing the inner runner: " + runnerClass);
            }
            try {
                return runnerClass.getConstructor(Class.class)
                        .newInstance(testClass.getJavaClass());
Loading