-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Execute all tests | ||
|
||
set -euo pipefail | ||
bazelisk test //... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# C/C++ build error | ||
|
||
Defines some implementations to check build error in C/C++. | ||
|
||
## `cc_build_error` | ||
|
||
`cc_build_error` is a wrapper macro for rules, providing [`CcBuildErrorInfo`](#ccbuilderrorinfo). | ||
|
||
In addition to the common rule attributes listed [here](https://bazel.build/reference/be/common-definitions#common-attributes), it can receive the following attributes (regarding the specific matcher, please refer to [its readme](../../matcher/README.md)): | ||
|
||
| Attribute | Description | Type | Is this attribute required? | Other constraints | | ||
| ------------------------ | ------------------------------------------------------------------ | ---------------- | --------------------------- | --------------------------------------------------- | | ||
| name | Name of the target. | str | Yes | | | ||
| src | C/C++ source file to check build | label | Yes | Must be a single file having an extension for C/C++ | | ||
| additional_linker_inputs | Pass these files to the linker command | list of labels | No (defaults to `[]`) | | | ||
| copts | C/C++ compilation options | list of str | No (defaults to `[]`) | | | ||
| deps | The list of CcInfo libraries to be linked in to the binary target. | list of label | No (defaults to `[]`) | Each list element must provide `CcInfo` | | ||
| linkopts | C/C++ linking options | list of str | No (defaults to `[]`) | | | ||
| local_defines | Pre-processor macro definitions | list of str | No (defaults to `[]`) | | | ||
| compile_stderr | Matcher for the stderr message while compiling | specific matcher | No (defaults to no-op) | | | ||
| compile_stdout | Matcher for the stdout message while compiling | specific matcher | No (defaults to no-op) | | | ||
| link_stderr | Matcher for the stderr message while compiling | specific matcher | No (defaults to no-op) | | | ||
| link_stdout | Matcher for the stdout message while compiling | specific matcher | No (defaults to no-op) | | | ||
|
||
## `CcBuildErrorInfo` | ||
|
||
`CcBuildErrorInfo` is a provider describing the build error in C/C++. See its definition in [its bzl file](./build_error.bzl) for its details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Matcher | ||
|
||
Defines a struct `matcher`. | ||
|
||
`matcher` has some member functions each of which receives a pattern string as a positional string argument, and which returns its specific matcher. Each specific matcher can be used to specify the way of validating the build error message (stderr or stdout). | ||
|
||
The member functions of `matcher` are as follows | ||
|
||
| Member | Description | | ||
| ----------------------- | --------------------------------------------------------------------- | | ||
| contains_basic_regex | Check if the message contains the basic regular expression pattern | | ||
| contains_extended_regex | Check if the message contains the extended regular expression pattern | | ||
| has_substr | Check if the message has the sub-string | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters