source: trunk/config.tests/unix/doubleformat.test@ 865

Last change on this file since 865 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/sh
2
3QMKSPEC=$1
4VERBOSE=$2
5SRCDIR=$3
6OUTDIR=$4
7
8# debuggery
9[ "$VERBOSE" = "yes" ] && echo "Determining floating point word-order... ($*)"
10
11# build and run a test program
12test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat"
13"$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
14cd "$OUTDIR/config.tests/unix/doubleformat"
15
16DOUBLEFORMAT="UNKNOWN"
17[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1
18
19if [ -f ./doubleformattest ]; then
20 : # nop
21else
22 [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!"
23 exit 2
24fi
25
26# LE: strings | grep 0123ABCD0123ABCD
27# BE: strings | grep DCBA3210DCBA3210
28#
29# LE arm-swapped-dword-order: strings | grep ABCD0123ABCD0123
30# BE arm-swapped-dword-order: strings | grep 3210DCBA3210DCBA (untested)
31
32
33if strings ./doubleformattest | grep "0123ABCD0123ABCD" >/dev/null 2>&1; then
34 [ "$VERBOSE" = "yes" ] && echo " Normal little endian format"
35 DOUBLEFORMAT="LITTLE"
36elif strings ./doubleformattest | grep "ABCD0123ABCD0123" >/dev/null 2>&1; then
37 [ "$VERBOSE" = "yes" ] && echo " Swapped little endian format"
38 DOUBLEFORMAT="LITTLESWAPPED"
39elif strings ./doubleformattest | grep "DCBA3210DCBA3210" >/dev/null 2>&1; then
40 [ "$VERBOSE" = "yes" ] && echo " Normal big endian format"
41 DOUBLEFORMAT="BIG"
42elif strings ./doubleformattest | grep "3210DCBA3210DCBA" >/dev/null 2>&1; then
43 [ "$VERBOSE" = "yes" ] && echo " Swapped big endian format"
44 DOUBLEFORMAT="BIGSWAPPED"
45fi
46
47# done
48if [ "$DOUBLEFORMAT" = "LITTLE" ]; then
49 [ "$VERBOSE" = "yes" ] && echo "Using little endian."
50 exit 10
51elif [ "$DOUBLEFORMAT" = "BIG" ]; then
52 [ "$VERBOSE" = "yes" ] && echo "Using big endian."
53 exit 11
54elif [ "$DOUBLEFORMAT" = "LITTLESWAPPED" ]; then
55 [ "$VERBOSE" = "yes" ] && echo "Using swapped little endian."
56 exit 12
57elif [ "$DOUBLEFORMAT" = "BIGSWAPPED" ]; then
58 [ "$VERBOSE" = "yes" ] && echo "Using swapped big endian."
59 exit 13
60else
61 [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!"
62 exit 99
63fi
Note: See TracBrowser for help on using the repository browser.