On Tue, 2008-07-29 at 19:41 +0100, Mel Gorman wrote:
> Regression tests of 2.0-pre1 on an older distro are reporting FAIL for the
> ELFMAP-related tests. As the version of binutils is too old to support the
> feature, these are not true failures. "Expected FAILs" are confusing as it
> gets difficult to tell what a real and expected failure is over time. This
> patch identifies when binutils is too old and skips the ELFMAP tests.
> 
> Comments?
> 
> Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
> --- 
>  run_tests.sh |   57 +++++++++++++++++++++++++++++++++++++++++----------------
>  1 file changed, 41 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index c98179d..1327de6 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -49,6 +49,21 @@ function check_linkhuge_tests() {
>      fi
>  }
> 
> +function check_elfmap_tests() {
> +    # Binutils 2.17 or later are required for the ELFMAP tests to complete
> +    # successfully. If the version is too old, we do not bother running the
> +    # tests as they would report FAIL when it's not a true failure
> +
> +    ELFMAP_SKIP=0
> +    BINUTILS_VERSION=`ld -v | sed -e 's/[a-zA-Z() \t]//g'`
> +    MAJOR=`echo $BINUTILS_VERSION | cut -d. -f1`
> +    MINOR=`echo $BINUTILS_VERSION | cut -d. -f2`
> +
> +    if [ $MAJOR -lt 2 ] || [ $MAJOR -eq 2 -a $MINOR -lt 17 ]; then
> +        ELFMAP_SKIP=1
> +    fi
> +}

Hmm.  It isn't actually invalid to run the old linkhuge tests in all
cases with binutils 2.17 or newer.  In fact, the only place I know that
the linker scripts are broken is powerpc with binutils 2.17 or newer.
The reason this combination doesn't work is because the system ldscripts
began using the "SPECIAL" keyword.  I would suggest the following
function (from an earlier patch posted by me) to determine whether to
skip the linkhuge tests:

+# Up-front checks for the remapping test cases:
+function check_linkhuge_tests() {
+    # In some circumstances, our linker scripts are known to be broken and
+    # they will produce binaries with undefined runtime behavior.  In those
+    # cases don't bother running the xNNN.linkhuge tests.  This checks if the
+    # system linker scripts use the SPECIAL keyword (for placing the got and
+    # plt).  Our linker scripts do not use SPECIAL and are thus broken when the
+    # system scripts use it.
+    ld --verbose | grep -q SPECIAL
+    if [ $? -eq 0 ]; then
+        LINKHUGE_SKIP=1
+    fi
+}

>  run_test_bits () {
>      BITS=$1
>      shift
> @@ -79,6 +94,14 @@ maybe_run_linkhuge_test () {
>      fi
>  }
> 
> +maybe_run_elfmap_test () {
> +    if [ "$ELFMAP_SKIP" != "1" ]; then
> +        run_test "$@"
> +    else
> +        skip_test "$@"
> +    fi
> +}
> +
>  preload_test () {
>      run_test LD_PRELOAD=libhugetlbfs.so "$@"
>  }
> @@ -104,16 +127,16 @@ elflink_test () {
> 
>  elflink_rw_test() {
>      # Basic tests: None, Read-only, Write-only, Read-Write, exlicit disable
> -    run_test linkhuge_rw
> -    run_test HUGETLB_ELFMAP=R linkhuge_rw
> -    run_test HUGETLB_ELFMAP=W linkhuge_rw
> -    run_test HUGETLB_ELFMAP=RW linkhuge_rw
> -    run_test HUGETLB_ELFMAP=no linkhuge_rw
> +    maybe_run_elfmap_test linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=R linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=W linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=RW linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=no linkhuge_rw
> 
>      # Test we don't blow up if HUGETLB_MINIMAL_COPY is disabled
> -    run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=R linkhuge_rw
> -    run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=W linkhuge_rw
> -    run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=RW linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=R 
> linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=W 
> linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=RW 
> linkhuge_rw
>  }
> 
>  elfshare_test () {
> @@ -154,14 +177,14 @@ elflink_and_share_test () {
> 
>  elflink_rw_and_share_test () {
>      clear_hpages
> -    run_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw
> -    run_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw
>      clear_hpages
> -    run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw
> -    run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw
>      clear_hpages
> -    run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw
> -    run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw
> +    maybe_run_elfmap_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw
>      clear_hpages
>  }
> 
> @@ -251,6 +274,8 @@ functional_tests () {
> 
>  # Run the remapping tests' up-front checks
>  check_linkhuge_tests
> +check_elfmap_tests
> +
>  # Original elflink tests
>      elflink_test HUGETLB_VERBOSE=0 linkhuge_nofd # Lib error msgs expected
>      elflink_test linkhuge
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Libhugetlbfs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
> 
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to