diff options
author | Yifan Hong <elsk@google.com> | 2022-05-19 21:30:17 -0700 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2022-05-19 21:30:17 -0700 |
commit | 4b96d85dac392052947e036ba4ff70ec9cd635ad (patch) | |
tree | 81bd3f5a3969a1705370d3e0cd6e49f387375f68 | |
parent | dc7641a794a9d8a74f81aa6e03df0d8b8ad16cd5 (diff) | |
download | bazel_common_rules-android-gs-raviole-5.10-t-beta-4.tar.gz |
Add exec_test.android-t-beta-4_r0.5android-t-beta-3.3_r0.4android-t-beta-3.2_r0.4android-13.0.0_r0.44android-13.0.0_r0.43android-13.0.0_r0.4android-13.0.0_r0.20android-13.0.0_r0.19android-13.0.0_r0.15android-13.0.0_r0.14android-gs-raviole-5.10-t-beta-4android-gs-raviole-5.10-t-beta-3android-gs-raviole-5.10-android13android-gs-bluejay-5.10-android13
exec_test is like exec, but it can be provided to bazel test.
Test: TH
Change-Id: Ia8cb2c54a7fd7305b718875027bd09f1a9dfa862
-rw-r--r-- | exec/exec.bzl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/exec/exec.bzl b/exec/exec.bzl index 0769354..ee18f94 100644 --- a/exec/exec.bzl +++ b/exec/exec.bzl @@ -67,3 +67,30 @@ See `build/bazel_common_rules/exec/tests/BUILD` for examples. }, executable = True, ) + +exec_test = rule( + implementation = _impl, + doc = """Run a test script when `bazel test` this target. + +See [documentation] for the `args` attribute. +""", + attrs = { + "data": attr.label_list(aspects = [exec_aspect], allow_files = True, doc = """A list of labels providing runfiles. Labels may be used in `script`. + +Executables in `data` must not have the `args` and `env` attribute. Use +[`embedded_exec`](#embedded_exec) to wrap the depended target so its env and args +are preserved. +"""), + "hashbang": attr.string(default = "/bin/bash -e", doc = "Hashbang of the script."), + "script": attr.string(doc = """The script. + +Use `$(rootpath <label>)` to refer to the path of a target specified in `data`. See +[documentation](https://bazel.build/reference/be/make-variables#predefined_label_variables). + +Use `$@` to refer to the args attribute of this target. + +See `build/bazel_common_rules/exec/tests/BUILD` for examples. +"""), + }, + test = True, +) |