Skip to content

Commit b92e442

Browse files
author
deadwood
committed
Add test for --add-debug-tag argument
1 parent 86a2cd8 commit b92e442

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

tests/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ src_TESTS = \
4040
set-empty-rpath.sh \
4141
phdr-corruption.sh \
4242
replace-needed.sh \
43-
replace-add-needed.sh
43+
replace-add-needed.sh \
44+
add-debug-tag.sh
4445

4546
build_TESTS = \
4647
$(no_rpath_arch_TESTS)

tests/add-debug-tag.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#! /bin/sh -e
2+
SCRATCH=scratch/$(basename $0 .sh)
3+
4+
rm -rf ${SCRATCH}
5+
mkdir -p ${SCRATCH}
6+
7+
cp libsimple.so ${SCRATCH}/
8+
9+
# check there is no DT_DEBUG tag
10+
debugTag=$(readelf -d ${SCRATCH}/libsimple.so)
11+
echo ".dynamic before: $debugTag"
12+
if echo "$debugTag" | grep -q DEBUG; then
13+
echo "failed --add-debug-tag test. Expected no line with (DEBUG), got: $debugTag"
14+
exit 1
15+
fi
16+
17+
# set DT_DEBUG
18+
../src/patchelf --add-debug-tag ${SCRATCH}/libsimple.so
19+
20+
# check there is DT_DEBUG tag
21+
debugTag=$(readelf -d ${SCRATCH}/libsimple.so)
22+
echo ".dynamic before: $debugTag"
23+
if ! echo "$debugTag" | grep -q DEBUG; then
24+
echo "failed --add-debug-tag test. Expected line with (DEBUG), got: $debugTag"
25+
exit 1
26+
fi

0 commit comments

Comments
 (0)