From 796e18f1c7cce8366684399af602a92a5f88d232 Mon Sep 17 00:00:00 2001 From: spxtr Date: Sun, 1 Jan 2017 22:54:32 -0800 Subject: [PATCH] Add a build rule for the boilerplate unit test. --- Makefile | 2 +- hack/boilerplate/BUILD | 9 +++++++++ hack/verify-boilerplate.sh | 16 ---------------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 32a61590a20..98f1a63c3b5 100644 --- a/Makefile +++ b/Makefile @@ -474,4 +474,4 @@ bazel-build: bazel build //cmd/... //pkg/... //federation/... //plugin/... //build/... //examples/... //test/... //third_party/... bazel-test: - bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/... + bazel test --test_output=errors //cmd/... //pkg/... //federation/... //plugin/... //build/... //third_party/... //hack/... diff --git a/hack/boilerplate/BUILD b/hack/boilerplate/BUILD index c405bde045d..3a83dd8adcc 100644 --- a/hack/boilerplate/BUILD +++ b/hack/boilerplate/BUILD @@ -1,3 +1,12 @@ package(default_visibility = ["//visibility:public"]) exports_files(glob(["*.txt"])) + +py_test( + name = "boilerplate_test", + srcs = [ + "boilerplate_test.py", + "boilerplate.py", + ], + data = glob(["*.txt", "test/*"]), +) diff --git a/hack/verify-boilerplate.sh b/hack/verify-boilerplate.sh index e15edddb7da..2f8705b6ee0 100755 --- a/hack/verify-boilerplate.sh +++ b/hack/verify-boilerplate.sh @@ -25,22 +25,6 @@ boiler="${boilerDir}/boilerplate.py" files_need_boilerplate=($(${boiler} "$@")) -# Run boilerplate.py unit tests -unitTestOut="$(mktemp)" -trap cleanup EXIT -cleanup() { - rm "${unitTestOut}" -} - -pushd "${boilerDir}" >/dev/null -if ! python -m unittest boilerplate_test 2>"${unitTestOut}"; then - echo "boilerplate_test.py failed" - echo - cat "${unitTestOut}" - exit 1 -fi -popd >/dev/null - # Run boilerplate check if [[ ${#files_need_boilerplate[@]} -gt 0 ]]; then for file in "${files_need_boilerplate[@]}"; do