From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aGvoL2wg2V9eLQAA0tVLHw (envelope-from ) for ; Tue, 15 Dec 2020 20:45:32 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WNvSK2wg2V+kKgAA1q6Kng (envelope-from ) for ; Tue, 15 Dec 2020 20:45:32 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 81ACD9403CB for ; Tue, 15 Dec 2020 20:45:32 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 232B628C2E; Tue, 15 Dec 2020 15:45:23 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 4739B270DE for ; Tue, 15 Dec 2020 15:45:19 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 6EA535FC36; Tue, 15 Dec 2020 15:45:17 -0500 (EST) Received: (nullmailer pid 4177968 invoked by uid 1000); Tue, 15 Dec 2020 20:45:15 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH] test/T360-symbol-hiding.sh: trim extra output from readelf Date: Tue, 15 Dec 2020 16:45:09 -0400 Message-Id: <20201215204509.4177831-1-david@tethera.net> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Message-ID-Hash: JLYA74WQEWHOULU6LQZLUQ7W5ABBTEUQ X-Message-ID-Hash: JLYA74WQEWHOULU6LQZLUQ7W5ABBTEUQ X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: 0.72 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 81ACD9403CB X-Spam-Score: 0.72 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2lBYtA3nync5 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