[1/2] test-read-dwarf: ensure in_elf_path exists and add missing test files

Message ID 20200315125512.256054-1-maennich@google.com
State Committed
Headers
Series [1/2] test-read-dwarf: ensure in_elf_path exists and add missing test files |

Commit Message

Matthias Männich March 15, 2020, 12:55 p.m. UTC
  test-read-dwarf silently succeeded even if the input elf file was not
existing. Hence, make distcheck succeeded even though the testfiles were
not distributed. Assert on the existence of the input file and add the
missing test case files.

	* tests/data/Makefile.am: add missing test case files
	* tests/test-read-dwarf.cc (test_task::perform): assert the
	input elf file exists.

Signed-off-by: Matthias Maennich <maennich@google.com>
---
 tests/data/Makefile.am   | 2 ++
 tests/test-read-dwarf.cc | 1 +
 2 files changed, 3 insertions(+)
  

Comments

Dodji Seketeli March 18, 2020, 10:07 p.m. UTC | #1
Matthias Maennich <maennich@google.com> a ?crit:

> test-read-dwarf silently succeeded even if the input elf file was not
> existing. Hence, make distcheck succeeded even though the testfiles were
> not distributed. Assert on the existence of the input file and add the
> missing test case files.
>
> 	* tests/data/Makefile.am: add missing test case files
> 	* tests/test-read-dwarf.cc (test_task::perform): assert the
> 	input elf file exists.

Applied to master.

Thanks!
  

Patch

diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index bf76ca2e617b..802b709fc5f5 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -435,6 +435,8 @@  test-read-dwarf/PR25007-sdhci.ko \
 test-read-dwarf/PR25007-sdhci.ko.abi \
 test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0 \
 test-read-dwarf/PR25042-libgdbm-clang-dwarf5.so.6.0.0.abi \
+test-read-dwarf/test25-bogus-binary.elf \
+test-read-dwarf/test26-bogus-binary.elf \
 \
 test-annotate/test0.abi			\
 test-annotate/test1.abi			\
diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc
index 11e8425b5a84..a8ea0619ccbb 100644
--- a/tests/test-read-dwarf.cc
+++ b/tests/test-read-dwarf.cc
@@ -328,6 +328,7 @@  struct test_task : public abigail::workers::task
     abigail::dwarf_reader::status status =
     abigail::dwarf_reader::STATUS_UNKNOWN;
     vector<char**> di_roots;
+    ABG_ASSERT(abigail::tools_utils::file_exists(in_elf_path));
     read_context_sptr ctxt = create_read_context(in_elf_path,
 						 di_roots,
 						 env.get());