xref: /aosp_15_r20/external/bazel-skylib/docs/analysis_test_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2
3A test verifying other targets can be successfully analyzed as part of a `bazel test`
4
5<a id="analysis_test"></a>
6
7## analysis_test
8
9<pre>
10analysis_test(<a href="#analysis_test-name">name</a>, <a href="#analysis_test-targets">targets</a>)
11</pre>
12
13Test rule checking that other targets can be successfully analyzed.
14
15This rule essentially verifies that all targets under `targets` would
16generate no errors when analyzed with `bazel build [targets] --nobuild`.
17Action success/failure for the targets and their transitive dependencies
18are not verified. An analysis test simply ensures that each target in the transitive
19dependencies propagate providers appropriately and register actions for their outputs
20appropriately.
21
22NOTE: If the targets fail to analyze, instead of the analysis_test failing, the analysis_test
23will fail to build. Ideally, it would instead result in a test failure. This is a current
24infrastructure limitation that may be fixed in the future.
25
26Typical usage:
27
28  load("@bazel_skylib//rules:analysis_test.bzl", "analysis_test")
29  analysis_test(
30      name = "my_analysis_test",
31      targets = [
32          "//some/package:rule",
33      ],
34  )
35
36Args:
37  name: The name of the test rule.
38  targets: A list of targets to ensure build.
39
40**ATTRIBUTES**
41
42
43| Name  | Description | Type | Mandatory | Default |
44| :------------- | :------------- | :------------- | :------------- | :------------- |
45| <a id="analysis_test-name"></a>name |  A unique name for this target.   | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required |  |
46| <a id="analysis_test-targets"></a>targets |  -   | <a href="https://bazel.build/concepts/labels">List of labels</a> | required |  |
47
48
49