Skip to content
Snippets Groups Projects
  1. Feb 12, 2024
    • Makoto Onuki's avatar
      Adding test for loading JNI libraries in individual tests · be841ede
      Makoto Onuki authored
      Add a bivalent test that uses a native library.
      
      Also added a utility method to load it in the same way on both
      sides.
      
      Bug: 318393625
      Bug: 323931246
      
      Test: run-ravenwood-tests.sh
      Test: atest RavenwoodBivalentTest_device
      Change-Id: I270058c15f718ff20640681742035e33e5e015a1
      be841ede
    • Makoto Onuki's avatar
      Add @OnlyOnRavenwood · 8e4eb7ed
      Makoto Onuki authored
      Also add a bivalent test.
      
      Test: atest RavenwoodBivalentTest && atest RavenwoodBivalentTest_device
      Bug: 292141694
      Change-Id: I10f258e62e8a7f6a85fad5b39eda27c397e08f55
      8e4eb7ed
  2. Feb 10, 2024
    • Makoto Onuki's avatar
      Add tests for static mocking · eeaf655e
      Makoto Onuki authored
      Test: atest RavenwoodMockitoTest && atest RavenwoodMockitoTest_device
      Bug: 310268946
      Change-Id: I969847f757cbc21e553d7cb1157d5127301f9d10
      eeaf655e
  3. Feb 09, 2024
  4. Feb 08, 2024
    • Jeff Sharkey's avatar
      Baseline `StrictMode` on Ravenwood. · 7de862f4
      Jeff Sharkey authored
      We've uncovered several utilities that temporarily clear any
      read/write thread policies.  Instead of making them all side-step
      their StictMode interactions on Ravenwood, this change offers just
      enough of a baseline implementation to support them; it doesn't
      actually offer to detect anything.
      
      Bug: 318833612
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I5e406e24fcd5e83d108006ca6c7d08c0534297a9
      7de862f4
    • Jeff Sharkey's avatar
      Basic `ParcelFileDescriptor` on Ravenwood. · 6f218ec3
      Jeff Sharkey authored
      One of the final foundational building blocks, which wraps a Java
      `FileDescriptor` object.  Since many of the existing APIs here offer
      to work with "raw" int FD values, we need to reach "behind the
      curtain" to read/write the internal value.  Thankfully `SharedSecrets`
      already offers a way to gain access without requiring us to open
      up the entire `java.io` area of the `java.base` module.
      
      Bring along `android.util.CloseGuard` as a no-op wrapper.
      
      Bug: 324417456
      Test: atest CtsOsTestCasesRavenwood
      Change-Id: I8cffacf96d94aea2d40d75055a2411717e0c1bcf
      6f218ec3
    • Jeff Sharkey's avatar
      `ComponentOptions` on Ravenwood. · 7d57652e
      Jeff Sharkey authored
      These are lightweight holder objects, so they're prime candidates
      for inclusion on Ravenwood.  Also enables `BroadcastRecordTest` on
      Ravenwood too.
      
      Bring CTS to verify we're in sync with devices, and split
      dynamic integration tests into a separate file to avoid complex
      dependency build rules.
      
      Bug: 324417456
      Test: atest CtsAppTestCasesRavenwood
      Test: atest CtsAppTestCases:ActivityOptionsTest
      Test: atest CtsAppTestCases:BroadcastOptionsTest
      Test: atest CtsAppTestCases:BroadcastOptionsIntegrationTest
      Change-Id: I5b496b4d212a3504d8ce56faf0ffe34998dfbae9
      7d57652e
    • Makoto Onuki's avatar
      Remove core-libart-for-host from ravenwood-runtime · f22f4cbc
      Makoto Onuki authored
      Test: ./ravenwood/run-ravenwood-tests.sh
      Test: Treehugger
      Bug: 324433654
      
      Change-Id: I68048479b15f26b1e9248a90b20de16016f47ef9
      f22f4cbc
    • Dmitri Plotnikov's avatar
      Make some telephony methods available under Ravenwood · 2832957d
      Dmitri Plotnikov authored
      Bug: 314797745
      Test: atest PowerStatsTestsRavenwood PowerStatsTests FrameworksCoreTests
      Change-Id: I32215fa8e6bc0591e5cd2fa10ecdb62d12726d5d
      2832957d
  5. Feb 02, 2024
    • Zhi Dou's avatar
      Update SetFlagsRule instruction ravenwood document · 86cd4fe4
      Zhi Dou authored
      ravenwood should use the SetFlagsRule.DefaultInitValueType.NULL_DEFAULT
      in the constructor of SetFlagsRule. Since ravenwood tests are executed
      on the host, SetFlagsRule should initialize the flag value to NULL,
      instead of reading from the device.
      
      Test: N/A
      Bug: N/A
      Change-Id: I75828fe92bf1a9ca2ea708a66a348f5f569cea7a
      86cd4fe4
    • Jeff Sharkey's avatar
      Disable uncaught exception handling. · 4ff8d6b1
      Jeff Sharkey authored
      It's uncovering existing failures that need to be chased elsewhere.
      
      Bug: 323438048
      Test: TH
      Change-Id: Ife5bb2d72b1a575c3a11d2486e73dd210403d77a
      4ff8d6b1
  6. Feb 01, 2024
    • Makoto Onuki's avatar
      Preparing to switch away from the deprecated test runner · 03e9c7c4
      Makoto Onuki authored
      A lot of ravenwood tests (and other tests too) use the deprecated
      test runner androidx.test.runner.AndroidJUnit4, but it actually has
      problems. We should switch them to
      androidx.test.ext.junit.runners.AndroidJUnit4.
      
      However, simply updating all tests could be problematic because:
      - we need to update the build rules and add "androidx.test.ext.junit"
      as a static dependency, which is probably safe but it could
      cause class conflicts.(?)
      - More importantly, the subtle difference between the test runner
      could make the device side test fail.
      
      So I'm going to do it in two steps:
      
      - Step 1 -- this CL:
      Add an optional validator to RavenwoodTest, which can be enabled
      with RAVENWOOD_OPTIONAL_VALIDATION=1.
      
      This makes a test fail if it's using the deprecated one.
      
      - Added a test for this
      
      - Added a script to replace the test runner.
      
      Test: run-ravenwood-tests
      Test: RAVENWOOD_OPTIONAL_VALIDATION=1 atest RavenwoodCoreTest
      Bug: 317131861
      
      Change-Id: I5762bd097c3a529ae6e14460d9e326ed5c6086b4
      03e9c7c4
    • Jeff Sharkey's avatar
      Background exceptions fail tests, more utils. · 18a656bd
      Jeff Sharkey authored
      Some tests rely on reporting failures from another thread; upstream
      JUnit quietly eats these exceptions, which can result in misleading
      "pass" signals when migrating existing tests.  To match the behavior
      of a physical Android device, we now monitor for uncaught exceptions
      and report them as test failures.
      
      Some tests are relying on `ActivityManager` static methods, so offer
      those on Ravenwood.  Leaves "current user" as `USER_SYSTEM` for the
      moment, but we'll likely think more about how to customize it as
      part of bringing a real `ActivityManager` online.
      
      Some tests rely on `VibrationAttributes` which is a basic holder
      object, so offer it on Ravenwood.
      
      Tests to verify all of above.
      
      Bug: 319647875
      Test: atest SystemUiRoboTests
      Test: atest SystemUiRavenTests
      Change-Id: I1bc5bbc7b4eadf1c6d19c0044012a945ce377a20
      18a656bd
  7. Jan 31, 2024
    • Makoto Onuki's avatar
      Clean up ravenwood mockito support. · 450f9f38
      Makoto Onuki authored
      - Remove the "mockito_ravenwood" module, which is based on mockito
      ver 2, now that we use the robo version of mockito (ver 4).
      
      - Remove the use of the deprecated mockito API, which is not
      supported by mockito ver 4.
      
      - Add a test for mocking final class.
      
      - Remove the stale MD file about mockito.
      
      Bug: 310268946
      Test: ./run-ravenwood-tests.sh
      Change-Id: I236661df47f40e0b05805156908e58ff0d2ae535
      450f9f38
  8. Jan 30, 2024
    • Jeff Sharkey's avatar
      Ravenwood support for `wtf()`, wrap logging. · 587b3bec
      Jeff Sharkey authored
      There are some tests triggering `wtf()` during the normal course of
      operation, and we haven't been able to reproduce them yet.  This
      change gives us a valid `wtf()` implementation to aid debugging.
      
      It's also a bit jarring to have log-style messages interleaved with
      raw `System.out`, so also add `redirectLogStreams()` to match the
      logging behavior that developers observe on physical devices.
      
      Bug: 322805216
      Test: atest FrameworksCoreTestsRavenwood FrameworksUtilTestsRavenwood
      Change-Id: I8ea2d12638cd998e3962aaa8af09a3335fcd0d51
      587b3bec
    • Jeff Sharkey's avatar
      Python script to bulk-enable Ravenwood tests. · 58a81b63
      Jeff Sharkey authored
      Bug: 319647875
      Test: manual
      Change-Id: I51e707c20f66d83056d0e2e31a9850cd5db87159
      58a81b63
    • Jeff Sharkey's avatar
      Improve Ravenwood logging/messages. · 3d14bf44
      Jeff Sharkey authored
      Emit "TestRunner" log messages around each test method, so that our
      local debugging logs match what developers experience with tests run
      on a physical device.
      
      Refine `onThrowMethodCalled()` message to be more descriptive about
      Ravenwood and link to docs.
      
      Bug: 322817109, 322526754
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: Id9f6a936145dd2024295c2eb14666fc43a5c7e34
      3d14bf44
  9. Jan 29, 2024
    • Jeff Sharkey's avatar
      Offer `TestLooperManager` on Ravenwood. · c91451a6
      Jeff Sharkey authored
      Common test utilities like `TestableLooper` rely on being able to
      drive `Looper` interactions via `TestLooperManager` which can only
      be obtained via `Instrumentation`.
      
      This change integrates with the common `InstrumentationRegistry`
      library which is how most tests obtain their `Instrumentation`
      instance.  We play an odd dance with `java_host_for_device` and
      `java_device_for_host` to get a version of `androidx.test.monitor`
      that we can link against our runtime.  (The build system otherwise
      gets excited that we're trying to compile an Android-linked library
      into what appears to be a Java-linked library, but we know that we're
      offering the Android runtime.)
      
      Fix subtle bug in `MessageQueue_host` where a requested wake might
      race with the `for (;;)` loop in `MessageQueue.next()`; if a wake is
      pending, it's a valid reason to return from `nativePollOnce()`.
      
      Add timeout logic to `RavenwoodRuleImpl` which can be enabled to
      dump all our stack traces just before Tradefed times out, to aid in
      debugging deadlocks; disabled by default.
      
      Bug: 319647875
      Test: atest SystemUiRoboTests
      Test: atest SystemUiRavenTests
      Test: atest FrameworksCoreTestsRavenwood:TestLooperManagerTest
      Change-Id: I13605d32df0c3e6758f541d5e75a6bdaf44368db
      c91451a6
    • Makoto Onuki's avatar
      Allow disabling tests even with ENABLE_PROBE_IGNORED · 1a7499c2
      Makoto Onuki authored
      A regex in $RAVENWOOD_REALLY_DISABLE is used as an "exclude" filter.
      
      If the regex partial-matches the test full name
      (class name, or class name + "#" + method name), we skip it.
      
      Test: RAVENWOOD_RUN_DISABLED_TESTS=1 RAVENWOOD_REALLY_DISABLE='\.CustomTileDefaultsRepositoryTest' atest SystemUiRavenTests
      and make sure CustomTileDefaultsRepositoryTest is skipped.
      
      Bug: 319646274
      Change-Id: Id98871aaea6d32e134f84b745f3eae7c9f27931f
      1a7499c2
  10. Jan 27, 2024
  11. Jan 26, 2024
    • Jeff Sharkey's avatar
      Offer `RavenwoodClassRule`. · 1a84549b
      Jeff Sharkey authored
      Some tests interact with yet-unsupported APIs under Ravenwood in
      their test class constructors, and `RavenwoodRule` arrives too late
      to effectively apply annotations like `@IgnoreUnderRavenwood`.
      
      This change adds `RavenwoodClassRule` which can be marked as an
      `@ClassRule` so that it runs in a static context before each test
      class is constructed, giving it a chance to respect annotations.
      
      We also adjust our annotation naming to match the naming style in
      JUnit Jupiter, which has annotations like `DisabledOnJre` and
      `EnabledOnOs`.
      
      Bug: 319647875
      Test: atest SystemUiRoboTests
      Test: atest SystemUiRavenTests
      Change-Id: I7d834b8e74e961bb3d4befcad6204d99f8fe80e9
      1a84549b
  12. Jan 24, 2024
    • Jeff Sharkey's avatar
      Baseline PM flags and UserInfo for SysUI. · e1061e2e
      Jeff Sharkey authored
      SysUI code relies on the straightforward Flags and UserInfo classes,
      and working around them in SysUI would be quite disruptive, so this
      change supports them under Ravenwood, along with tests to confirm
      their behavior.
      
      Bug: 319647875
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I9f8bcf711a39b15a9aff457a8afe2a601e64eafd
      e1061e2e
    • Jeff Sharkey's avatar
      Misc baseline support for SysUI. · 221597ac
      Jeff Sharkey authored
      SysUI code relies on the straightforward Singleton, DisplayInfo,
      and PinResult classes, and working around them in SysUI would be
      quite disruptive, so this change supports them under Ravenwood,
      along with tests to confirm their behavior.
      
      Bug: 319647875
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: Iea091bb09f6df9f8b23593871a805646a215ac0a
      221597ac
    • Jeff Sharkey's avatar
      Baseline `Trace` support for SysUI. · 4ac4aa96
      Jeff Sharkey authored
      SysUI code relies on the tracing APIs, which are often used for
      investigating performance-sensitive operations on physical devices.
      
      As this tracing information is less useful under the Ravenwood
      environment, we offer a baseline no-op implementation to support
      existing code.  (There are no APIs to "read back" tracing
      information for a test to inspect, which is another reason it's
      okay to no-op for now.)
      
      Bug: 319647875
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I52865d7da4c38d350edc7e9dc0239fc1b130048d
      4ac4aa96
    • Jeff Sharkey's avatar
      Baseline `logging` support for SysUI. · 0d2ecc61
      Jeff Sharkey authored
      SysUI code heavily relies on utility classes under the `logging`
      internal package, which are pretty straightforward.  This change
      enables them under Ravenwood, along with tests to confirm.
      
      Some of the foundational interfaces have been moved to modules-utils,
      which isn't yet configured to support our Ravenwood annotations, so
      we use hard-coded policies.
      
      Bug: 319647875
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I7e670d31e89a0be741df1c118ecc19c91a24d8fb
      0d2ecc61
    • Jeff Sharkey's avatar
      Ravenwood support for `SystemProperties`. · 950697a4
      Jeff Sharkey authored
      One of our final missing pieces of foundational functionality is
      the SystemProperties key/value store.  Over the years, this key/value
      store has been (ab)used to configure very obscure parts of the OS.
      
      As tempting as it might be to simply let code rely on default return
      values when a key is undefined, we'd like to ensure that code owners
      carefully confirm any assumed behaviors.  To accomplish this, we
      default to blocking both read/write access to keys until their use
      has been explicitly audited.
      
      Based on our guiding principles, as code owners support their APIs
      under Ravenwood, they're expected to bring along all relevant tests,
      which will uncover SystemProperties usage that needs triage, reducing
      the risk of downstream clients uncovering that usage.
      
      Tests can explicitly allow read/write access to specific properties
      via their RavenwoodRule.Builder definition, which is also how we
      ensure that all values are consistently reset between tests.
      
      Bug: 319647875
      Test: atest FrameworksCoreSystemPropertiesTestsRavenwood
      Test: atest FrameworksCoreTestsRavenwood CtsOsTestCasesRavenwood
      Change-Id: I6510e06c33ee8b2bf31b58f35faa07127ecd16b7
      950697a4
  13. Jan 17, 2024
    • Jeff Sharkey's avatar
      `RavenwoodRule` opt-in and opt-out support. · c194caa7
      Jeff Sharkey authored
      For some large suites that are migrating into Ravenwood, it can be
      helpful to have annotations that can selectively include/exclude
      tests at both the method and class level.
      
      To support this, we add new `Include` and `Exclude` annotations that
      are named to be symmetric.  We continue supporting the existing
      `IgnoreUnderRavenwood` annotation as being equal to
      `ExcludeUnderRavenwood`, as `Ignore` can be more descriptive and
      self-documenting to typical JUnit users.
      
      Bug: 319647875
      Test: atest SystemUiRavenTests
      Change-Id: Idf8f836a0f48e61f24dd32dbd8e8cd822b3b6b25
      c194caa7
  14. Jan 09, 2024
  15. Jan 08, 2024
    • Makoto Onuki's avatar
      Ignore test methods with $noRavenwood suffix · 0fb11293
      Makoto Onuki authored
      This allows AOSP changes to have `@IgnoreUnderRavenwood` equivalent
      until the annotations are availabe in AOSP.
      
      Bug: 292141694
      Test: atest RavenwoodMinimumTest
      Change-Id: Id1d5a879eb7e31bb99911aae16bdf093c1c93c6e
      0fb11293
  16. Dec 21, 2023
  17. Dec 15, 2023
  18. Dec 12, 2023
    • Jeff Sharkey's avatar
      Support "probing" ignored tests; more Parcel impl. · 06e55aba
      Jeff Sharkey authored
      As test authors onboard their bivalent tests, they'll be using the
      `@IgnoreUnderRavenwood` annotation to quietly ignore tests that
      don't currently have enough Ravenwood support to run.
      
      However, over time the Ravenwood environment will continue to
      gain new functionality, and we'd like an easy way to "probe" those
      previously-ignored tests to see if any of them started passing.
      
      This change implements this using a locally-configured flag
      that unconditionally runs all tests under Ravenwood, and reports
      failures for any tests marked as `@IgnoreUnderRavenwood` that
      are now passing.  (As these "failures" might be confusing for normal
      test authors, we leave it disabled by default in the build, and
      leave it for internal Ravenwood maintainers.)
      
      To confirm this works, implement two new methods on Parcel, and
      detect the relevant tests that started passing.
      
      Bug: 292141694
      Test: atest CtsUtilTestCasesRavenwood CtsUtilTestCases
      Change-Id: Ied2a5e3d1781c76a4f3506192d015309f2f424b2
      06e55aba
  19. Dec 11, 2023
    • Jeff Sharkey's avatar
      Polished Ravenwood docs. · ef0bcfb4
      Jeff Sharkey authored
      * Highlight temporary strategies for JNI.
      * Clarify current `TEST_MAPPING` status.
      * Mention `@IgnoreUnderRavenwood` support at class level.
      * Mention strategy for bivalent tests using resources.
      * Concrete example of temporary directory.
      
      Bug: 292141694
      Test: atest CtsUtilTestCasesRavenwood CtsUtilTestCases
      Change-Id: If0903296697049d248c50ab46b01b273aab26c9f
      ef0bcfb4
    • Dmitri Plotnikov's avatar
      Migrate several PowerStats tests to Ravenwood · 6d288fe1
      Dmitri Plotnikov authored
      Bug: 314797745
      Test: atest PowerStatsTestsRavenwood
      Test: atest PowerStatsTests
      
      Change-Id: I4af6e9c532285dc935f6d2156cc9cb3531d9aeaa
      6d288fe1
  20. Dec 08, 2023
    • Jeff Sharkey's avatar
      Support more `os` under Ravenwood. · 30a1ccb2
      Jeff Sharkey authored
      Tests for these internal utils are local within the frameworks/base/
      repo, instead of in CTS.
      
      To help future-proof, bring the entire os/* test directory by
      default into the Ravenwood suites, and give developers the way to
      easily opt-out with @IgnoreUnderRavenwood at the class level.
      
      Bug: 292141694
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Change-Id: Ia3c72c22fb3ebc8cfec7a4f9811b7e27a783e885
      30a1ccb2
    • Dmitri Plotnikov's avatar
      Migrate MultiStateStatsTest to Ravenwood · 31c519f8
      Dmitri Plotnikov authored
      Bug: 314797745
      Test: atest PowerStatsTestsRavenwood
      Test: atest PowerStatsTests
      
      Change-Id: I28f823608041cc7606bd848f3618c9c0ae5adace
      31c519f8
  21. Dec 07, 2023
    • Jeff Sharkey's avatar
      Ravenwood support for feature flags. · 9ac0521c
      Jeff Sharkey authored
      Since feature flags are becoming an important part of development
      work, ensure that Ravenwood tests can use existing tools such as
      `SetFlagsRule` to populate values for code-under-test to consume.
      
      To enable this, we extend `AndroidHeuristicsFilter` to recognize
      feature flags generated code, and include that in the Ravenwood
      environment by default.
      
      Bug: 311370221
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Change-Id: I526af65f816d153cb6e365cf6810a5a304d3e6a6
      9ac0521c
    • Jeff Sharkey's avatar
      Example system service test under Ravenwood. · d6752c92
      Jeff Sharkey authored
      This change demonstrates a moderately complex test of a specific
      system service, in this case `UriGrantsManagerService`.
      
      Bug: 292141694
      Test: atest FrameworksServicesTestsRavenwood FrameworksServicesTests
      Change-Id: Ia16632f2c9a1e24deb9c1320fdbb1c099e3d74c3
      d6752c92
  22. Dec 06, 2023
    • Jeff Sharkey's avatar
      Support more utils under Ravenwood. · 3e68053d
      Jeff Sharkey authored
      Tests for these internal utils are local within the frameworks/base/
      repo, instead of in CTS.
      
      To help future-proof, bring the entire utils/* test directory by
      default into the Ravenwood suites, and give developers the way to
      easily opt-out with @IgnoreUnderRavenwood at the class level.
      
      Bug: 292141694
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Test: atest FrameworksUtilTestsRavenwood FrameworksUtilTests
      Change-Id: Ibcabec764efa31cc8cb4c56d7815948d4029aaea
      3e68053d
  23. Dec 05, 2023
    • Jeff Sharkey's avatar
      Support more internal utils under Ravenwood. · 256d9070
      Jeff Sharkey authored
      Tests for these internal utils are local within the frameworks/base/
      repo, instead of in CTS.
      
      To help future-proof, bring the entire utils/* test directory by
      default into the Ravenwood suites, and give developers the way to
      easily opt-out with @IgnoreUnderRavenwood at the class level.
      
      Bug: 292141694
      Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests
      Test: atest FrameworksUtilTestsRavenwood FrameworksUtilTests
      Change-Id: I5251dca752396faa77774659d0923d8cdb719830
      256d9070
Loading