From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 5947B3858D35 for ; Sat, 17 Jun 2023 00:11:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5947B3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 9675A313ACBE; Sat, 17 Jun 2023 02:11:46 +0200 (CEST) Received: by csb.redhat.com (Postfix, from userid 10916) id 4A0BADD100; Sat, 17 Jun 2023 02:11:46 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] tests: Add a bit less and slightly smaller sections for addsections Date: Sat, 17 Jun 2023 02:11:44 +0200 Message-Id: <20230617001144.232737-1-mark@klomp.org> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3035.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,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 List-Id: The run-copymany-sections.sh testcase adds 64K sections (twice) to a couple of times. Each section is just 6 bytes long, but each data section is malloced and freed. That adds up. And is especially slow when running under valgrind. Reduce the number of sections added to 32K (twice) and make each section data just one single zero byte. * tests/addsections.c (add_sections): Don't strdup and free the string ".extra", but just add the empty string. * tests/run-copymany-sections.sh: Call addsections with 32768 instead of 65535. Signed-off-by: Mark Wielaard --- tests/addsections.c | 7 ++++--- tests/run-copymany-sections.sh | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/addsections.c b/tests/addsections.c index c1b0fa81..a4e42038 100644 --- a/tests/addsections.c +++ b/tests/addsections.c @@ -153,8 +153,8 @@ add_sections (const char *name, size_t nr, int use_mmap, size_t sec_size) size_t bufsz; if (sec_size == 0) { - buf = strdup ("extra"); - bufsz = strlen ("extra") + 1; + buf = ""; + bufsz = 1; } else { @@ -293,7 +293,8 @@ add_sections (const char *name, size_t nr, int use_mmap, size_t sec_size) exit (1); } - free (buf); + if (sec_size != 0) + free (buf); free (new_shstrtab_buf); } diff --git a/tests/run-copymany-sections.sh b/tests/run-copymany-sections.sh index 84c052c9..01348229 100755 --- a/tests/run-copymany-sections.sh +++ b/tests/run-copymany-sections.sh @@ -35,12 +35,13 @@ test_copy_and_add () testrun ${abs_top_builddir}/src/elfcmp ${in_file} ${out_file} # Can we add a section (in-place)? - testrun ${abs_builddir}/addsections 65535 ${out_file} + testrun ${abs_builddir}/addsections 32768 ${out_file} testrun ${abs_top_builddir}/src/readelf -S ${out_file} > readelf.out nr=$(grep '.extra' readelf.out | wc -l) # We try twice... - if test ${nr} != 65535 -a ${nr} != 131070; then + if test ${nr} != 32768 -a ${nr} != 65536; then # Show what went wrong + echo nr: ${nr} testrun ${abs_top_builddir}/src/readelf -S ${out_file} exit 1 fi -- 2.39.3