Changeset 4aba581 in mainline for tools/toolchain.sh


Ignore:
Timestamp:
2018-11-30T23:52:56Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cb15b49c
Parents:
ea4910b
Message:

implementing a test function for the different platforms

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    rea4910b r4aba581  
    9595}
    9696
     97test_version() {
     98        echo "Cross-compiler toolchain build script"
     99        echo
     100        echo "Start testing the version of the installed software"
     101        echo
     102
     103        PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     104       
     105        if [ -z "${CROSS_PREFIX}" ] ; then
     106                CROSS_PREFIX="/usr/local/cross"
     107        fi
     108
     109        for i in "${PLATFORMS[@]}"
     110        do
     111                PLATFORM="$i"
     112                set_target_from_platform "$PLATFORM"
     113                PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}"
     114
     115                echo "== $PLATFORM =="
     116                test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
     117                test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
     118                test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
     119        done
     120
     121        exit
     122}
     123
     124test_app_version() {
     125        PKGNAME="$1"
     126        APPNAME="$2"
     127        REGEX="$3"
     128        INS_VERSION="$4"
     129
     130
     131        APP="${PREFIX}-${APPNAME}"
     132        if [ ! -e $APP ]; then
     133                echo "- $PKGNAME is missing"
     134        else
     135                {
     136                        OUT=$(${APP} -v 2>&1)
     137                } &> /dev/null
     138
     139                if [[ "$OUT" =~ $REGEX ]]; then
     140                VERSION="${BASH_REMATCH[1]}"
     141                if [ "$INS_VERSION" = "$VERSION" ]; then
     142                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     143                else
     144                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     145                fi
     146            else
     147                echo "- $PKGNAME Unexpected output"
     148            fi
     149        fi
     150}
     151
     152
     153
    97154change_title() {
    98155        echo -en "\e]0;$1\a"
     
    427484
    428485case "$1" in
     486        "--test-version")
     487                test_version
     488                ;;
    429489        amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    430490                prepare
Note: See TracChangeset for help on using the changeset viewer.