Changeset 59564e6 in mainline for tools/toolchain.sh


Ignore:
Timestamp:
2018-12-21T20:42:09Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
accdbd8
Parents:
a49c39c8 (diff), cb15b49c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jakub Jermář <jakub@…> (2018-12-21 20:42:09)
git-committer:
GitHub <noreply@…> (2018-12-21 20:42:09)
Message:

Merge pull request #138 from matthieuriolo/ticket_569

Adds a new flag for testing the installed version against the version in toolchain.sh.

./tools/toolchain.sh —test-version
./tools/toolchain.sh —test-version all
./tools/toolchain.sh —test-version ia32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/toolchain.sh

    ra49c39c8 r59564e6  
    6161        echo "Syntax:"
    6262        echo " $0 [--no-install] [--non-helenos-target] <platform>"
     63        echo " $0 --test-version [<platform>]"
    6364        echo
    6465        echo "Possible target platforms are:"
     
    9596}
    9697
     98test_version() {
     99        echo "Cross-compiler toolchain build script"
     100        echo
     101        echo "Start testing the version of the installed software"
     102        echo
     103       
     104        if [ -z "$1" ] || [ "$1" == "all" ] ; then
     105                PLATFORMS=("amd64" "arm32" "ia32" "ia64" "mips32" "mips32eb" "ppc32" "riscv64" "sparc64")
     106        else
     107                PLATFORMS=("$1")
     108        fi
     109       
     110       
     111        if [ -z "${CROSS_PREFIX}" ] ; then
     112                CROSS_PREFIX="/usr/local/cross"
     113        fi
     114
     115        for i in "${PLATFORMS[@]}"
     116        do
     117                PLATFORM="$i"
     118                set_target_from_platform "$PLATFORM"
     119                PREFIX="${CROSS_PREFIX}/bin/${HELENOS_TARGET}"
     120
     121                echo "== $PLATFORM =="
     122                test_app_version "Binutils" "ld" "GNU\ ld\ \(GNU\ Binutils\)\ ((\.|[0-9])+)" "$BINUTILS_VERSION"
     123                test_app_version "GCC" "gcc" "gcc\ version\ ((\.|[0-9])+)" "$GCC_VERSION"
     124                test_app_version "GDB" "gdb" "GNU\ gdb\ \(GDB\)\s+((\.|[0-9])+)" "$GDB_VERSION"
     125        done
     126
     127        exit
     128}
     129
     130test_app_version() {
     131        PKGNAME="$1"
     132        APPNAME="$2"
     133        REGEX="$3"
     134        INS_VERSION="$4"
     135
     136
     137        APP="${PREFIX}-${APPNAME}"
     138        if [ ! -e $APP ]; then
     139                echo "- $PKGNAME is missing"
     140        else
     141                {
     142                        OUT=$(${APP} -v 2>&1)
     143                } &> /dev/null
     144
     145                if [[ "$OUT" =~ $REGEX ]]; then
     146                VERSION="${BASH_REMATCH[1]}"
     147                if [ "$INS_VERSION" = "$VERSION" ]; then
     148                        echo "+ $PKGNAME is uptodate ($INS_VERSION)"
     149                else
     150                        echo "- $PKGNAME ($VERSION) is outdated ($INS_VERSION)"
     151                fi
     152            else
     153                echo "- $PKGNAME Unexpected output"
     154            fi
     155        fi
     156}
     157
     158
     159
    97160change_title() {
    98161        echo -en "\e]0;$1\a"
     
    408471while [ "$#" -gt 1 ] ; do
    409472        case "$1" in
     473                --test-version)
     474                        test_version "$2"
     475                        exit
     476                        ;;
    410477                --no-install)
    411478                        REAL_INSTALL=false
     
    427494
    428495case "$1" in
     496        --test-version)
     497                test_version
     498                ;;
    429499        amd64|arm32|ia32|ia64|mips32|mips32eb|ppc32|riscv64|sparc64)
    430500                prepare
Note: See TracChangeset for help on using the changeset viewer.