]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: Add test for duplicate entries in archive
authorAleksei Vetrov <vvvvvv@google.com>
Mon, 20 Nov 2023 17:44:48 +0000 (17:44 +0000)
committerMark Wielaard <mark@klomp.org>
Tue, 21 Nov 2023 13:01:29 +0000 (14:01 +0100)
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>
tests/Makefile.am
tests/run-dwfl-report-offline-memory.sh
tests/test-ar-duplicates.a.bz2 [new file with mode: 0644]

index 7fb8efb13aafabaa14114ca256e92452be59a52b..80f6cb594fe5e14ea2c7d9b97dab58fd759c8fa3 100644 (file)
@@ -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
index 644a45dce9ad2b91c7b06b50d30fe0884318e158..85f43f536f4f0427ccd4cc6c29af12a695f03169 100755 (executable)
 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 (file)
index 0000000..e8168c6
Binary files /dev/null and b/tests/test-ar-duplicates.a.bz2 differ