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

Commit 9b311b1c authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Android (Google) Code Review
Browse files

Merge "Fix broken tracinglib-robo-test tests" into main

parents adf303d7 2108b4a4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@

package com.android.test.tracing.coroutines

import android.os.Flags.FLAG_PERFETTO_SDK_TRACING_V2
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
import com.android.app.tracing.coroutines.createCoroutineTracingContext
import com.android.app.tracing.coroutines.launchTraced
@@ -31,6 +33,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import org.junit.Test

@DisableFlags(FLAG_PERFETTO_SDK_TRACING_V2)
@EnableFlags(FLAG_COROUTINE_TRACING)
class NestedCoroutineTracingTest : TestBase() {

+10 −9
Original line number Diff line number Diff line
@@ -67,12 +67,13 @@ class RunBlockingTracedTest : TestBase() {
        runTest(totalEvents = 2) {
            expect(1, "1^main")

            val result = runBlockingTraced {
            val result =
                runBlockingTraced(spanName = null, context = EmptyCoroutineContext) {
                    delay(1)
                    expect(
                        2,
                        "1^main",
                    "RunBlockingTracedTest\$runBlockingTracedWithDefaultSpanNameAndContext\$1\$invokeSuspend\$\$inlined\$runBlockingTraced\$default\$1",
                        "RunBlockingTracedTest\$runBlockingTracedWithDefaultSpanNameAndContext$1\$result$1",
                    )
                    true
                }
+15 −6
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import org.junit.ClassRule
import org.junit.Rule
import org.junit.runner.RunWith
import org.robolectric.annotation.Config
import org.robolectric.shadows.ShadowSystemProperties

class InvalidTraceStateException(message: String, cause: Throwable? = null) :
    AssertionError(message, cause)
@@ -64,7 +65,7 @@ internal val bgThread3 = newSingleThreadContext("test-bg-3")
internal val bgThread4 = newSingleThreadContext("test-bg-4")

@RunWith(AndroidJUnit4::class)
@Config(shadows = [ShadowTrace::class])
@Config(shadows = [ShadowTrace::class, ShadowSystemProperties::class])
abstract class TestBase {
    companion object {
        @JvmField
@@ -102,6 +103,14 @@ abstract class TestBase {

    @Before
    fun setup() {
        ShadowSystemProperties.reset()
        ShadowSystemProperties.override("persist.debug.coroutine_tracing", "true")
        ShadowSystemProperties.override("persist.debug.coroutine_tracing.walk_stack", "false")
        ShadowSystemProperties.override(
            "persist.debug.coroutine_tracing.count_continuations",
            "false",
        )

        FakeTraceState.isTracingEnabled = true
        FakeTraceState.clearAll()

+1 −1

File changed.

Contains only whitespace changes.