]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests/run-sysroot.sh: Avoid testing output that depends on LZMA support
authorAaron Merey <amerey@redhat.com>
Thu, 11 Jul 2024 23:30:41 +0000 (19:30 -0400)
committerAaron Merey <amerey@redhat.com>
Thu, 11 Jul 2024 23:30:41 +0000 (19:30 -0400)
run-sysroot.sh checks whether a backtrace generated by eu-stack contains
symbol names found in binaries under a test sysroot.  Two frames in
the backtrace contain symbol names that must be read from .gnu_debugdata.

However this section can only be read if elfutils was built with LZMA
support.  If not, then the symbol names will be absent from the
backtrace.

Test the eu-stack output with these 2 frames removed in order to prevent
a test failure when LZMA support is missing.

Signed-off-by: Aaron Merey <amerey@redhat.com>
tests/run-sysroot.sh

index 7f7d3f0639f624216554a191993bc3d4f9750352..cfdc51e9506df5b4fa25349f65f6401f9858dcf5 100755 (executable)
@@ -17,8 +17,6 @@
 
 . $srcdir/test-subr.sh
 
-set -ex;
-
 tmpdir="$(mktemp -d)"
 trap "rm -rf -- ${tmpdir}" EXIT
 
@@ -28,13 +26,16 @@ tar xjf "${abs_srcdir}/testfile-sysroot.tar.bz2" -C "${tmpdir}"
 testrun "${abs_top_builddir}"/src/stack --core "${tmpdir}/core.bash" \
        --sysroot "${tmpdir}/sysroot" >"${tmpdir}/stack.out"
 
+# Remove 2 stack frames with symbol names contained in .gnu_debugdata.
+# Whether or not these names appear in the output depends on if elfutils
+# was built with LZMA support.
+sed -i '4,5d' "${tmpdir}/stack.out"
+
 # check that we are able to get fully symbolized backtrace
-testrun diff "${tmpdir}/stack.out" - <<\EOF
+testrun_compare cat "${tmpdir}/stack.out" <<\EOF
 PID 431185 - core
 TID 431185:
 #0  0x0000ffff8ebe5a8c kill
-#1  0x0000aaaae5663f20 kill_shell
-#2  0x0000aaaae5667a98 termsig_handler.part.0
 #3  0x0000aaaae562b2fc execute_command
 #4  0x0000aaaae561cbb4 reader_loop
 #5  0x0000aaaae5611bf0 main