[COMMITTED] tests: Add a bit less and slightly smaller sections for addsections
Commit Message
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 <mark@klomp.org>
---
tests/addsections.c | 7 ++++---
tests/run-copymany-sections.sh | 5 +++--
2 files changed, 7 insertions(+), 5 deletions(-)
@@ -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);
}
@@ -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