scripts/build/test_suite.sh
author Daniel Price <daniel.price@gmail.com>
Tue Nov 20 16:59:17 2012 -0800 (2012-11-20)
changeset 3126 333d3e40cbd1
permissions -rw-r--r--
scripts: refine static linking check to better guide the user

The current mechanism to check if static linking is possible, and the mesage
displayed on failure, can be puzzling to the unsuspecting user.

Also, the current implementation is not using the existing infrastructure,
and is thus difficult to enhance with new tests.

So, switch to using the standard CT_DoExecLog infra, and use four tests to
check for the host compiler:
- check we can run it
- check it can build a trivial program
- check it can statically link that program
- check if it statically link with libstdc++

That should cover most of the problems. Hopefully.

(At the same time, fix a typo in a comment)

Signed-off-by: Daniel Price <daniel.price@gmail.com>
[yann.morin.1998@free.fr: split original patch for self-contained changes]
[yann.morin.1998@free.fr: use steps to better see gcc's output]
[yann.morin.1998@free.fr: commit log]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <163f86b5216fc08c672a.1353459722@nipigon.dssd.com>
Patchwork-Id: 200536
mgl@1965
     1
# Wrapper to build the test suite facilities
mgl@1965
     2
#
mgl@1965
     3
# Current assumption: test suites are independent of each other
mgl@1965
     4
#                     - no order handling required.
mgl@1965
     5
mgl@1965
     6
# List all test suite facilities, and parse their scripts
mgl@1965
     7
CT_TEST_SUITE_FACILITY_LIST=
mgl@1965
     8
for f in "${CT_LIB_DIR}/scripts/build/test_suite/"*.sh; do
mgl@1965
     9
    _f="$(basename "${f}" .sh)"
mgl@1965
    10
    __f="CT_TEST_SUITE_${_f}"
mgl@1965
    11
    __f=`echo ${__f} | tr "[:lower:]" "[:upper:]"`
mgl@1965
    12
    if [ "${!__f}" = "y" ]; then
mgl@1965
    13
        CT_DoLog DEBUG "Enabling test suite '${_f}'"
mgl@1965
    14
        . "${f}"
mgl@1965
    15
        CT_TEST_SUITE_FACILITY_LIST="${CT_TEST_SUITE_FACILITY_LIST} ${_f}"
mgl@1965
    16
    else
mgl@1965
    17
        CT_DoLog DEBUG "Disabling test suite '${_f}'"
mgl@1965
    18
    fi
mgl@1965
    19
done
mgl@1965
    20
mgl@1965
    21
# Download the test suite facilities
mgl@1965
    22
do_test_suite_get() {
mgl@1965
    23
    for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
mgl@1965
    24
        do_test_suite_${f}_get
mgl@1965
    25
    done
mgl@1965
    26
}
mgl@1965
    27
mgl@1965
    28
# Extract and patch the test suite facilities
mgl@1965
    29
do_test_suite_extract() {
mgl@1965
    30
    for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
mgl@1965
    31
        do_test_suite_${f}_extract
mgl@1965
    32
    done
mgl@1965
    33
}
mgl@1965
    34
mgl@1965
    35
# Build the test suite facilities
mgl@1965
    36
do_test_suite() {
mgl@1965
    37
    for f in ${CT_TEST_SUITE_FACILITY_LIST}; do
mgl@1965
    38
        do_test_suite_${f}_build
mgl@1965
    39
    done
mgl@1965
    40
}
mgl@1965
    41