• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<a name="#analysis_test"></a>
2## analysis_test
3
4<pre>
5analysis_test(<a href="#analysis_test-name">name</a>, <a href="#analysis_test-targets">targets</a>)
6</pre>
7
8Test rule checking that other targets can be successfully analyzed.
9
10    This rule essentially verifies that all targets under `targets` would
11    generate no errors when analyzed with `bazel build [targets] --nobuild`.
12    Action success/failure for the targets and their transitive dependencies
13    are not verified. An analysis test simply ensures that each target in the transitive
14    dependencies propagate providers appropriately and register actions for their outputs
15    appropriately.
16
17    NOTE: If the targets fail to analyze, instead of the analysis_test failing, the analysis_test
18    will fail to build. Ideally, it would instead result in a test failure. This is a current
19    infrastructure limitation that may be fixed in the future.
20
21    Typical usage:
22
23      load("@bazel_skylib//rules:analysis_test.bzl", "analysis_test")
24      analysis_test(
25          name = "my_analysis_test",
26          targets = [
27              "//some/package:rule",
28          ],
29      )
30
31    Args:
32      name: The name of the test rule.
33      targets: A list of targets to ensure build.
34
35### Attributes
36
37<table class="params-table">
38  <colgroup>
39    <col class="col-param" />
40    <col class="col-description" />
41  </colgroup>
42  <tbody>
43    <tr id="analysis_test-name">
44      <td><code>name</code></td>
45      <td>
46        <a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
47        <p>
48          A unique name for this target.
49        </p>
50      </td>
51    </tr>
52    <tr id="analysis_test-targets">
53      <td><code>targets</code></td>
54      <td>
55        <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a>; required
56      </td>
57    </tr>
58  </tbody>
59</table>
60
61
62