summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog10
-rw-r--r--tests/asm-tst4.c7
-rw-r--r--tests/asm-tst5.c6
-rw-r--r--tests/asm-tst6.c6
-rwxr-xr-xtests/run-addr2line-alt-debugpath.sh4
-rwxr-xr-xtests/run-addrname-test.sh8
-rwxr-xr-xtests/run-prelink-addr-test.sh60
-rw-r--r--tests/test-subr.sh1
8 files changed, 63 insertions, 39 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 5616c740..5e29f821 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,15 @@
2017-05-04 Ulf Hermann <[email protected]>
+ * asm-tst4.c: Don't assume unix file system conventions.
+ * asm-tst5.c: Likewise.
+ * asm-tst6.c: Likewise.
+ * test-subr.sh: Define work_dir to be "pwd -W" or "pwd".
+ * run-addr2line-alt-debugpath.sh: Use $work_dir rather than $(pwd).
+ * run-addrname-test.sh: Likewise.
+ * run-prelink-addr-test.sh: Likewise.
+
+2017-05-04 Ulf Hermann <[email protected]>
+
* run-addr2line-test.sh: Add --strip-trailing-cr option to diff.
* run-readelf-test1.sh: Likewise.
* run-unstrip-n.sh: Likewise.
diff --git a/tests/asm-tst4.c b/tests/asm-tst4.c
index 52e9e20b..c076f6f3 100644
--- a/tests/asm-tst4.c
+++ b/tests/asm-tst4.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <sys/wait.h>
+#include <system.h>
static const char fname[] = "asm-tst4-out.o";
@@ -93,7 +94,11 @@ main (void)
}
if (result == 0)
- result = WEXITSTATUS (system ("../src/elflint -q asm-tst4-out.o"));
+ {
+ char command[128];
+ sprintf(command, "..%csrc%celflint -q asm-tst4-out.o", DIRSEP, DIRSEP);
+ result = WEXITSTATUS (system (command));
+ }
/* We don't need the file anymore. */
unlink (fname);
diff --git a/tests/asm-tst5.c b/tests/asm-tst5.c
index 5a29b01c..4db6d1f5 100644
--- a/tests/asm-tst5.c
+++ b/tests/asm-tst5.c
@@ -105,7 +105,11 @@ main (void)
}
if (result == 0)
- result = WEXITSTATUS (system ("../src/elflint -q asm-tst5-out.o"));
+ {
+ char command[128];
+ sprintf(command, "..%csrc%celflint -q asm-tst5-out.o", DIRSEP, DIRSEP);
+ result = WEXITSTATUS (system (command));
+ }
/* We don't need the file anymore. */
unlink (fname);
diff --git a/tests/asm-tst6.c b/tests/asm-tst6.c
index bd9b362b..34b5bc6c 100644
--- a/tests/asm-tst6.c
+++ b/tests/asm-tst6.c
@@ -139,7 +139,11 @@ main (void)
}
if (result == 0)
- result = WEXITSTATUS (system ("../src/elflint -q asm-tst6-out.o"));
+ {
+ char command[128];
+ sprintf(command, "..%csrc%celflint -q asm-tst6-out.o", DIRSEP, DIRSEP);
+ result = WEXITSTATUS (system (command));
+ }
/* We don't need the file anymore. */
unlink (fname);
diff --git a/tests/run-addr2line-alt-debugpath.sh b/tests/run-addr2line-alt-debugpath.sh
index b508700c..ac45bfbe 100755
--- a/tests/run-addr2line-alt-debugpath.sh
+++ b/tests/run-addr2line-alt-debugpath.sh
@@ -23,8 +23,8 @@ testfiles testfile-inlines
# Split off the debuginfo and put it under a separate subdir from the
# original binary. Use --debuginfo-path to connect the dots again.
# Note that we use separate subdirs/roots for the binaries and debug files.
-abs_test_bindir=$(pwd)/bindir
-abs_test_debugdir=$(pwd)/debugdir
+abs_test_bindir=$work_dir/bindir
+abs_test_debugdir=$work_dir/debugdir
mkdir ${abs_test_bindir}
mkdir ${abs_test_bindir}/bin
diff --git a/tests/run-addrname-test.sh b/tests/run-addrname-test.sh
index 90e19df7..69d81899 100755
--- a/tests/run-addrname-test.sh
+++ b/tests/run-addrname-test.sh
@@ -58,10 +58,10 @@ testfiles testfile12 testfile14
tempfiles testmaps
cat > testmaps <<EOF
-00400000-00401000 r-xp 00000000 fd:01 4006812 `pwd`/testfile14
-00500000-00501000 rw-p 00000000 fd:01 4006812 `pwd`/testfile14
-01000000-01001000 r-xp 00000000 fd:01 1234567 `pwd`/testfile12
-01100000-01011000 rw-p 00000000 fd:01 1234567 `pwd`/testfile12
+00400000-00401000 r-xp 00000000 fd:01 4006812 $work_dir/testfile14
+00500000-00501000 rw-p 00000000 fd:01 4006812 $work_dir/testfile14
+01000000-01001000 r-xp 00000000 fd:01 1234567 $work_dir/testfile12
+01100000-01011000 rw-p 00000000 fd:01 1234567 $work_dir/testfile12
2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0
2aaaaaae2000-2aaaaaae3000 rw-p 2aaaaaae2000 00:00 0
7fff61068000-7fff6107d000 rw-p 7ffffffea000 00:00 0 [stack]
diff --git a/tests/run-prelink-addr-test.sh b/tests/run-prelink-addr-test.sh
index 3398c0d1..da2807eb 100755
--- a/tests/run-prelink-addr-test.sh
+++ b/tests/run-prelink-addr-test.sh
@@ -36,12 +36,12 @@ tempfiles testmaps52-32 testfile52-32.noshdrs.so.debug
ln -snf testfile52-32.so.debug testfile52-32.noshdrs.so.debug
cat > testmaps52-32 <<EOF
-00111000-00112000 r-xp 00000000 fd:01 1 `pwd`/testfile52-32.so
-00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile52-32.so
-41000000-41001000 r-xp 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so
-41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile52-32.prelink.so
-42000000-42001000 r-xp 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so
-42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile52-32.noshdrs.so
+00111000-00112000 r-xp 00000000 fd:01 1 $work_dir/testfile52-32.so
+00112000-00113000 rw-p 00000000 fd:01 1 $work_dir/testfile52-32.so
+41000000-41001000 r-xp 00000000 fd:01 2 $work_dir/testfile52-32.prelink.so
+41001000-41002000 rw-p 00000000 fd:01 2 $work_dir/testfile52-32.prelink.so
+42000000-42001000 r-xp 00000000 fd:01 3 $work_dir/testfile52-32.noshdrs.so
+42001000-42002000 rw-p 00000000 fd:01 3 $work_dir/testfile52-32.noshdrs.so
EOF
# Prior to commit 1743d7f, libdwfl would fail on the second address,
@@ -65,15 +65,15 @@ tempfiles testmaps52-64 testfile52-64.noshdrs.so.debug
ln -snf testfile52-64.so.debug testfile52-64.noshdrs.so.debug
cat > testmaps52-64 <<EOF
-1000000000-1000001000 r-xp 00000000 fd:11 1 `pwd`/testfile52-64.so
-1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile52-64.so
-1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile52-64.so
-3000000000-3000001000 r-xp 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so
-3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile52-64.prelink.so
-3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile52-64.prelink.so
-3800000000-3800001000 r-xp 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so
-3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile52-64.noshdrs.so
-3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile52-64.noshdrs.so
+1000000000-1000001000 r-xp 00000000 fd:11 1 $work_dir/testfile52-64.so
+1000001000-1000200000 ---p 00001000 fd:11 1 $work_dir/testfile52-64.so
+1000200000-1000201000 rw-p 00000000 fd:11 1 $work_dir/testfile52-64.so
+3000000000-3000001000 r-xp 00000000 fd:11 2 $work_dir/testfile52-64.prelink.so
+3000001000-3000200000 ---p 00001000 fd:11 2 $work_dir/testfile52-64.prelink.so
+3000200000-3000201000 rw-p 00000000 fd:11 2 $work_dir/testfile52-64.prelink.so
+3800000000-3800001000 r-xp 00000000 fd:11 3 $work_dir/testfile52-64.noshdrs.so
+3800001000-3800200000 ---p 00001000 fd:11 3 $work_dir/testfile52-64.noshdrs.so
+3800200000-3800201000 rw-p 00000000 fd:11 3 $work_dir/testfile52-64.noshdrs.so
EOF
testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps52-64 \
@@ -151,12 +151,12 @@ tempfiles testmaps54-32
# this is testing finding the symbols in .dynsym via PT_DYNAMIC.
cat > testmaps54-32 <<EOF
-00111000-00112000 r--p 00000000 fd:01 1 `pwd`/testfile54-32.so
-00112000-00113000 rw-p 00000000 fd:01 1 `pwd`/testfile54-32.so
-41000000-41001000 r--p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so
-41001000-41002000 rw-p 00000000 fd:01 2 `pwd`/testfile54-32.prelink.so
-42000000-42001000 r--p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so
-42001000-42002000 rw-p 00000000 fd:01 3 `pwd`/testfile54-32.noshdrs.so
+00111000-00112000 r--p 00000000 fd:01 1 $work_dir/testfile54-32.so
+00112000-00113000 rw-p 00000000 fd:01 1 $work_dir/testfile54-32.so
+41000000-41001000 r--p 00000000 fd:01 2 $work_dir/testfile54-32.prelink.so
+41001000-41002000 rw-p 00000000 fd:01 2 $work_dir/testfile54-32.prelink.so
+42000000-42001000 r--p 00000000 fd:01 3 $work_dir/testfile54-32.noshdrs.so
+42001000-42002000 rw-p 00000000 fd:01 3 $work_dir/testfile54-32.noshdrs.so
EOF
testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps54-32 \
@@ -182,15 +182,15 @@ tempfiles testmaps54-64
# this is testing finding the symbols in .dynsym via PT_DYNAMIC.
cat > testmaps54-64 <<EOF
-1000000000-1000001000 r--p 00000000 fd:11 1 `pwd`/testfile54-64.so
-1000001000-1000200000 ---p 00001000 fd:11 1 `pwd`/testfile54-64.so
-1000200000-1000201000 rw-p 00000000 fd:11 1 `pwd`/testfile54-64.so
-3000000000-3000001000 r--p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so
-3000001000-3000200000 ---p 00001000 fd:11 2 `pwd`/testfile54-64.prelink.so
-3000200000-3000201000 rw-p 00000000 fd:11 2 `pwd`/testfile54-64.prelink.so
-3800000000-3800001000 r--p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so
-3800001000-3800200000 ---p 00001000 fd:11 3 `pwd`/testfile54-64.noshdrs.so
-3800200000-3800201000 rw-p 00000000 fd:11 3 `pwd`/testfile54-64.noshdrs.so
+1000000000-1000001000 r--p 00000000 fd:11 1 $work_dir/testfile54-64.so
+1000001000-1000200000 ---p 00001000 fd:11 1 $work_dir/testfile54-64.so
+1000200000-1000201000 rw-p 00000000 fd:11 1 $work_dir/testfile54-64.so
+3000000000-3000001000 r--p 00000000 fd:11 2 $work_dir/testfile54-64.prelink.so
+3000001000-3000200000 ---p 00001000 fd:11 2 $work_dir/testfile54-64.prelink.so
+3000200000-3000201000 rw-p 00000000 fd:11 2 $work_dir/testfile54-64.prelink.so
+3800000000-3800001000 r--p 00000000 fd:11 3 $work_dir/testfile54-64.noshdrs.so
+3800001000-3800200000 ---p 00001000 fd:11 3 $work_dir/testfile54-64.noshdrs.so
+3800200000-3800201000 rw-p 00000000 fd:11 3 $work_dir/testfile54-64.noshdrs.so
EOF
testrun_compare ${abs_top_builddir}/src/addr2line -S -M testmaps54-64 \
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index 8bea18ca..60ff8cd8 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -26,6 +26,7 @@ set -e
test_dir="test-$$"
mkdir -p "$test_dir"
cd "$test_dir"
+work_dir=`pwd -W 2> /dev/null || pwd`
#LC_ALL=C
#export LC_ALL