From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by sourceware.org (Postfix) with ESMTPS id 40A94385781A for ; Wed, 17 Mar 2021 11:07:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 40A94385781A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=seketeli.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dodji@seketeli.org X-Originating-IP: 88.120.130.27 Received: from localhost (unknown [88.120.130.27]) (Authenticated sender: dodji@seketeli.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 510F7E0006; Wed, 17 Mar 2021 11:07:09 +0000 (UTC) Received: by localhost (Postfix, from userid 1000) id 89324580100; Wed, 17 Mar 2021 12:07:08 +0100 (CET) From: Dodji Seketeli To: Matthias Maennich Cc: libabigail@sourceware.org, gprocida@google.com, kernel-team@android.com Subject: Re: [PATCH 16/20] test-symtab: add tests for whitelisted functions Organization: Me, myself and I References: <20200619214305.562-1-maennich@google.com> <20210127125853.886677-1-maennich@google.com> <20210127125853.886677-17-maennich@google.com> X-Operating-System: Fedora 34 X-URL: http://www.seketeli.net/~dodji Date: Wed, 17 Mar 2021 12:07:08 +0100 In-Reply-To: <20210127125853.886677-17-maennich@google.com> (Matthias Maennich's message of "Wed, 27 Jan 2021 12:58:49 +0000") Message-ID: <877dm6xcmb.fsf@seketeli.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 11:07:13 -0000 Hello, Matthias Maennich a =C3=A9crit: > diff --git a/tests/test-symtab.cc b/tests/test-symtab.cc > index 2df766de1c5c..ac853e895fef 100644 > --- a/tests/test-symtab.cc > +++ b/tests/test-symtab.cc > @@ -11,11 +11,14 @@ >=20=20 > #include > #include > +#include > #include >=20=20 > #include "abg-corpus.h" > #include "abg-dwarf-reader.h" > +#include "abg-fwd.h" > #include "abg-ir.h" > +#include "abg-tools-utils.h" > #include "lib/catch.hpp" > #include "test-utils.h" >=20=20 > @@ -26,12 +29,16 @@ using dwarf_reader::read_context_sptr; > using dwarf_reader::read_corpus_from_elf; > using ir::environment; > using ir::environment_sptr; > +using suppr::suppressions_type; >=20=20 > static const std::string test_data_dir =3D > std::string(abigail::tests::get_src_dir()) + "/tests/data/test-symta= b/"; >=20=20 > dwarf_reader::status > -read_corpus(const std::string path, corpus_sptr& result) > +read_corpus( > + const std::string& path, > + corpus_sptr& result, > + const std::vector& whitelist_paths =3D std::vector()) Please keep the open parenthesis of the on the same line as at least one parameter. There are also several other functions indented like this in the file, it would be good to fix them too. > { > const std::string& absolute_path =3D test_data_dir + path; >=20=20 > @@ -41,6 +48,15 @@ read_corpus(const std::string path, corpus_sptr& resul= t) > absolute_path, debug_info_root_paths, env.get(), > /* load_all_type =3D */ true, /* linux_kernel_mode =3D */ true); >=20=20 > + if (!whitelist_paths.empty()) > + { > + const suppressions_type& wl_suppr =3D > + tools_utils::gen_suppr_spec_from_kernel_abi_whitelists( > + whitelist_paths); > + REQUIRE_FALSE(wl_suppr.empty()); > + dwarf_reader::add_read_context_suppressions(*ctxt, wl_suppr); > + } > + > dwarf_reader::status status =3D dwarf_reader::STATUS_UNKNOWN; > result =3D read_corpus_from_elf(*ctxt, status); >=20=20 > @@ -76,14 +92,17 @@ TEST_CASE("Symtab::NoDebugInfo", "[symtab, basic]") > #define N std::numeric_limits::max() >=20=20 > corpus_sptr > -assert_symbol_count(const std::string& path, > - size_t function_symbols =3D 0, > - size_t variable_symbols =3D 0, > - size_t undefined_function_symbols =3D 0, > - size_t undefined_variable_symbols =3D 0) > +assert_symbol_count( > + const std::string& path, > + size_t function_symbols =3D 0, > + size_t variable_symbols =3D 0, > + size_t undefined_function_symbols =3D 0, > + size_t undefined_variable_symbols =3D 0, > + const std::vector& whitelist_paths =3D std::vector()) Likewise. > { > corpus_sptr corpus_ptr; > - const dwarf_reader::status status =3D read_corpus(path, corpus_ptr); > + const dwarf_reader::status status =3D > + read_corpus(path, corpus_ptr, whitelist_paths); > REQUIRE(corpus_ptr); >=20=20 > REQUIRE((status & dwarf_reader::STATUS_OK)); > @@ -188,6 +207,76 @@ TEST_CASE("Symtab::SimpleSymtabs", "[symtab, basic]") > } > } [...] > Extend the test functionality in test-symtab to allow processing of KMI > whitelists and add additional test cases for whitelist handling. > > * tests/data/Makefile.am: add new test files > * tests/data/test-symtab/basic/one_function_one_variable_all.whitelist: = New test file, > * tests/data/test-symtab/basic/one_function_one_variable_function.whitel= ist: Likewise. > * tests/data/test-symtab/basic/one_function_one_variable_irrelevant.whit= elist: Likewise. > * tests/data/test-symtab/basic/one_function_one_variable_variable.whitel= ist: Likewise. > * tests/test-symtab.cc (read_corpus): Add support for whitelists. > (assert_symbol_count): Likewise. > (Symtab::SymtabWithWhitelist): New testcase. > > Reviewed-by: Giuliano Procida > Signed-off-by: Matthias Maennich OK to apply to master with the changes above after the prerequisite patches are in. Thanks! [...] Cheers, --=20 Dodji