summaryrefslogtreecommitdiffstats
path: root/tests/set-interpreter-long.sh
blob: 179079543c025e951fec06ae95187d5438b1367c (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
25
26
27
28
29
#! /bin/sh -e

./simple

oldInterpreter=$(../src/patchelf --print-interpreter ./simple)
echo "current interpreter is $oldInterpreter"

echo "running with explicit interpreter..."
"$oldInterpreter" ./simple

rm -rf scratch
mkdir -p scratch

newInterpreter=$(pwd)/scratch/iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
cp simple scratch/
../src/patchelf --set-interpreter "$newInterpreter" scratch/simple

echo "running with missing interpreter..."
if scratch/simple; then
    echo "simple works, but it shouldn't"
    exit 1
fi

echo "running with new interpreter..."
ln -s "$oldInterpreter" "$newInterpreter"
scratch/simple

echo "running with explicit interpreter..."
"$oldInterpreter" scratch/simple