[applied] test-symtab: Update after support for empty symtabs

Message ID 87pm8umtzg.fsf@redhat.com
State New
Headers
Series [applied] test-symtab: Update after support for empty symtabs |

Commit Message

Dodji Seketeli March 27, 2023, 9:19 a.m. UTC
  Hello,

Now that we support empty symtabs test-symtab needs to be updated so
that it expects to have a corpus now, upon a binary with no exported
symbols, albeit an empty one.

	* tests/test-symtab.cc (TEST_CASE("Symtab::Empty", "[symtab,
	basic]")): Adjust.
	(TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]")): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
 tests/test-symtab.cc | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
  

Patch

diff --git a/tests/test-symtab.cc b/tests/test-symtab.cc
index dd3f3824..8a5860af 100644
--- a/tests/test-symtab.cc
+++ b/tests/test-symtab.cc
@@ -66,10 +66,9 @@  TEST_CASE("Symtab::Empty", "[symtab, basic]")
 {
   const std::string	     binary = "basic/empty.so";
   corpus_sptr		     corpus_ptr;
-  const fe_iface::status status = read_corpus(binary, corpus_ptr);
-  REQUIRE(!corpus_ptr);
-
-  REQUIRE((status & fe_iface::STATUS_NO_SYMBOLS_FOUND));
+  read_corpus(binary, corpus_ptr);
+  REQUIRE(corpus_ptr->get_fun_symbol_map().empty());
+  REQUIRE(corpus_ptr->get_var_symbol_map().empty());
 }
 
 TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]")
@@ -241,10 +240,9 @@  TEST_CASE("Symtab::SymtabWithWhitelist", "[symtab, whitelist]")
 	+ "basic/one_function_one_variable_irrelevant.whitelist");
 
       corpus_sptr		 corpus_ptr;
-      const fe_iface::status status =
-	read_corpus(binary, corpus_ptr, whitelists);
-      REQUIRE(!corpus_ptr);
-      REQUIRE((status & fe_iface::STATUS_NO_SYMBOLS_FOUND));
+      read_corpus(binary, corpus_ptr, whitelists);
+      REQUIRE(corpus_ptr->get_fun_symbol_map().empty());
+      REQUIRE(corpus_ptr->get_var_symbol_map().empty());
     }
 
     GIVEN("we read the binary with only the function whitelisted")