1a8e1175bSopenharmony_ci#!/bin/sh 2a8e1175bSopenharmony_ci 3a8e1175bSopenharmony_ci# travis-log-failure.sh 4a8e1175bSopenharmony_ci# 5a8e1175bSopenharmony_ci# Copyright The Mbed TLS Contributors 6a8e1175bSopenharmony_ci# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 7a8e1175bSopenharmony_ci# 8a8e1175bSopenharmony_ci# Purpose 9a8e1175bSopenharmony_ci# 10a8e1175bSopenharmony_ci# List the server and client logs on failed ssl-opt.sh and compat.sh tests. 11a8e1175bSopenharmony_ci# This script is used to make the logs show up in the Travis test results. 12a8e1175bSopenharmony_ci# 13a8e1175bSopenharmony_ci# Some of the logs can be very long: this means usually a couple of megabytes 14a8e1175bSopenharmony_ci# but it can be much more. For example, the client log of test 273 in ssl-opt.sh 15a8e1175bSopenharmony_ci# is more than 630 Megabytes long. 16a8e1175bSopenharmony_ci 17a8e1175bSopenharmony_ciif [ -d include/mbedtls ]; then :; else 18a8e1175bSopenharmony_ci echo "$0: must be run from root" >&2 19a8e1175bSopenharmony_ci exit 1 20a8e1175bSopenharmony_cifi 21a8e1175bSopenharmony_ci 22a8e1175bSopenharmony_ciFILES="o-srv-*.log o-cli-*.log c-srv-*.log c-cli-*.log o-pxy-*.log" 23a8e1175bSopenharmony_ciMAX_LOG_SIZE=1048576 24a8e1175bSopenharmony_ci 25a8e1175bSopenharmony_cifor PATTERN in $FILES; do 26a8e1175bSopenharmony_ci for LOG in $( ls tests/$PATTERN 2>/dev/null ); do 27a8e1175bSopenharmony_ci echo 28a8e1175bSopenharmony_ci echo "****** BEGIN file: $LOG ******" 29a8e1175bSopenharmony_ci echo 30a8e1175bSopenharmony_ci tail -c $MAX_LOG_SIZE $LOG 31a8e1175bSopenharmony_ci echo "****** END file: $LOG ******" 32a8e1175bSopenharmony_ci echo 33a8e1175bSopenharmony_ci rm $LOG 34a8e1175bSopenharmony_ci done 35a8e1175bSopenharmony_cidone 36