[PATCH] tests: Run run-varlocs-self.sh for object files with --exprlocs.

Mark Wielaard mark@klomp.org
Fri Apr 17 10:34:17 GMT 2020


The varlocs test relies on finding addresses for the CUs, even in
object files. This might not be true (for example when building with
gcc -flto, which only emits partial, type only, debuginfo). Split
running the self tests in running on executables and shared libraries
as normal, but run object files with --exprlocs to test that output
too (and not require addresses).

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog           |  7 +++++++
 tests/run-varlocs-self.sh |  4 +++-
 tests/test-subr.sh        | 13 +++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 886a3efb..301b0fb6 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2020-04-17  Mark Wielaard  <mark@klomp.org>
+
+	* test-subr.sh (testrun_on_self_obj): New function.
+	* run-varlocs-self.sh: Run testrun_on_self_exe and
+	testrun_on_self_lib with -e, run testrun_on_self_obj with
+	--exprlocs -e.
+
 2020-04-17  Mark Wielaard  <mark@klomp.org>
 
 	* Makefile.am (test-nlist$): New goal with minimal CFLAGS.
diff --git a/tests/run-varlocs-self.sh b/tests/run-varlocs-self.sh
index 54b6a8d7..5454fc70 100755
--- a/tests/run-varlocs-self.sh
+++ b/tests/run-varlocs-self.sh
@@ -19,4 +19,6 @@
 
 # Make sure varlocs doesn't crash, doesn't trigger self-check/asserts
 # or leaks running under valgrind.
-testrun_on_self_quiet ${abs_top_builddir}/tests/varlocs -e
+testrun_on_self_exe ${abs_top_builddir}/tests/varlocs -e
+testrun_on_self_lib ${abs_top_builddir}/tests/varlocs -e
+testrun_on_self_obj ${abs_top_builddir}/tests/varlocs --exprlocs -e
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index e768c1e5..411e5f28 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -168,6 +168,19 @@ testrun_on_self_lib()
   if test $exit_status != 0; then exit $exit_status; fi
 }
 
+testrun_on_self_obj()
+{
+  exit_status=0
+
+  for file in $self_test_files_obj; do
+      testrun $* $file \
+	  || { echo "*** failure in $* $file"; exit_status=1; }
+  done
+
+  # Only exit if something failed
+  if test $exit_status != 0; then exit $exit_status; fi
+}
+
 # Compress the files first. Compress both debug sections and symtab.
 testrun_on_self_compressed()
 {
-- 
2.18.2



More information about the Elfutils-devel mailing list