tree: 618cb7b63bb76c5318530faf15e43b6a037a91da [path history] [tgz]
  1. meta/
  2. tests/
  3. BUILD.gn
  4. README.md
src/sys/test_runners/gunit/README.md

Gunit Runner

Reviewed on: 2022-04-07

Gunit Runner is a test runner that launches a gunit binary as a component, parses its output, and translates it to fuchsia.test.Suite protocol on behalf of the test.

Building

fx set core.x64 --with //src/sys/test_runners/gunit
fx build

Example

A test that needs additional capabilities can use a manifest like the following:

{
    include: [
        "sys/testing/gunit_runner.shard.cml",
    ],
    program: {
        binary: "bin/my_component_test",
    },
    // ... other capabilities
}

Concurrency

Test cases are executed sequentially by default. Instruction to override.

Arguments

See passing arguments to learn more.

Limitations

  • If a test calls GUNIT_SKIP(), it will be recorded as Passed rather than as Skipped. This is due to a bug in gunit itself.

Testing

We currently don't have a way of writing gunit tests. So we simulate those tests by converting gunit flags to gtest flags and then running the test using gtest framework.

Run:

fx test gunit_runner_tests
fx test gunit-runner-integration-test
fx test gunit-runner-smoke-test

Source layout

Gtest and Gunit have identical output formats. They differ in name of the flags passed to test binary. All source code of this component is hosted in //src/sys/test_runners/gtest folder. This folder hosts configuration, build files and some test files.

The entrypoint is located in src/main.rs, the FIDL service implementation and all the test logic exists in src/test_server.rs. Unit tests are co-located with the implementation.