Skip to content

Commit 796e18f

Browse files
committed
Add a build rule for the boilerplate unit test.
1 parent f5d9c43 commit 796e18f

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -474,4 +474,4 @@ bazel-build:
474474
bazel build //cmd/... //pkg/... //federation/... //plugin/... //build/... //examples/... //test/... //third_party/...
475475

476476
bazel-test:
477-
bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/...
477+
bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/... //hack/...

hack/boilerplate/BUILD

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
package(default_visibility = ["//visibility:public"])
22

33
exports_files(glob(["*.txt"]))
4+
5+
py_test(
6+
name = "boilerplate_test",
7+
srcs = [
8+
"boilerplate_test.py",
9+
"boilerplate.py",
10+
],
11+
data = glob(["*.txt", "test/*"]),
12+
)

hack/verify-boilerplate.sh

-16
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,6 @@ boiler="${boilerDir}/boilerplate.py"
2525

2626
files_need_boilerplate=($(${boiler} "$@"))
2727

28-
# Run boilerplate.py unit tests
29-
unitTestOut="$(mktemp)"
30-
trap cleanup EXIT
31-
cleanup() {
32-
rm "${unitTestOut}"
33-
}
34-
35-
pushd "${boilerDir}" >/dev/null
36-
if ! python -m unittest boilerplate_test 2>"${unitTestOut}"; then
37-
echo "boilerplate_test.py failed"
38-
echo
39-
cat "${unitTestOut}"
40-
exit 1
41-
fi
42-
popd >/dev/null
43-
4428
# Run boilerplate check
4529
if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then
4630
for file in "${files_need_boilerplate[@]}"; do

0 commit comments

Comments
 (0)