Alex Eagle | eabe5f7 | 2021-09-24 08:24:43 -0700 | [diff] [blame] | 1 | <!-- Generated with Stardoc: http://skydoc.bazel.build --> |
| 2 | |
Alexandre Rostovtsev | 6e30a77 | 2021-10-27 09:13:59 -0400 | [diff] [blame] | 3 | A test verifying other targets build as part of a `bazel test` |
| 4 | |
nickgooding | 31ab4c8 | 2022-08-30 19:57:34 +0100 | [diff] [blame] | 5 | <a id="build_test"></a> |
Alex Eagle | eabe5f7 | 2021-09-24 08:24:43 -0700 | [diff] [blame] | 6 | |
c-parsons | 9630853 | 2019-02-28 17:43:57 -0500 | [diff] [blame] | 7 | ## build_test |
| 8 | |
| 9 | <pre> |
| 10 | build_test(<a href="#build_test-name">name</a>, <a href="#build_test-targets">targets</a>, <a href="#build_test-kwargs">kwargs</a>) |
| 11 | </pre> |
| 12 | |
| 13 | Test rule checking that other targets build. |
| 14 | |
| 15 | This works not by an instance of this test failing, but instead by |
| 16 | the targets it depends on failing to build, and hence failing |
| 17 | the attempt to run this test. |
| 18 | |
c-parsons | 9630853 | 2019-02-28 17:43:57 -0500 | [diff] [blame] | 19 | Typical usage: |
| 20 | |
| 21 | ``` |
| 22 | load("@bazel_skylib//rules:build_test.bzl", "build_test") |
| 23 | build_test( |
| 24 | name = "my_build_test", |
| 25 | targets = [ |
| 26 | "//some/package:rule", |
| 27 | ], |
| 28 | ) |
| 29 | ``` |
| 30 | |
| 31 | |
Alex Eagle | eabe5f7 | 2021-09-24 08:24:43 -0700 | [diff] [blame] | 32 | **PARAMETERS** |
c-parsons | 9630853 | 2019-02-28 17:43:57 -0500 | [diff] [blame] | 33 | |
c-parsons | 9630853 | 2019-02-28 17:43:57 -0500 | [diff] [blame] | 34 | |
Alex Eagle | eabe5f7 | 2021-09-24 08:24:43 -0700 | [diff] [blame] | 35 | | Name | Description | Default Value | |
Alexandre Rostovtsev | 6e30a77 | 2021-10-27 09:13:59 -0400 | [diff] [blame] | 36 | | :------------- | :------------- | :------------- | |
| 37 | | <a id="build_test-name"></a>name | The name of the test rule. | none | |
| 38 | | <a id="build_test-targets"></a>targets | A list of targets to ensure build. | none | |
Alexandre Rostovtsev | bc112d4 | 2022-10-03 05:13:46 -0400 | [diff] [blame] | 39 | | <a id="build_test-kwargs"></a>kwargs | The [common attributes for tests](https://bazel.build/reference/be/common-definitions#common-attributes-tests). | none | |
c-parsons | 9630853 | 2019-02-28 17:43:57 -0500 | [diff] [blame] | 40 | |
Samuel Freilich | 506c172 | 2021-10-04 12:03:48 -0400 | [diff] [blame] | 41 | |