From patchwork Fri Mar 1 04:13:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Merey X-Patchwork-Id: 86622 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1AD67385840C for ; Fri, 1 Mar 2024 04:14:08 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id CFBF83858D34 for ; Fri, 1 Mar 2024 04:13:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CFBF83858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CFBF83858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709266436; cv=none; b=F3ESV1QjHo9ogbishGruXq1asKsYVBMT8Tb7CEqa8H/N9m2yhoxjMsyr1tQKimDrdmrh5VgJog8WowG0O1uoyeltfDDIZ7B/eJz9bSVuRJ2122faAbkApFC0oi/gelHmeaEbhB0tiLAQgJzH9Rgs+RzVTVp0rD0FaQDoWItZdK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709266436; c=relaxed/simple; bh=IUU4GHM8cl1RGLX4G8Kf0EpT2sQ2tD68yv8ez4Cie/w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SLH7bf/F3lvRXPQYcTkYSxa1kxC2nHySxA5erSoNfeUVo0KHqP2ML/vSQB16XHmlR8dKXAC0MgxZ3QY3lLr1hKEYFep4xq0439XKNRNpbeMgXVH53JAIJNCrgtGDTic3tShW1YjVUWzHyfu2Eq/4y/dinGF48dkFLA2phopSuFk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709266429; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=aiMojyuEJQy56Bpf4xwunmJLznvGT7kd7UjYkK5bSt8=; b=deLMFjOUkJTIu7Gr13B4ajrsuJGRE+oi0SLNUvTk+e7Kcv/i+YGcxAMjQaN+2OjaNQAB49 O+K58Nf4NVM+SkCXXYJK+h2OCbYy1PXpi5FwGcDyAYJfO3XxkYAOJ6ziHuwQkaZD8TC7Gb fqcXAFthbOP5MDafBPQXnXQwb3oLCfA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-195-YzW1heitN0efgcXCz-WT3w-1; Thu, 29 Feb 2024 23:13:47 -0500 X-MC-Unique: YzW1heitN0efgcXCz-WT3w-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A550585A588 for ; Fri, 1 Mar 2024 04:13:47 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.22.8.171]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43E9840C94AB; Fri, 1 Mar 2024 04:13:47 +0000 (UTC) From: Aaron Merey To: elfutils-devel@sourceware.org Cc: Aaron Merey Subject: [COMMITTED] tests/run-getsrc-die.sh: Skip tests if objcopy fails Date: Thu, 29 Feb 2024 23:13:44 -0500 Message-ID: <20240301041344.153389-1-amerey@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org run-getsrc-die.sh uses objcopy to remove .debug_aranges from testfiles. Depending how objcopy is built, it may fail to recognize the format of the testfiles. Skip the remaining tests if objcopy fails. Signed-off-by: Aaron Merey --- tests/run-getsrc-die.sh | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/run-getsrc-die.sh b/tests/run-getsrc-die.sh index 54c7ad8c..6740e5d9 100755 --- a/tests/run-getsrc-die.sh +++ b/tests/run-getsrc-die.sh @@ -22,23 +22,17 @@ # which uses dwfl_module_getsrc. This test uses dwarf_addrdie and # dwarf_getsrc_die testfiles testfile testfile-inlines testfile-lex-inlines -tempfiles testfile-no-aranges testfile-inlines-no-aranges -tempfiles testfile-lex-inlines-no-aranges good.out getsrc_die.out +tempfiles testfile-no-aranges testfile-inlines-no-aranges getsrc_die.out +tempfiles testfile-lex-inlines-no-aranges good1.out good2.out good3.out -# Each test should also pass with no .debug_aranges present. -objcopy --remove-section .debug_aranges testfile testfile-no-aranges -objcopy --remove-section .debug_aranges testfile-inlines testfile-inlines-no-aranges -objcopy --remove-section .debug_aranges testfile-lex-inlines testfile-lex-inlines-no-aranges - -cat > good.out <<\EOF +cat > good1.out <<\EOF /home/drepper/gnu/new-bu/build/ttt/f.c:3 /home/drepper/gnu/new-bu/build/ttt/b.c:4 EOF -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile 0x08048468 0x0804845c -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-no-aranges 0x08048468 0x0804845c +cat good1.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile 0x08048468 0x0804845c -cat > good.out <<\EOF +cat > good2.out <<\EOF /tmp/x.cpp:5 /tmp/x.cpp:6 /tmp/x.cpp:10 @@ -51,17 +45,27 @@ cat > good.out <<\EOF /tmp/x.cpp:5 EOF -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f1 0x00000000000005f2 -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-inlines-no-aranges 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f1 0x00000000000005f2 +cat good2.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-inlines 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f1 0x00000000000005f2 -cat > good.out <<\EOF +cat > good3.out <<\EOF /tmp/x.cpp:5 /tmp/x.cpp:5 /tmp/x.cpp:5 /tmp/x.cpp:5 EOF -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-lex-inlines 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 -cat good.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-lex-inlines-no-aranges 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 +cat good3.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-lex-inlines 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 + +# Each test should also pass with no .debug_aranges present. If objcopy cannot +# strip the testfiles then skip the remaining tests. +objcopy --remove-section .debug_aranges testfile testfile-no-aranges || exit 0 +objcopy --remove-section .debug_aranges testfile-inlines testfile-inlines-no-aranges || exit 0 +objcopy --remove-section .debug_aranges testfile-lex-inlines testfile-lex-inlines-no-aranges || exit 0 + +cat good1.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-no-aranges 0x08048468 0x0804845c + +cat good2.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-inlines-no-aranges 0x00000000000005a0 0x00000000000005a1 0x00000000000005b0 0x00000000000005b1 0x00000000000005c0 0x00000000000005d0 0x00000000000005e0 0x00000000000005e1 0x00000000000005f1 0x00000000000005f2 + +cat good3.out | testrun_compare ${abs_top_builddir}/tests/getsrc_die testfile-lex-inlines-no-aranges 0x0000000000000680 0x0000000000000681 0x0000000000000690 0x0000000000000691 exit 0