Fix benchmark tests.

This commit is contained in:
Cody Henthorne
2026-02-10 10:35:54 -05:00
committed by Greyson Parrelli
parent c565db812e
commit 09c07f0707
12 changed files with 211 additions and 27 deletions
@@ -1,8 +1,6 @@
@file:OptIn(ExperimentalBaselineProfilesApi::class)
package org.thoughtcrime.benchmark
import androidx.benchmark.macro.ExperimentalBaselineProfilesApi
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.uiautomator.By
import androidx.test.uiautomator.Until
@@ -16,7 +14,7 @@ import org.junit.Test
* - start the app
* - open a conversation
*/
@OptIn(ExperimentalBaselineProfilesApi::class)
@RequiresApi(28)
class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()
@@ -24,7 +22,7 @@ class BaselineProfileGenerator {
@Test
fun startup() {
var setup = false
baselineProfileRule.collectBaselineProfile(
baselineProfileRule.collect(
packageName = "org.thoughtcrime.securesms",
profileBlock = {
if (!setup) {
@@ -2,6 +2,7 @@ package org.thoughtcrime.benchmark
import android.Manifest
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.ExperimentalMetricApi
import androidx.benchmark.macro.TraceSectionMetric
@@ -14,6 +15,7 @@ import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
@RequiresApi(31)
class ConversationBenchmarks {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()
@@ -1,5 +1,6 @@
package org.thoughtcrime.benchmark
import androidx.annotation.RequiresApi
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.ExperimentalMetricApi
import androidx.benchmark.macro.StartupMode
@@ -17,6 +18,7 @@ import org.junit.runner.RunWith
* WARNING! THIS WILL WIPE YOUR SIGNAL INSTALL
*/
@RunWith(AndroidJUnit4::class)
@RequiresApi(31)
class StartupBenchmarks {
@get:Rule
val benchmarkRule = MacrobenchmarkRule()