[PATCH] tests: Split self_test_files into an exe, lib and obj list.

Mark Wielaard mark@klomp.org
Thu May 31 12:40:00 GMT 2018


Introduce testrun_on_self_exe and testrun_on_self_lib.
Some tests cannot handle (unrelocated) ET_REL object files.
run-get-units-split.sh and run-unit-info.sh only handle executables
and shared libraries. This allows running the whole testsuite on an
elfutils build done with CFLAGS="-gdwarf-4 -gsplit-dwarf -O2".

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tests/ChangeLog              | 10 ++++++++++
 tests/run-get-units-split.sh |  5 +++--
 tests/run-unit-info.sh       |  5 +++--
 tests/test-subr.sh           | 39 +++++++++++++++++++++++++++++++++++++--
 4 files changed, 53 insertions(+), 6 deletions(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index c03db54..1c1ef4e 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,15 @@
 2018-05-31  Mark Wielaard  <mark@klomp.org>
 
+	* test-subr.sh (self_test_files): Split into self_test_files_exe,
+	self_test_files_lib and self_test_obj.
+	(testrun_on_self_exe): New function.
+	(testrun_on_self_lib): Likewise.
+	* run-get-units-split.sh: Replace testrun_on_self with
+	testrun_on_self_exe and testrun_on_self_lib.
+	* run-unit-info.sh: Likewise.
+
+2018-05-31  Mark Wielaard  <mark@klomp.org>
+
 	* low_high_pc.c (handle_die): Handle NULL name. Print offset and
 	name of die.
 	(main): Check if the cu DIE is a skeleton, then get and handle
diff --git a/tests/run-get-units-split.sh b/tests/run-get-units-split.sh
index 7b13694..7a43c67 100755
--- a/tests/run-get-units-split.sh
+++ b/tests/run-get-units-split.sh
@@ -59,7 +59,8 @@ Found a skeleton unit, with split die: world.c
 
 EOF
 
-# Self test
-testrun_on_self ${abs_builddir}/get-units-split
+# Self test (Not on obj files since those need relocation first).
+testrun_on_self_exe ${abs_builddir}/get-units-split
+testrun_on_self_lib ${abs_builddir}/get-units-split
 
 exit 0
diff --git a/tests/run-unit-info.sh b/tests/run-unit-info.sh
index f4ce427..328fe78 100755
--- a/tests/run-unit-info.sh
+++ b/tests/run-unit-info.sh
@@ -74,7 +74,8 @@ Iterate no info, compare recorded info with dwarf_cu_info.
 
 EOF
 
-# Self test
-testrun_on_self ${abs_builddir}/unit-info
+# Self test (not on obj files, since those need relocation first).
+testrun_on_self_exe ${abs_builddir}/unit-info
+testrun_on_self_lib ${abs_builddir}/unit-info
 
 exit 0
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index a765db6..ff60076 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -115,16 +115,25 @@ program_transform()
   echo "$*" | sed "${program_transform_name}"
 }
 
-self_test_files=`echo ${abs_top_builddir}/src/addr2line \
+self_test_files_exe=`echo ${abs_top_builddir}/src/addr2line \
 ${abs_top_builddir}/src/elfcmp ${abs_top_builddir}/src/elflint \
 ${abs_top_builddir}/src/nm ${abs_top_builddir}/src/objdump \
 ${abs_top_builddir}/src/readelf \
-${abs_top_builddir}/src/size.o ${abs_top_builddir}/src/strip.o \
 ${abs_top_builddir}/libelf/libelf.so \
 ${abs_top_builddir}/libdw/libdw.so \
 ${abs_top_builddir}/backends/libebl_i386.so \
 ${abs_top_builddir}/backends/libebl_x86_64.so`
 
+self_test_files_lib=`echo ${abs_top_builddir}/libelf/libelf.so \
+${abs_top_builddir}/libdw/libdw.so \
+${abs_top_builddir}/backends/libebl_i386.so \
+${abs_top_builddir}/backends/libebl_x86_64.so`
+
+self_test_files_obj=`echo ${abs_top_builddir}/src/size.o \
+${abs_top_builddir}/src/strip.o`
+
+self_test_files="$self_test_files_exe $self_test_files_lib $self_test_files_obj"
+
 # Provide a command to run on all self-test files with testrun.
 testrun_on_self()
 {
@@ -139,6 +148,32 @@ testrun_on_self()
   if test $exit_status != 0; then exit $exit_status; fi
 }
 
+testrun_on_self_exe()
+{
+  exit_status=0
+
+  for file in $self_test_files_exe; 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
+}
+
+testrun_on_self_lib()
+{
+  exit_status=0
+
+  for file in $self_test_files_lib; 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()
 {
-- 
1.8.3.1



More information about the Elfutils-devel mailing list