@@ -28,10 +28,11 @@ NEW_WORKSPACE="${TEMP_DIR}/rules_rust_test_clippy"
2828function check_build_result() {
2929 local ret=0
3030 echo -n " Testing ${2} ... "
31+
3132 (bazel build ${@: 3} //test/clippy:" ${2} " & > /dev/null) || ret=" $? " && true
3233 if [[ " ${ret} " -ne " ${1} " ]]; then
3334 >&2 echo " FAIL: Unexpected return code [saw: ${ret} , want: ${1} ] building target //test/clippy:${2} "
34- >&2 echo " Run \" bazel build //test/clippy:${2} \" to see the output"
35+ >&2 echo " Run \" bazel build //test/clippy:${2} ${ @: 3} \" to see the output"
3536 exit 1
3637 elif [[ $# -ge 3 ]] && [[ " ${@: 3} " == * " capture_clippy_output" * ]]; then
3738 # Make sure that content was written to the output file
@@ -43,7 +44,8 @@ function check_build_result() {
4344 if [[ $( stat ${STATOPTS[@]} " ${NEW_WORKSPACE} /bazel-bin/test/clippy/${2% _clippy} .clippy.out" ) == 0 ]]; then
4445 >&2 echo " FAIL: Output wasn't written to out file building target //test/clippy:${2} "
4546 >&2 echo " Output file: ${NEW_WORKSPACE} /bazel-bin/test/clippy/${2% _clippy} .clippy.out"
46- >&2 echo " Run \" bazel build //test/clippy:${2} \" to see the output"
47+ >&2 echo " Run \" bazel build //test/clippy:${2} ${@: 3} \" to see the output"
48+
4749 exit 1
4850 else
4951 echo " OK"
@@ -58,6 +60,7 @@ function test_all() {
5860 local -r BUILD_FAILED=1
5961 local -r CAPTURE_OUTPUT=" --@rules_rust//rust/settings:capture_clippy_output=True --@rules_rust//rust/settings:error_format=json"
6062 local -r BAD_CLIPPY_TOML=" --@rules_rust//rust/settings:clippy.toml=//too_many_args:clippy.toml"
63+ local -r TRAVERSE_DEPS=" --@rules_rust//rust/settings:experimental_clippy_aspect_traverse_deps=True"
6164
6265 mkdir -p " ${NEW_WORKSPACE} /test/clippy" && \
6366 cp -r test/clippy/* " ${NEW_WORKSPACE} /test/clippy/" && \
105108 check_build_result $BUILD_OK ok_proc_macro_clippy
106109 check_build_result $BUILD_FAILED bad_binary_clippy
107110 check_build_result $BUILD_FAILED bad_library_clippy
111+ check_build_result $BUILD_OK bad_dep_clippy
112+ check_build_result $BUILD_FAILED bad_dep_clippy $TRAVERSE_DEPS
108113 check_build_result $BUILD_FAILED bad_shared_library_clippy
109114 check_build_result $BUILD_FAILED bad_static_library_clippy
110115 check_build_result $BUILD_FAILED bad_test_clippy
114119 # should succeed.
115120 check_build_result $BUILD_OK bad_binary_clippy $CAPTURE_OUTPUT
116121 check_build_result $BUILD_OK bad_library_clippy $CAPTURE_OUTPUT
122+ check_build_result $BUILD_OK bad_dep_clippy $CAPTURE_OUTPUT
123+ check_build_result $BUILD_OK bad_dep_clippy $CAPTURE_OUTPUT $TRAVERSE_DEPS
117124 check_build_result $BUILD_OK bad_shared_library_clippy $CAPTURE_OUTPUT
118125 check_build_result $BUILD_OK bad_static_library_clippy $CAPTURE_OUTPUT
119126 check_build_result $BUILD_OK bad_test_clippy $CAPTURE_OUTPUT
0 commit comments