tast-tests: Add arc.MediaScanPerf test

arc.MediaScanPerf is a performance test for Android's MediaProvider's
media scans on Chrome OS files. The .myfiles_vm (resp. .sdcard_vm)
parametrized test measures how long it takes to perform a full volume
scan on the MyFiles (resp. sdcard) volume in ARCVM.

It first sets up the target directory by creating a certain number of
files (10,000 image files) inside it, and then triggers a full volume
scan. The elapsed time of the scan is measured using the
ArcMediaScanPerf app. The app listens for starting and finishing events
of full volume scans, and report the time between these events via UI.

In order to obtain stable and reproducible results, the test deletes the
data of scanned files from the MediaStore database before triggering a
full volume scan. Also, for the MyFiles volume, it needs to wait for a
while before deleting the data. This is because the volume is watched by
Chrome's ArcFileSystemWatcher. ArcFileSystemWatcher sends media scan
requests to MediaProvider when it detects filesystem changes. So, it
sends scan requests for newly created files after the target directory
is set up. These requests can affect the performance of full volume
scans. So, in order to make sure that all requests are finished
processing before triggering a full volume scan, the test watches the
MediaStore database until all newly created files are registered to it,
and then clear the database.

MediaProvider performs a full volume scan when a volume is mounted on
the Android side. So, the test triggers a full volume scan by first
unmounting the target volume, and then mounting it again via adb's sm

In summary, the overall structure of the test is as follows:
1. Set up the target directory by creating 10,000 copies of an image
2. (MyFiles only) Wait for the newly created files to be added to
MediaStore database
3. Clear the MediaStore database
4. Unmount the target volume
5. Launch the test app (which performs the measurement)
6. Mount the target volume again to trigger a full volume media scan
7. Wait for the elapsed time to appear in the app UI
8. Report the result

TEST=$ emerge-${BOARD} tast-local-apks-cros
TEST=$ cros deploy --root=/usr/local --board=${BOARD} <DUT> \
TEST=  tast-local-apks-cros
TEST=$ tast run <DUT> arc.MediaScanPerf*

Change-Id: Iec604f07204089cd1983f0c2f3dba3cb21f2919f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tast-tests/+/3144770
Reviewed-by: Ricardo Quesada <ricardoq@chromium.org>
Reviewed-by: Youkichi Hosoi <youkichihosoi@chromium.org>
Reviewed-by: Risan <risan@chromium.org>
Tast-Review: Ricardo Quesada <ricardoq@chromium.org>
Tast-Review: Trent Begin <tbegin@chromium.org>
Tested-by: Momoko Fukuda <fmomoko@google.com>
Commit-Queue: Youkichi Hosoi <youkichihosoi@chromium.org>
8 files changed
tree: e17d32dba087d275761dc4caa8c22d85a753e84b
  1. android/
  2. helpers/
  3. src/
  4. tools/
  5. vars/
  6. .gitignore
  9. PRESUBMIT.cfg
  10. PRESUBMIT.py
  11. README.md
  12. unblocked_terms.txt

Tast (tests)

This repository contains integration tests that are run by Tast.

Directory structure

  • helpers/ - Source code for binaries executed by tests.
    • local/ - Helpers for local tests that are compiled and installed to /usr/local/libexec/tast/helpers/local/cros by the tast-local-helpers-cros package.
  • src/chromiumos/tast/
    • local/ - Code related to local (i.e. on-device or “client”) tests.
      • bundles/ - Local test bundles.
        • cros/ - The “cros” local test bundle, containing standard Chrome OS tests. Tests are packaged by category.
      • ... - Packages used only by local tests.
    • remote/ - Code related to remote (i.e. off-device or “server”) tests.
      • bundles/ - Remote test bundles.
        • cros/ - The “cros” remote test bundle, containing standard Chrome OS tests. Tests are packaged by category.
      • ... - Packages used only by remote tests.

Shared code, the main tast executable, the local_test_runner and remote_test_runner executables responsible for running bundles, and documentation are located in the tast repository.