xref: /aosp_15_r20/external/bazel-skylib/docs/build_test_doc.md (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifan<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG YifanA test verifying other targets build as part of a `bazel test`
4*bcb5dc79SHONG Yifan
5*bcb5dc79SHONG Yifan<a id="build_test"></a>
6*bcb5dc79SHONG Yifan
7*bcb5dc79SHONG Yifan## build_test
8*bcb5dc79SHONG Yifan
9*bcb5dc79SHONG Yifan<pre>
10*bcb5dc79SHONG Yifanbuild_test(<a href="#build_test-name">name</a>, <a href="#build_test-targets">targets</a>, <a href="#build_test-kwargs">kwargs</a>)
11*bcb5dc79SHONG Yifan</pre>
12*bcb5dc79SHONG Yifan
13*bcb5dc79SHONG YifanTest rule checking that other targets build.
14*bcb5dc79SHONG Yifan
15*bcb5dc79SHONG YifanThis works not by an instance of this test failing, but instead by
16*bcb5dc79SHONG Yifanthe targets it depends on failing to build, and hence failing
17*bcb5dc79SHONG Yifanthe attempt to run this test.
18*bcb5dc79SHONG Yifan
19*bcb5dc79SHONG YifanTypical usage:
20*bcb5dc79SHONG Yifan
21*bcb5dc79SHONG Yifan```
22*bcb5dc79SHONG Yifan  load("@bazel_skylib//rules:build_test.bzl", "build_test")
23*bcb5dc79SHONG Yifan  build_test(
24*bcb5dc79SHONG Yifan      name = "my_build_test",
25*bcb5dc79SHONG Yifan      targets = [
26*bcb5dc79SHONG Yifan          "//some/package:rule",
27*bcb5dc79SHONG Yifan      ],
28*bcb5dc79SHONG Yifan  )
29*bcb5dc79SHONG Yifan```
30*bcb5dc79SHONG Yifan
31*bcb5dc79SHONG Yifan
32*bcb5dc79SHONG Yifan**PARAMETERS**
33*bcb5dc79SHONG Yifan
34*bcb5dc79SHONG Yifan
35*bcb5dc79SHONG Yifan| Name  | Description | Default Value |
36*bcb5dc79SHONG Yifan| :------------- | :------------- | :------------- |
37*bcb5dc79SHONG Yifan| <a id="build_test-name"></a>name |  The name of the test rule.   |  none |
38*bcb5dc79SHONG Yifan| <a id="build_test-targets"></a>targets |  A list of targets to ensure build.   |  none |
39*bcb5dc79SHONG Yifan| <a id="build_test-kwargs"></a>kwargs |  The [common attributes for tests](https://bazel.build/reference/be/common-definitions#common-attributes-tests).   |  none |
40*bcb5dc79SHONG Yifan
41*bcb5dc79SHONG Yifan
42