public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] tests: Split self_test_files into an exe, lib and obj list.
Date: Thu, 31 May 2018 12:40:00 -0000	[thread overview]
Message-ID: <1527770431-13854-1-git-send-email-mark@klomp.org> (raw)

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

             reply	other threads:[~2018-05-31 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 12:40 Mark Wielaard [this message]
2018-06-01 11:19 ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1527770431-13854-1-git-send-email-mark@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).