tree: b18a7b775e4594a8288bbd7f164f4776557ec442 [path history] [tgz]
  1. meta/
  2. src/
  3. BUILD.gn
  4. README.md
src/sys/pkg/testing/pkgfs-ramdisk/README.md

A test helper that manages pkgfs instances backed by memory-backed blobfs instances.

Usage

As this test helper is intended to be included within a test package, all tests utilizing this helper will need a few extra blobs included in their test package and access to some non-standard sandbox features.

BUILD.gn

Include the following template in all BUILD.gn files containing test packages that utilize this crate.

# Include blobfs in the build, which comes from Zircon
generate_manifest("blobfs.manifest") {
  visibility = [ ":*" ]
  args = []
  foreach(pattern, [ "bin/blobfs" ]) {
    args += [ "--binary=" + pattern ]
  }
}
blobfs_manifest_outputs = get_target_outputs(":blobfs.manifest")
blobfs_manifest = blobfs_manifest_outputs[0]

Then, in each test_package that utilizes this crate, add a dependency on the manifest and add it to the extra set of manifests to include in the package. Also, add a dependency on the pkgfs binary and include the binary in the package.

test_package("example-test-package") {
  extra = [ blobfs_manifest ]
  deps = [
    ":blobfs.manifest",
    "//garnet/go/src/grand_unified_binary",
    ...
  ]
  binaries = [
    {
      name = "pkgsvr"
      source = "grand_unified_binary"
    },
  ]
  ...
}

Sandbox

In the sandbox section of tests that utilize this crate, add access to the ramctl device and “fuchsia.process.Launcher” service:

{
    "sandbox": {
        "dev": [
            "misc/ramctl"
        ],
        "services": [
            "fuchsia.process.Launcher"
        ]
    }
}