summaryrefslogtreecommitdiff
path: root/tests/endianness.sh
blob: 4f84a080bf9968915f9c23002dab42c1cb8d5521 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh -e
SCRATCH=scratch/$(basename $0 .sh)
PATCHELF="../src/patchelf"

for arch in ppc64 ppc64le; do
    rm -rf ${SCRATCH}
    mkdir -p ${SCRATCH}

    cp ${srcdir}/endianness/${arch}/main ${srcdir}/endianness/${arch}/libtest.so ${SCRATCH}/

    rpath="${PWD}/${SCRATCH}"

    # set rpath to scratch dir
    ${PATCHELF} --output ${SCRATCH}/main-rpath --set-rpath $rpath ${SCRATCH}/main

    # attempt to shrink rpath, should not result in empty rpath
    ${PATCHELF} --output ${SCRATCH}/main-shrunk --shrink-rpath --debug ${SCRATCH}/main-rpath 

    # check whether rpath is still present
    if ! ${PATCHELF} --print-rpath ${SCRATCH}/main-shrunk | grep -q "$rpath"; then
        echo "rpath was removed for ${arch}"
        exit 1
    fi
done