On Thu, 2008-07-31 at 20:47 +0100, Mel Gorman wrote:
> Currently some of the linkhuge scripts are skipped in the event the
> keyboard SPECIAL is found in ld --verbose. Instead of skipping the tests,
> this will run them. However, if the test fails the user will be told it is
> an expected failure.
>
> Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
Nack.
The reason we skip running these tests is because one side-effect of
broken linker scripts wrt the SPECIAL keyword is that we end up with PLT
corruption and, therefore, undefined program behavior. I was observing
a situation where a function call was being misdirected to getchar() and
thus causing the test to wait for the Enter key before subsequently
failing. When SPECIAL is in use, we simply cannot trust running these.
> ---
> tests/Makefile | 10 ++++++-
> tests/run_tests.sh | 52 ++++++++++----------------------------
> tests/verifyresults-linkhuge.sh | 22 ++++++++++++++++
> 3 files changed, 45 insertions(+), 39 deletions(-)
> create mode 100644 tests/verifyresults-linkhuge.sh
>
> diff --git a/tests/Makefile b/tests/Makefile
> index b723db7..24c438d 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -65,7 +65,15 @@ ifdef CC64
> ALLTESTS += $(TESTS_64:%=obj64/%)
> endif
>
> -all: $(ALLTESTS) $(ALLHELPERS) $(ALLHELPERLIBS)
> +# Setup symbolic links to duplicate verification scripts
> +symlink_verifydups: verifyresults-linkhuge.sh
> + for LINK in linkhuge_nofd linkshare; do \
> + if [ ! -e verifyresults-$$LINK.sh ]; then \
> + ln -s verifyresults-linkhuge.sh
> verifyresults-$$LINK.sh; \
> + fi \
> + done
> +
> +all: symlink_verifydups $(ALLTESTS) $(ALLHELPERS) $(ALLHELPERLIBS)
>
> obj32/%.o: %.c
> @$(VECHO) CC32 $@
> diff --git a/tests/run_tests.sh b/tests/run_tests.sh
> index a08eecb..b8094b3 100755
> --- a/tests/run_tests.sh
> +++ b/tests/run_tests.sh
> @@ -35,20 +35,6 @@ HPAGE_SIZE=$(grep 'Hugepagesize:' /proc/meminfo | awk
> '{print $2}')
> [ -z "$HPAGE_SIZE" ] && HPAGE_SIZE=0
> HPAGE_SIZE=$(( $HPAGE_SIZE * 1024 ))
>
> -# 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
> @@ -98,14 +84,6 @@ skip_test () {
> echo "$@: SKIPPED"
> }
>
> -maybe_run_linkhuge_test () {
> - if [ "$LINKHUGE_SKIP" != "1" ]; then
> - run_test "$@"
> - else
> - skip_test "$@"
> - fi
> -}
> -
> preload_test () {
> run_test LD_PRELOAD=libhugetlbfs.so "$@"
> }
> @@ -119,14 +97,14 @@ elflink_test () {
> run_test "$@" "$baseprog"
> # Test we don't blow up if not linked for hugepage
> preload_test "$@" "$baseprog"
> - maybe_run_linkhuge_test "$@" "xB.$baseprog"
> - maybe_run_linkhuge_test "$@" "xBDT.$baseprog"
> + run_test "$@" "xB.$baseprog"
> + run_test "$@" "xBDT.$baseprog"
> # Test we don't blow up if HUGETLB_MINIMAL_COPY is diabled
> - maybe_run_linkhuge_test HUGETLB_MINIMAL_COPY=no "$@" "xB.$baseprog"
> - maybe_run_linkhuge_test HUGETLB_MINIMAL_COPY=no "$@" "xBDT.$baseprog"
> + run_test HUGETLB_MINIMAL_COPY=no "$@" "xB.$baseprog"
> + run_test HUGETLB_MINIMAL_COPY=no "$@" "xBDT.$baseprog"
> # Test that HUGETLB_ELFMAP=no inhibits remapping as intended
> - maybe_run_linkhuge_test HUGETLB_ELFMAP=no "$@" "xB.$baseprog"
> - maybe_run_linkhuge_test HUGETLB_ELFMAP=no "$@" "xBDT.$baseprog"
> + run_test HUGETLB_ELFMAP=no "$@" "xB.$baseprog"
> + run_test HUGETLB_ELFMAP=no "$@" "xBDT.$baseprog"
> }
>
> elflink_rw_test() {
> @@ -153,12 +131,12 @@ elfshare_test () {
> # sharefiles before and after in the first set of runs, but leave
> # them there in the second:
> clear_hpages
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> clear_hpages
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> clear_hpages
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> clear_hpages
> }
>
> @@ -171,11 +149,11 @@ elflink_and_share_test () {
> # Run each elflink test pair independently - clean up the sharefiles
> # before and after each pair
> clear_hpages
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xB.$baseprog"
> clear_hpages
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> - maybe_run_linkhuge_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> + run_test HUGETLB_SHARE=1 "$@" "xBDT.$baseprog"
> clear_hpages
> }
>
> @@ -276,8 +254,6 @@ functional_tests () {
> run_test LD_PRELOAD="libhugetlbfs.so libheapshrink.so"
> HUGETLB_MORECORE=yes HUGETLB_MORECORE_SHRINK=yes heapshrink
> run_test HUGETLB_VERBOSE=1 HUGETLB_MORECORE=yes heap-overflow # warnings
> expected
>
> -# Run the remapping tests' up-front checks
> -check_linkhuge_tests
> # Original elflink tests
> elflink_test HUGETLB_VERBOSE=0 linkhuge_nofd # Lib error msgs expected
> elflink_test linkhuge
> diff --git a/tests/verifyresults-linkhuge.sh b/tests/verifyresults-linkhuge.sh
> new file mode 100644
> index 0000000..2e5ecb0
> --- /dev/null
> +++ b/tests/verifyresults-linkhuge.sh
> @@ -0,0 +1,22 @@
> +#!/bin/bash
> +#
> +# In some circumstances, our linker scripts are known to be broken and
> +# they will produce binaries with undefined runtime behavior. 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 so tell the user any FAIL is expected.
> +
> +# Check that we passed as expected
> +if [ $1 -eq 0 ]; then
> + exit 0
> +fi
> +
> +# If we failed and it is due to ld, it is expected
> +ld --verbose | grep -q SPECIAL > /dev/null
> +if [ $? -eq 0 ]; then
> + echo System linker scripts use SPECIAL which is known to be broken
> + exit 0
> +fi
> +
> +# Otherwise, this is unexpected breakage
> +exit 0
--
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