blob: 04edc38126e424435732c5dd04507fdeddda6c0e [file] [log] [blame]
Andres AG31f9b5b2016-10-04 17:14:38 +01001#! /usr/bin/env sh
2
Janos Follathb72c6782016-07-19 14:54:17 +01003# output_env.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# To print out all the relevant information about the development environment.
12#
13# This includes:
14# - architecture of the system
15# - type and version of the operating system
Simon Butcher3ac07672016-09-04 14:28:44 +030016# - version of armcc, clang, gcc-arm and gcc compilers
17# - version of libc, clang, asan and valgrind if installed
Janos Follathb72c6782016-07-19 14:54:17 +010018# - version of gnuTLS and OpenSSL
19
Andres AG31f9b5b2016-10-04 17:14:38 +010020print_version()
21{
22 BIN="$1"
23 shift
24 ARGS="$1"
25 shift
Simon Butcher85c4c862020-03-05 15:18:53 +000026 VARIANT="$1"
Andres AG31f9b5b2016-10-04 17:14:38 +010027 shift
Andres AG7a63eaf2016-09-05 12:24:47 +010028
Simon Butcher679d2de2020-02-27 12:58:27 +000029 if [ -n "$VARIANT" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000030 VARIANT=" ($VARIANT)"
31 fi
32
Simon Butcher679d2de2020-02-27 12:58:27 +000033 if ! type "$BIN" > /dev/null 2>&1; then
Simon Butcher3104eec2020-02-26 15:29:40 +000034 echo " * ${BIN##*/}$VARIANT: Not found."
Andres AG31f9b5b2016-10-04 17:14:38 +010035 return 0
Andres AG87bb5772016-09-27 15:05:15 +010036 fi
Andres AG87bb5772016-09-27 15:05:15 +010037
Andres AG31f9b5b2016-10-04 17:14:38 +010038 BIN=`which "$BIN"`
39 VERSION_STR=`$BIN $ARGS 2>&1`
Janos Follathb72c6782016-07-19 14:54:17 +010040
Andres AG31f9b5b2016-10-04 17:14:38 +010041 # Apply all filters
42 while [ $# -gt 0 ]; do
43 FILTER="$1"
44 shift
45 VERSION_STR=`echo "$VERSION_STR" | $FILTER`
46 done
47
Simon Butcher85c4c862020-03-05 15:18:53 +000048 if [ -z "$VERSION_STR" ]; then
49 VERSION_STR="Version could not be determined."
50 fi
51
Simon Butcher3104eec2020-02-26 15:29:40 +000052 echo " * ${BIN##*/}$VARIANT: ${BIN} : ${VERSION_STR} "
Andres AG31f9b5b2016-10-04 17:14:38 +010053}
54
Simon Butcher679d2de2020-02-27 12:58:27 +000055echo "** Platform:"
56echo
57
58if [ `uname -s` = "Linux" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +000059 echo "Linux variant"
60 lsb_release -d -c
61else
62 echo "Unknown Unix variant"
63fi
64
Janos Follathb72c6782016-07-19 14:54:17 +010065echo
Janos Follathb72c6782016-07-19 14:54:17 +010066
Simon Butcher3104eec2020-02-26 15:29:40 +000067print_version "uname" "-a" ""
Simon Butcher85c4c862020-03-05 15:18:53 +000068
Simon Butcher679d2de2020-02-27 12:58:27 +000069echo
70echo
71echo "** Tool Versions:"
72echo
Simon Butcher3104eec2020-02-26 15:29:40 +000073
Gilles Peskine26232962018-03-21 08:35:07 +010074if [ "${RUN_ARMCC:-1}" -ne 0 ]; then
75 : "${ARMC5_CC:=armcc}"
Simon Butcher3104eec2020-02-26 15:29:40 +000076 print_version "$ARMC5_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010077 echo
Janos Follathb72c6782016-07-19 14:54:17 +010078
Gilles Peskine26232962018-03-21 08:35:07 +010079 : "${ARMC6_CC:=armclang}"
Simon Butcher3104eec2020-02-26 15:29:40 +000080 print_version "$ARMC6_CC" "--vsn" "" "head -n 2"
Gilles Peskine26232962018-03-21 08:35:07 +010081 echo
82fi
Janos Follathb72c6782016-07-19 14:54:17 +010083
Simon Butcher3104eec2020-02-26 15:29:40 +000084print_version "arm-none-eabi-gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010085echo
Janos Follathb72c6782016-07-19 14:54:17 +010086
Simon Butcher3104eec2020-02-26 15:29:40 +000087print_version "gcc" "--version" "" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +010088echo
Janos Follathb72c6782016-07-19 14:54:17 +010089
Simon Butcher3104eec2020-02-26 15:29:40 +000090print_version "clang" "--version" "" "head -n 2"
Janos Follathb72c6782016-07-19 14:54:17 +010091echo
Andres AG7a63eaf2016-09-05 12:24:47 +010092
Simon Butcher3104eec2020-02-26 15:29:40 +000093print_version "ldd" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +010094echo
95
Simon Butcher3104eec2020-02-26 15:29:40 +000096print_version "valgrind" "--version" ""
97echo
98
99print_version "gdb" "--version" "" "head -n 1"
Andres AG31f9b5b2016-10-04 17:14:38 +0100100echo
101
Simon Butcher85c4c862020-03-05 15:18:53 +0000102print_version "perl" "--version" "" "head -n 2" "grep ."
103echo
104
105print_version "python" "--version" "" "head -n 1"
106echo
107
Simon Butcher47f72872020-03-16 11:30:46 +0000108# Find the installed version of Pylint. Installed as a distro package this can
109# be pylint3 and as a PEP egg, pylint. In test scripts We prefer pylint over
110# pylint3
111if type pylint >/dev/null 2>/dev/null; then
112 print_version "pylint" "--version" "" "sed /^.*config/d" "grep pylint"
113elif type pylint3 >/dev/null 2>/dev/null; then
114 print_version "pylint3" "--version" "" "sed /^.*config/d" "grep pylint"
115else
116 echo " * pylint or pylint3: Not found."
117fi
Simon Butcher85c4c862020-03-05 15:18:53 +0000118echo
119
Andres AG31f9b5b2016-10-04 17:14:38 +0100120: ${OPENSSL:=openssl}
Simon Butcher3104eec2020-02-26 15:29:40 +0000121print_version "$OPENSSL" "version" "default"
Andres AG31f9b5b2016-10-04 17:14:38 +0100122echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100123
124if [ -n "${OPENSSL_LEGACY+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000125 print_version "$OPENSSL_LEGACY" "version" "legacy"
126else
127 echo " * openssl (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100128fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000129echo
Janos Follathb72c6782016-07-19 14:54:17 +0100130
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100131if [ -n "${OPENSSL_NEXT+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000132 print_version "$OPENSSL_NEXT" "version" "next"
133else
134 echo " * openssl (next): Not configured."
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100135fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000136echo
Manuel Pégourié-Gonnard6b368922018-02-20 12:02:07 +0100137
Andres AG31f9b5b2016-10-04 17:14:38 +0100138: ${GNUTLS_CLI:=gnutls-cli}
Simon Butcher3104eec2020-02-26 15:29:40 +0000139print_version "$GNUTLS_CLI" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100140echo
Janos Follathb72c6782016-07-19 14:54:17 +0100141
Andres AG31f9b5b2016-10-04 17:14:38 +0100142: ${GNUTLS_SERV:=gnutls-serv}
Simon Butcher3104eec2020-02-26 15:29:40 +0000143print_version "$GNUTLS_SERV" "--version" "default" "head -n 1"
Janos Follathb72c6782016-07-19 14:54:17 +0100144echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100145
146if [ -n "${GNUTLS_LEGACY_CLI+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000147 print_version "$GNUTLS_LEGACY_CLI" "--version" "legacy" "head -n 1"
148else
149 echo " * gnutls-cli (legacy): Not configured."
Andres AG7a63eaf2016-09-05 12:24:47 +0100150fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000151echo
Andres AG7a63eaf2016-09-05 12:24:47 +0100152
153if [ -n "${GNUTLS_LEGACY_SERV+set}" ]; then
Simon Butcher3104eec2020-02-26 15:29:40 +0000154 print_version "$GNUTLS_LEGACY_SERV" "--version" "legacy" "head -n 1"
155else
156 echo " * gnutls-serv (legacy): Not configured."
Janos Follathb72c6782016-07-19 14:54:17 +0100157fi
Simon Butcher3104eec2020-02-26 15:29:40 +0000158echo
Janos Follathb72c6782016-07-19 14:54:17 +0100159
Simon Butcher3104eec2020-02-26 15:29:40 +0000160echo " * Installed asan versions:"
Simon Butcher679d2de2020-02-27 12:58:27 +0000161if type dpkg-query >/dev/null 2>/dev/null; then
162 if ! dpkg-query -f '${Status} ${Package}: ${Version}\n' -W 'libasan*' |
163 awk '$3 == "installed" && $4 !~ /-/ {print $4, $5}' |
164 grep .
165 then
166 echo " No asan versions installed."
167 fi
Janos Follathb72c6782016-07-19 14:54:17 +0100168else
Simon Butcher679d2de2020-02-27 12:58:27 +0000169 echo " Unable to determine the asan version without dpkg."
Janos Follathb72c6782016-07-19 14:54:17 +0100170fi
Janos Follathb72c6782016-07-19 14:54:17 +0100171echo