Skip to content
Snippets Groups Projects
  1. May 21, 2024
  2. May 15, 2024
    • Makoto Onuki's avatar
      Add a hidden API to detect ravenwood environment · 2850813e
      Makoto Onuki authored
      We should minimize uses of it, but once in a while,
      it's useful as a last resort.
      
      Bug: 340556010
      Test: atest FrameworksCoreTestsRavenwood:com.android.internal.ravenwood.RavenwoodEnvironmentTest
      Test: tree hugger for device side tests
      Merged-In: Ice651a55cad092514466dd56940a2cf7b2285e4e
      Change-Id: Ice651a55cad092514466dd56940a2cf7b2285e4e
      2850813e
  3. Feb 29, 2024
    • Jeff Sharkey's avatar
      Offer baseline `RavenwoodFlagsValueProvider`. · 7037e357
      Jeff Sharkey authored
      Many test authors are starting to use `CheckFlagsRule` across suites
      like CTS, so instead of recommending that they use `null` when on
      Ravenwood, offer them a clear behavior that is either "all-on" or
      "all-off".
      
      Eventually we'll explore providing default flag values on Ravenwood,
      but let's get something cleaner available now.
      
      Bug: 318841620
      Test: ./frameworks/base/ravenwood/run-ravenwood-tests.sh
      Change-Id: Id234a375426fad38f64d3a999339bb720eae84bf
      7037e357
    • Jeff Sharkey's avatar
      Support service dependencies on Ravenwood. · 8a922eca
      Jeff Sharkey authored
      Ravenwood test authors should only need to call setServicesRequired()
      for the services they directly interact with, but often those
      services will have indirect dependencies on other OS internals, and
      those dependencies will evolve over time.
      
      To handle this, we add the concept of dependencies to SystemService,
      where a service declares the other services required to run.  (They
      can choose to omit services from their dependencies where they
      gracefully handle a missing service at runtime.)
      
      Bug: 325506297
      Test: atest RavenwoodServicesTest
      Change-Id: I42187b3494fef499d619ad882891e832b0fd6bca
      8a922eca
  4. Feb 27, 2024
    • Jeff Sharkey's avatar
      First pass of "fake" services on Ravenwood. · 16f7cdf2
      Jeff Sharkey authored
      One of our eventual goals with Ravenwood is to support usage of
      system services from test code.  A recent change added support for
      "real" services on Ravenwood, and this change expands that to add
      support for "fake" services.
      
      Some services are so tangled with dependencies it would take a
      long time until we'd be able to run their "real" code.  Also, some
      services with deep hardware dependencies that it can be difficult
      to add new abstraction layers to support Ravenwood.  Finally, we
      want to support service owners that only have resources to meet
      the "Pareto principle", where enabling 20% of their functionality
      on Ravenwood is enough to unblock 80% of test use-cases.
      
      Thus, we're supporting teams bringing either "real" or "fake"
      implementations of their services.  Since all test interactions
      still go through published FooManager and FooManagerInternal-style
      interfaces, teams can start with a "fake" and slowly transition
      to using more of their "real" code over time, without having to
      update test clients.
      
      And as a final reminder, because Ravenwood requires test suites
      like CTS, we're already verifying that "fake" services behave
      similarly to the "real" services on physical devices.
      
      Bug: 325506297
      Test: atest CtsContentTestCasesRavenwood
      Change-Id: I8ed5bd030e03143c15cb9fa945bbdcb0b412611e
      16f7cdf2
  5. Feb 23, 2024
    • Antonio Kantek's avatar
      Enabling ClientControllerTest as hostside test · d9066c30
      Antonio Kantek authored
      Bug: 324438289
      Test: atest --host FrameworksInputMethodSystemServerTests_host:com.android.server.inputmethod.ClientControllerTest
      Test: atest FrameworksInputMethodSystemServerTests:com.android.server.inputmethod.ClientControllerTest
      Change-Id: I176064d24917f12af3f4551aa82cf54f59466fc0
      d9066c30
  6. Feb 20, 2024
    • Jeff Sharkey's avatar
      First pass of "real" services on Ravenwood. · 3e91c2b2
      Jeff Sharkey authored
      One of our eventual goals with Ravenwood is to support usage of
      system services from test code.  Robolectric takes the approach of
      publishing "shadows" which are effectively fakes of the Manager
      objects visible to app processes, and it unfortunately doesn't offer
      a mechanism to run "real" services code.
      
      In contrast, Ravenwood aims to support API owners progressively
      offering their system services either via a "fake" approach, or by
      using various levels of the "real" code that would run on a device.
      
      This change wires up the foundational support and uses the simple
      `SerialManager` example to demonstrate using the same "real" code
      on both Ravenwood and devices.  It also demonstrates the `Internal`
      pattern being used to customize behavior for tests.
      
      To offer as hermetic as a test environment as possible, we start
      new instances of each requested service for each test.  Requiring
      developers to be explicit about the services they need will help
      keep overhead low, especially for tests that don't need services.
      
      Bug: 325506297
      Test: atest RavenwoodServicesTest
      Change-Id: Ie22436b38f2176f91dfce746b899ebab7752bbb8
      3e91c2b2
    • Makoto Onuki's avatar
      Allow run-ravenwood-tests.sh to use atest-dev · 847ba786
      Makoto Onuki authored
      See the Test: line
      
      Test: ATEST=atest-dev ravenwood/run-ravenwood-tests.sh
      Bug: 292141694
      Change-Id: I18851d99f175578ffec78873599e842f72568c57
      847ba786
  7. Feb 16, 2024
  8. Feb 15, 2024
  9. Feb 14, 2024
  10. Feb 13, 2024
    • Makoto Onuki's avatar
      Move "runtime helpers" to f/b/ravenwood · 053eac85
      Makoto Onuki authored
      - Also make sure framework-minus-apex is prioritized
      - Also some build rule cleanup
      
      Bug: 315031371
      Test: ./ravenwood/run-ravenwood-tests.sh
      
      Change-Id: I2d0eb822517abfc17f351810a53176ad9904f908
      053eac85
    • Jeff Sharkey's avatar
      More misc `android.os` on Ravenwood. · 1d261135
      Jeff Sharkey authored
      Bring along some general utils along with tests to confirm their
      behavior is consistent between devices and Ravenwood
      
      Bug: 324417456
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: Idbf1265d8c487701c3605f446c8d7d005a34ebc4
      1d261135
    • Jeff Sharkey's avatar
      More misc `android.util` on Ravenwood. · 23d50f5d
      Jeff Sharkey authored
      Bring along some general utils along with tests to confirm their
      behavior is consistent between devices and Ravenwood.
      
      Bug: 324417456
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I9a7b56d157678014bc458847cccd98ea48994d97
      23d50f5d
    • Jeff Sharkey's avatar
      Move most Ravenwood policies to annotations. · e1841f84
      Jeff Sharkey authored
      We've been splitting our definitions between `policies.txt` and
      inline annotations; let's standardize on inline annotations.
      
      This change is a mechanical no-op migration.
      
      Bug: 324417456
      Test: atest FrameworksCoreTestsRavenwood
      Change-Id: I34c597f61874a57d783951215c2b0a61386ae6d5
      e1841f84
  11. 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
    • Jeff Sharkey's avatar
      Human-readable XML on Ravenwood. · 1e92835f
      Jeff Sharkey authored
      We had temporarily been using the binary XML implementation in all
      situations, but this change brings in the existing `kxml2-android`
      library to offer reading/writing of human-readable XML.  We also
      use the upstream SAX parser to offer an event-based parser.
      
      In all cases we carefully keep the existing XML libraries in place
      untouched on physical devices to avoid regressions.
      
      Bug: 324417456
      Test: atest CtsUtilTestCasesRavenwood
      Test: atest FrameworksCoreTestsRavenwood
      Test: atest FrameworksUtilTestsRavenwood
      Change-Id: I2effc7fca5c586968658073f9652d13cf50a2c66
      1e92835f
    • 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
  12. 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
  13. Feb 09, 2024
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. Jan 27, 2024
  21. 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
  22. 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
Loading