unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Cc: David Bremner <david@tethera.net>
Subject: [PATCH] test/T360-symbol-hiding.sh: trim extra output from readelf
Date: Tue, 15 Dec 2020 16:45:09 -0400	[thread overview]
Message-ID: <20201215204509.4177831-1-david@tethera.net> (raw)

readelf on (at least) ppc64le generates symbol versioning (sometimes)
at the end of the line inside '()' and some extension to the Ndx name
inside '[]'. Remove this output to allow our simple column based
parsing to work.
---
 test/T360-symbol-hiding.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

I dislike this feeling of playing whack-a-mole parsing ill-defined
output, but here we are. I looked into alternatives a bit, but nothing
grabbed me. abi-dumper is a perl script wrapping readelf, so if we
wanted we could delegate the hacks to a third party tool.

I also thought about combining the sed into the awk call, but it
seemed like too much work to me, probably because I am not an awk
expert.

We could also just drop the test. In Debian we have dpkg-gensymbols
that manages more or less the same task; I'm not sure if other
environments have something similar.

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 3f00dd38..b2a5694a 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -26,7 +26,7 @@ test_begin_subtest 'checking output'
 test_expect_equal "$result" "$output"
 
 test_begin_subtest 'comparing existing to exported symbols'
-readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | \
+readelf -Ws $NOTMUCH_BUILDDIR/lib/libnotmuch.so | sed -e 's/\[[^]]*\]//' -e 's/([^)]*)$//' |\
     awk '$4 == "FUNC" && $5 == "GLOBAL" && $7 != "UND" {print $8}' | sort -u > ACTUAL
 sed -n 's/^\(notmuch_[a-zA-Z0-9_]*\)[[:blank:]]*(.*/\1/p' $NOTMUCH_SRCDIR/lib/notmuch.h | sort -u > EXPORTED
 test_expect_equal_file EXPORTED ACTUAL
-- 
2.29.2

             reply	other threads:[~2020-12-15 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 20:45 David Bremner [this message]
2020-12-25 18:37 ` [PATCH] test/T360-symbol-hiding.sh: trim extra output from readelf David Bremner

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

  List information: https://notmuchmail.org/

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

  git send-email \
    --in-reply-to=20201215204509.4177831-1-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.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.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).