validate-test 821 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Make sure we're not using gos' Testing package any more in integration-cli
  3. source "${MAKEDIR}/.validate"
  4. IFS=$'\n'
  5. files=( $(validate_diff --diff-filter=ACMR --name-only -- 'integration-cli/*.go' || true) )
  6. unset IFS
  7. badFiles=()
  8. for f in "${files[@]}"; do
  9. # skip check_test.go since it *does* use the testing package
  10. if [ "$f" = "integration-cli/check_test.go" ]; then
  11. continue
  12. fi
  13. # we use "git show" here to validate that what's committed doesn't contain golang built-in testing
  14. if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
  15. badFiles+=( "$f" )
  16. fi
  17. done
  18. if [ ${#badFiles[@]} -eq 0 ]; then
  19. echo 'Congratulations! No testing.T found.'
  20. else
  21. {
  22. echo "These files use the wrong testing infrastructure:"
  23. for f in "${badFiles[@]}"; do
  24. echo " - $f"
  25. done
  26. echo
  27. } >&2
  28. false
  29. fi