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