If -z common-page-size and -z max-page-size are not recognized by the linker then the linkhuge_rw binary won't be suitably aligned and failures are expected.
Signed-off-by: Adam Litke <[EMAIL PROTECTED]> --- tests/Makefile | 2 +- tests/linkhuge_rw.sh | 21 +++++++++++++++++++++ tests/run_tests.sh | 28 ++++++++++++++-------------- 3 files changed, 36 insertions(+), 15 deletions(-) create mode 100755 tests/linkhuge_rw.sh diff --git a/tests/Makefile b/tests/Makefile index 009f75f..f56615b 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -16,7 +16,7 @@ LDSCRIPT_TESTS = zero_filesize_segment HUGELINK_TESTS = linkhuge linkhuge_nofd linkshare HUGELINK_RW_TESTS = linkhuge_rw STRESS_TESTS = mmap-gettest mmap-cow shm-gettest shm-getraw shm-fork -WRAPPERS = quota +WRAPPERS = quota linkhuge_rw HELPERS = get_hugetlbfs_path compare_kvers HELPER_LIBS = libheapshrink.so BADTOOLCHAIN = bad-toolchain.sh diff --git a/tests/linkhuge_rw.sh b/tests/linkhuge_rw.sh new file mode 100755 index 0000000..8dda671 --- /dev/null +++ b/tests/linkhuge_rw.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +. wrapper-utils.sh + +# The linker options '-zcommon-page-size' and '-zmax-page-size' are not +# supported in binutils older than 2.18. This will result in binaries that +# are not correctly aligned and lead to test failures. + +if [ -n "$HUGETLB_ELFMAP" -a "$HUGETLB_ELFMAP" != "no" ]; then + REMAPPING="on" +fi + +# If the linker supports these options, they will appear in 'ld --help' output. +ld --help | grep -q -- "-z max-page-size" +if [ $? -eq 1 -a "$REMAPPING" = "on" ]; then + EXP_RC=$RC_FAIL +else + EXP_RC=$RC_PASS +fi + +exec_and_check $EXP_RC linkhuge_rw "$@" diff --git a/tests/run_tests.sh b/tests/run_tests.sh index 9064451..21a43f9 100755 --- a/tests/run_tests.sh +++ b/tests/run_tests.sh @@ -182,16 +182,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 + run_test linkhuge_rw.sh + run_test HUGETLB_ELFMAP=R linkhuge_rw.sh + run_test HUGETLB_ELFMAP=W linkhuge_rw.sh + run_test HUGETLB_ELFMAP=RW linkhuge_rw.sh + run_test HUGETLB_ELFMAP=no linkhuge_rw.sh # 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 + run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=R linkhuge_rw.sh + run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=W linkhuge_rw.sh + run_test HUGETLB_MINIMAL_COPY=no HUGETLB_ELFMAP=RW linkhuge_rw.sh } elfshare_test () { @@ -232,14 +232,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 + run_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw.sh + run_test HUGETLB_ELFMAP=R HUGETLB_SHARE=1 linkhuge_rw.sh clear_hpages - run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw - run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw + run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw.sh + run_test HUGETLB_ELFMAP=W HUGETLB_SHARE=1 linkhuge_rw.sh clear_hpages - run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw - run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw + run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw.sh + run_test HUGETLB_ELFMAP=RW HUGETLB_SHARE=1 linkhuge_rw.sh clear_hpages } ------------------------------------------------------------------------- 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 Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel