travis-log-failure.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. # travis-log-failure.sh
  3. #
  4. # Copyright The Mbed TLS Contributors
  5. # SPDX-License-Identifier: Apache-2.0
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  8. # not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. # Purpose
  20. #
  21. # List the server and client logs on failed ssl-opt.sh and compat.sh tests.
  22. # This script is used to make the logs show up in the Travis test results.
  23. #
  24. # Some of the logs can be very long: this means usually a couple of megabytes
  25. # but it can be much more. For example, the client log of test 273 in ssl-opt.sh
  26. # is more than 630 Megabytes long.
  27. if [ -d include/mbedtls ]; then :; else
  28. echo "$0: must be run from root" >&2
  29. exit 1
  30. fi
  31. FILES="o-srv-*.log o-cli-*.log c-srv-*.log c-cli-*.log o-pxy-*.log"
  32. MAX_LOG_SIZE=1048576
  33. for PATTERN in $FILES; do
  34. for LOG in $( ls tests/$PATTERN 2>/dev/null ); do
  35. echo
  36. echo "****** BEGIN file: $LOG ******"
  37. echo
  38. tail -c $MAX_LOG_SIZE $LOG
  39. echo "****** END file: $LOG ******"
  40. echo
  41. rm $LOG
  42. done
  43. done