diff options
author | Qt by Nokia <qt-info@nokia.com> | 2011-04-27 12:05:43 +0200 |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-04-27 12:05:43 +0200 |
commit | 38be0d13830efd2d98281c645c3a60afe05ffece (patch) | |
tree | 6ea73f3ec77f7d153333779883e8120f82820abe /config.tests/unix/doubleformat.test |
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you
want to look at revision history older than this, please refer to the
Qt Git wiki for how to use Git history grafting. At the time of
writing, this wiki is located here:
http://qt.gitorious.org/qt/pages/GitIntroductionWithQt
If you have already performed the grafting and you don't see any
history beyond this commit, try running "git log" with the "--follow"
argument.
Branched from the monolithic repo, Qt master branch, at commit
896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'config.tests/unix/doubleformat.test')
-rwxr-xr-x | config.tests/unix/doubleformat.test | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/config.tests/unix/doubleformat.test b/config.tests/unix/doubleformat.test new file mode 100755 index 0000000000..996855372b --- /dev/null +++ b/config.tests/unix/doubleformat.test @@ -0,0 +1,63 @@ +#!/bin/sh + +QMKSPEC=$1 +VERBOSE=$2 +SRCDIR=$3 +OUTDIR=$4 + +# debuggery +[ "$VERBOSE" = "yes" ] && echo "Determining floating point word-order... ($*)" + +# build and run a test program +test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat" +"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 +cd "$OUTDIR/config.tests/unix/doubleformat" + +DOUBLEFORMAT="UNKNOWN" +[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1 + +if [ -f ./doubleformattest ]; then + : # nop +else + [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!" + exit 2 +fi + +# LE: strings | grep 0123ABCD0123ABCD +# BE: strings | grep DCBA3210DCBA3210 +# +# LE arm-swapped-dword-order: strings | grep ABCD0123ABCD0123 +# BE arm-swapped-dword-order: strings | grep 3210DCBA3210DCBA (untested) + + +if strings ./doubleformattest | grep "0123ABCD0123ABCD" >/dev/null 2>&1; then + [ "$VERBOSE" = "yes" ] && echo " Normal little endian format" + DOUBLEFORMAT="LITTLE" +elif strings ./doubleformattest | grep "ABCD0123ABCD0123" >/dev/null 2>&1; then + [ "$VERBOSE" = "yes" ] && echo " Swapped little endian format" + DOUBLEFORMAT="LITTLESWAPPED" +elif strings ./doubleformattest | grep "DCBA3210DCBA3210" >/dev/null 2>&1; then + [ "$VERBOSE" = "yes" ] && echo " Normal big endian format" + DOUBLEFORMAT="BIG" +elif strings ./doubleformattest | grep "3210DCBA3210DCBA" >/dev/null 2>&1; then + [ "$VERBOSE" = "yes" ] && echo " Swapped big endian format" + DOUBLEFORMAT="BIGSWAPPED" +fi + +# done +if [ "$DOUBLEFORMAT" = "LITTLE" ]; then + [ "$VERBOSE" = "yes" ] && echo "Using little endian." + exit 10 +elif [ "$DOUBLEFORMAT" = "BIG" ]; then + [ "$VERBOSE" = "yes" ] && echo "Using big endian." + exit 11 +elif [ "$DOUBLEFORMAT" = "LITTLESWAPPED" ]; then + [ "$VERBOSE" = "yes" ] && echo "Using swapped little endian." + exit 12 +elif [ "$DOUBLEFORMAT" = "BIGSWAPPED" ]; then + [ "$VERBOSE" = "yes" ] && echo "Using swapped big endian." + exit 13 +else + [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!" + exit 99 +fi |