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

Commit bee820b9 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Clear the cache directory at the end of each test class

This should prevent `out of disk space` errors when running the same test thousands of times in a row

Test: atest FlickerTests
Flag: TEST_ONLY
Bug: 348153034
Change-Id: Id91213d51d8342fb68553e86af59d37ac3e45524
parent 1baceb4c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -20,8 +20,10 @@ import android.app.Instrumentation
import android.tools.flicker.junit.FlickerBuilderProvider
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.rules.ClearAppCacheRule
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation
import org.junit.ClassRule

abstract class BaseBenchmarkTest
@JvmOverloads
@@ -44,4 +46,8 @@ constructor(
            transition()
        }
    }

    companion object {
        @ClassRule @JvmField val clearCache = ClearAppCacheRule()
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.platform.test.annotations.Presubmit
import android.tools.flicker.junit.FlickerBuilderProvider
import android.tools.flicker.legacy.FlickerBuilder
import android.tools.flicker.legacy.LegacyFlickerTest
import android.tools.flicker.rules.ClearAppCacheRule
import android.tools.traces.executeShellCommand
import android.util.Log
import androidx.test.platform.app.InstrumentationRegistry
@@ -29,6 +30,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation
import com.android.wm.shell.Flags
import org.junit.Assume
import org.junit.AssumptionViolatedException
import org.junit.ClassRule
import org.junit.Test

/**
@@ -223,4 +225,8 @@ constructor(
            Log.e(logTag, "Assumption violation on CUJ complete", e)
        }
    }

    companion object {
        @ClassRule @JvmField val clearCache = ClearAppCacheRule()
    }
}