summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Vetrov <vvvvvv@google.com>2023-11-20 17:44:48 +0000
committerMark Wielaard <mark@klomp.org>2023-11-21 14:01:29 +0100
commite54af3a5a78dd9e0502a9ac4050098f6d8ed6506 (patch)
tree1f2da476168f536d6444f567c9f1a5cb935249ed
parent0ab5a3eb4122f36cbaff259e7a0a3f9d014cb6f7 (diff)
tests: Add test for duplicate entries in archive
Test dwfl-report-offline-memory against an archive that contains non-relocatable ELFs with the same name and contents. * tests/test-ar-duplicates.a.bz2: New test file. * tests/run-dwfl-report-offline-memory.sh: Test new test-ar-duplicates.a.bz2. * tests/Makefile.am (EXTRA_DIST): Add test-ar-duplicates.a.bz2. Signed-off-by: Aleksei Vetrov <vvvvvv@google.com>
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/run-dwfl-report-offline-memory.sh7
-rw-r--r--tests/test-ar-duplicates.a.bz2bin0 -> 783 bytes
3 files changed, 9 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7fb8efb1..80f6cb59 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -632,7 +632,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
testfile_nvidia_linemap.bz2 \
testfile-largealign.o.bz2 run-strip-largealign.sh \
- run-funcretval++11.sh
+ run-funcretval++11.sh \
+ test-ar-duplicates.a.bz2
if USE_VALGRIND
diff --git a/tests/run-dwfl-report-offline-memory.sh b/tests/run-dwfl-report-offline-memory.sh
index 644a45dc..85f43f53 100755
--- a/tests/run-dwfl-report-offline-memory.sh
+++ b/tests/run-dwfl-report-offline-memory.sh
@@ -20,7 +20,14 @@
testfiles testfile-dwfl-report-elf-align-shlib.so
testfiles testarchive64.a
+# echo "int _start(void) { return 0; }" > test.c
+# gcc test.c -nostdlib -static -o test.o
+# ar -r test-ar-duplicates.a test.o test.o test.o
+# bzip2 -zf test-ar-duplicates.a
+testfiles test-ar-duplicates.a
+
testrun ${abs_builddir}/dwfl-report-offline-memory ./testfile-dwfl-report-elf-align-shlib.so 1
testrun ${abs_builddir}/dwfl-report-offline-memory ./testarchive64.a 3
+testrun ${abs_builddir}/dwfl-report-offline-memory ./test-ar-duplicates.a 1
exit 0
diff --git a/tests/test-ar-duplicates.a.bz2 b/tests/test-ar-duplicates.a.bz2
new file mode 100644
index 00000000..e8168c6b
--- /dev/null
+++ b/tests/test-ar-duplicates.a.bz2
Binary files differ