]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
tests: add test for eu-stack --sysroot
authorMichal Sekletar <msekleta@redhat.com>
Tue, 2 Jul 2024 17:31:00 +0000 (19:31 +0200)
committerAaron Merey <amerey@redhat.com>
Thu, 4 Jul 2024 22:42:24 +0000 (18:42 -0400)
tests/Makefile.am
tests/run-sysroot.sh [new file with mode: 0755]
tests/testfile-sysroot.tar.bz2 [new file with mode: 0644]

index 771dd01d24d79708ef2cb281faeb831b3cb1b927..d5b2c02b5a7b8ec8a55b1ea7e51326fe7553fb53 100644 (file)
@@ -215,7 +215,8 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
        run-nvidia-extended-linemap-libdw.sh run-nvidia-extended-linemap-readelf.sh \
        run-readelf-dw-form-indirect.sh run-strip-largealign.sh \
        run-readelf-Dd.sh run-dwfl-core-noncontig.sh run-cu-dwp-section-info.sh \
-       run-declfiles.sh
+       run-declfiles.sh \
+       run-sysroot.sh
 
 if !BIARCH
 export ELFUTILS_DISABLE_BIARCH = 1
@@ -667,7 +668,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
             testfile-dwp-4-cu-index-overflow.bz2 \
             testfile-dwp-4-cu-index-overflow.dwp.bz2 \
             testfile-dwp-cu-index-overflow.source \
-            testfile-define-file.bz2
+            testfile-define-file.bz2 \
+            testfile-sysroot.tar.bz2
 
 
 if USE_VALGRIND
diff --git a/tests/run-sysroot.sh b/tests/run-sysroot.sh
new file mode 100755 (executable)
index 0000000..7f7d3f0
--- /dev/null
@@ -0,0 +1,44 @@
+#! /usr/bin/env bash
+# Copyright (C) 2024 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/test-subr.sh
+
+set -ex;
+
+tmpdir="$(mktemp -d)"
+trap "rm -rf -- ${tmpdir}" EXIT
+
+tar xjf "${abs_srcdir}/testfile-sysroot.tar.bz2" -C "${tmpdir}"
+
+# check that stack supports --sysroot option
+testrun "${abs_top_builddir}"/src/stack --core "${tmpdir}/core.bash" \
+       --sysroot "${tmpdir}/sysroot" >"${tmpdir}/stack.out"
+
+# check that we are able to get fully symbolized backtrace
+testrun diff "${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
+#6  0x0000ffff8ebd09dc __libc_start_call_main
+#7  0x0000ffff8ebd0ab0 __libc_start_main@@GLIBC_2.34
+#8  0x0000aaaae56127f0 _start
+EOF
diff --git a/tests/testfile-sysroot.tar.bz2 b/tests/testfile-sysroot.tar.bz2
new file mode 100644 (file)
index 0000000..6f508f7
Binary files /dev/null and b/tests/testfile-sysroot.tar.bz2 differ