Skip to content

Commit

Permalink
Add a build rule for the boilerplate unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
spxtr committed Jan 2, 2017
1 parent f5d9c43 commit 796e18f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/...
9 changes: 9 additions & 0 deletions hack/boilerplate/BUILD
Original file line number Diff line number Diff line change
@@ -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/*"]),
)
16 changes: 0 additions & 16 deletions hack/verify-boilerplate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 796e18f

Please sign in to comment.