| 1 | #!/bin/sh |
| 2 | ### quick sanity test for the binutils. |
| 3 | ### |
| 4 | # This file was written K. Richard Pixley. |
| 5 | # Copyright 2007 Free Software Foundation, Inc. |
| 6 | |
| 7 | # This program is part of GNU Binutils. |
| 8 | |
| 9 | # This program is free software; you can redistribute it and/or modify |
| 10 | # it under the terms of the GNU General Public License as published by |
| 11 | # the Free Software Foundation; either version 3 of the License, or |
| 12 | # (at your option) any later version. |
| 13 | |
| 14 | # This program is distributed in the hope that it will be useful, |
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | # GNU General Public License for more details. |
| 18 | |
| 19 | # You should have received a copy of the GNU General Public License |
| 20 | # along with this program; if not, write to the Free Software |
| 21 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
| 22 | # 02110-1301, USA. */ |
| 23 | |
| 24 | ### fail on errors |
| 25 | set -e |
| 26 | |
| 27 | ### first arg is directory in which binaries to be tested reside. |
| 28 | case "$1" in |
| 29 | "") BIN=. ;; |
| 30 | *) BIN="$1" ;; |
| 31 | esac |
| 32 | |
| 33 | ### size |
| 34 | for i in size objdump nm ar strip ranlib ; do |
| 35 | ${BIN}/size ${BIN}/$i > /dev/null |
| 36 | done |
| 37 | |
| 38 | ### objdump |
| 39 | for i in size objdump nm ar strip ranlib ; do |
| 40 | ${BIN}/objdump -ahifdrtxsl ${BIN}/$i > /dev/null |
| 41 | done |
| 42 | |
| 43 | ### nm |
| 44 | for i in size objdump nm ar strip ranlib ; do |
| 45 | ${BIN}/nm ${BIN}/$i > /dev/null |
| 46 | done |
| 47 | |
| 48 | ### strip |
| 49 | TMPDIR=./binutils-$$ |
| 50 | mkdir ${TMPDIR} |
| 51 | |
| 52 | cp ${BIN}/strip ${TMPDIR}/strip |
| 53 | |
| 54 | for i in size objdump nm ar ranlib ; do |
| 55 | cp ${BIN}/$i ${TMPDIR}/$i |
| 56 | ${BIN}/strip ${TMPDIR}/$i |
| 57 | cp ${BIN}/$i ${TMPDIR}/$i |
| 58 | ${TMPDIR}/strip ${TMPDIR}/$i |
| 59 | done |
| 60 | |
| 61 | ### ar |
| 62 | |
| 63 | ### ranlib |
| 64 | |
| 65 | rm -rf ${TMPDIR} |
| 66 | |
| 67 | exit 0 |