The following changes since commit e65d91d21cb09d83b001fef9435e576ba447db32: libelf: Correct overflow check in note_xlate. (2019-01-16 12:25:57 +0100) are available in the git repository at: https://codereview.qt-project.org/qt-creator/elfutils changes/37/250337/3 for you to fetch changes up to ce0ea06597bbba665ad6c26cef50d20895d246de: Use separate files for strip outputs (2019-01-18 13:53:52 +0100) ---------------------------------------------------------------- Ulf Hermann (1): Use separate files for strip outputs tests/ChangeLog | 6 +++++ tests/run-annobingroup.sh | 20 ++++++++--------- tests/run-strip-test-many.sh | 53 +++++++++++++++++++++++++++++--------------- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/tests/ChangeLog b/tests/ChangeLog index 8c9e7807..19879269 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,9 @@ +2019-01-18 Ulf Hermann + + * run-annobingroup.sh: Use different files for strip output. + * run-strip-test-many.sh: Use different files for strip output, + check results of strip, unstrip, elflint. + 2019-01-09 Ulf Hermann * run-readelf-compressed.sh: Skip if USE_BZIP2 not found. diff --git a/tests/run-annobingroup.sh b/tests/run-annobingroup.sh index fd36e4ac..16b031a1 100755 --- a/tests/run-annobingroup.sh +++ b/tests/run-annobingroup.sh @@ -25,7 +25,7 @@ # gcc -g -O2 -fplugin=annobin -c testfile-annobingroup.c testfiles testfile-annobingroup.o -tempfiles merged.elf stripped.elf debugfile.elf remerged.elf +tempfiles merged.elf stripped.elf debugfile1.elf debugfile2.elf debugfile3.elf remerged.elf testrun_compare ${abs_top_builddir}/src/readelf -g testfile-annobingroup.o << EOF @@ -35,7 +35,7 @@ Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 ent [ 9] .text.unlikely EOF -testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile.elf testfile-annobingroup.o +testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile1.elf testfile-annobingroup.o testrun_compare ${abs_top_builddir}/src/readelf -g stripped.elf << EOF @@ -45,7 +45,7 @@ Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 ent [ 9] .text.unlikely EOF -testrun_compare ${abs_top_builddir}/src/readelf -g debugfile.elf << EOF +testrun_compare ${abs_top_builddir}/src/readelf -g debugfile1.elf << EOF Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: [ 7] .gnu.build.attributes..text.unlikely @@ -53,7 +53,7 @@ Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 ent [ 9] .text.unlikely EOF -testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile.elf +testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile1.elf testrun_compare ${abs_top_builddir}/src/readelf -g remerged.elf << EOF @@ -81,7 +81,7 @@ COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contai [13] .text.__x86.get_pc_thunk.ax EOF -testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile.elf testfile-annobingroup-i386.o +testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile2.elf testfile-annobingroup-i386.o testrun_compare ${abs_top_builddir}/src/readelf -g stripped.elf << EOF @@ -94,7 +94,7 @@ COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contai [13] .text.__x86.get_pc_thunk.ax EOF -testrun_compare ${abs_top_builddir}/src/readelf -g debugfile.elf << EOF +testrun_compare ${abs_top_builddir}/src/readelf -g debugfile2.elf << EOF Section group [ 1] '.group' with signature '.text.unlikely.group' contains 3 entries: [ 8] .gnu.build.attributes..text.unlikely @@ -105,7 +105,7 @@ COMDAT section group [ 2] '.group' with signature '__x86.get_pc_thunk.ax' contai [13] .text.__x86.get_pc_thunk.ax EOF -testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile.elf +testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile2.elf testrun_compare ${abs_top_builddir}/src/readelf -g remerged.elf << EOF @@ -143,13 +143,13 @@ Section group [ 4] '.group' with signature '.text.unlikely..group' contains 1 en [27] .text.unlikely EOF -testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile.elf testfile-annobingroup-x86_64.o +testrun ${abs_top_builddir}/src/strip -o stripped.elf -f debugfile3.elf testfile-annobingroup-x86_64.o # This would/should work, except for the unknown NOTEs. # testrun ${abs_top_builddir}/src/elflint --gnu stripped.elf -# testrun ${abs_top_builddir}/src/elflint --gnu --debug debugfile.elf +# testrun ${abs_top_builddir}/src/elflint --gnu --debug debugfile3.elf -testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile.elf +testrun ${abs_top_builddir}/src/unstrip -o remerged.elf stripped.elf debugfile3.elf testrun ${abs_top_builddir}/src/elfcmp testfile-annobingroup-x86_64.o remerged.elf diff --git a/tests/run-strip-test-many.sh b/tests/run-strip-test-many.sh index 9a9657cd..b0cbad8b 100755 --- a/tests/run-strip-test-many.sh +++ b/tests/run-strip-test-many.sh @@ -17,50 +17,67 @@ . $srcdir/test-subr.sh +status=0 + # Use the original file from run-strip-test.sh but with many sections testfiles testfile -tempfiles testfile.strip testfile.debug testfile.unstrip +tempfiles testfile1.strip testfile2.strip testfile1.debug testfile2.debug testfile.unstrip echo "Adding sections to testfile" -testrun ${abs_builddir}/addsections 65535 testfile +testrun ${abs_builddir}/addsections 65535 testfile || +{ echo "*** failure addsections testfile"; status=1; } echo "Testing strip -o" -testrun ${abs_top_builddir}/src/strip -o testfile.strip -f testfile.debug testfile +testrun ${abs_top_builddir}/src/strip -o testfile1.strip -f testfile1.debug testfile || +{ echo "*** failure strip -o"; status=1; } # Do the parts check out? -echo "elflint testfile.strip" -testrun ${abs_top_builddir}/src/elflint --gnu -q testfile.strip -echo "elflint testfile.debug" -testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile.debug +echo "elflint testfile1.strip" +testrun ${abs_top_builddir}/src/elflint --gnu -q testfile1.strip || +{ echo "*** failure elflint testfile1.strip"; status=1; } + +echo "elflint testfile1.debug" +testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile1.debug || +{ echo "*** failure elflint testfile1.debug"; status=1; } # Now test unstrip recombining those files. echo "unstrip" -testrun ${abs_top_builddir}/src/unstrip -o testfile.unstrip testfile.strip testfile.debug +testrun ${abs_top_builddir}/src/unstrip -o testfile.unstrip testfile1.strip testfile1.debug || +{ echo "*** failure unstrip"; status=1; } + echo "elfcmp" -testrun ${abs_top_builddir}/src/elfcmp testfile testfile.unstrip +testrun ${abs_top_builddir}/src/elfcmp testfile testfile.unstrip || +{ echo "*** failure elfcmp"; status=1; } # test strip -g echo "Testing strip -g" -testrun ${abs_top_builddir}/src/strip -g -o testfile.strip -f testfile.debug testfile +testrun ${abs_top_builddir}/src/strip -g -o testfile2.strip -f testfile2.debug testfile || +{ echo "*** failure strip -g"; status=1; } # Do the parts check out? -echo "elflint testfile.strip" -testrun ${abs_top_builddir}/src/elflint --gnu -q testfile.strip -echo "elflint testfile.debug" -testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile.debug +echo "elflint testfile2.strip" +testrun ${abs_top_builddir}/src/elflint --gnu -q testfile2.strip || +{ echo "*** failure elflint testfile2.strip"; status=1; } + +echo "elflint testfile2.debug" +testrun ${abs_top_builddir}/src/elflint --gnu -q -d testfile2.debug || +{ echo "*** failure elflint testfile2.debug"; status=1; } # Now strip "in-place" and make sure it is smaller. -echo "TEsting strip in-place" +echo "Testing strip in-place" SIZE_original=$(stat -c%s testfile) echo "original size $SIZE_original" -testrun ${abs_top_builddir}/src/strip testfile +testrun ${abs_top_builddir}/src/strip testfile || +{ echo "*** failure strip in-place"; status=1; } + SIZE_stripped=$(stat -c%s testfile) echo "stripped size $SIZE_stripped" test $SIZE_stripped -lt $SIZE_original || { echo "*** failure in-place strip file not smaller $original"; exit 1; } echo "elflint in-place" -testrun ${abs_top_builddir}/src/elflint --gnu -q testfile +testrun ${abs_top_builddir}/src/elflint --gnu -q testfile || +{ echo "*** failure elflint in-place"; status=1; } -exit 0 +exit $status