summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2017-04-05 17:09:27 +0200
committerMark Wielaard <[email protected]>2017-04-05 17:09:27 +0200
commitcaf135b7f49f9f3499c952b352493cf561ae12bd (patch)
treed259d672bd575361f126bab6f779e8355bd73e61 /tests
parentf339da994fda25b51cddc3d88182f249b75f89ff (diff)
elflint: Support checking ELF files with compressed sections.
Simply unconditionally uncompress any section to make sure indexes between sections check out. Add some testcases with various compressed sections. https://sourceware.org/bugzilla/show_bug.cgi?id=21332 Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog6
-rwxr-xr-xtests/run-elflint-self.sh3
-rwxr-xr-xtests/run-elflint-test.sh10
-rw-r--r--tests/test-subr.sh20
4 files changed, 37 insertions, 2 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 3479cf07..5f7bcddb 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-05 Mark Wielaard <[email protected]>
+
+ * test-subr.sh (testrun_on_self_compressed): New function.
+ * run-elflint-self.sh: Call testrun_on_self_compressed.
+ * run-elflint-test.sh: Add testfile42z and testfile-s390x-hash-bothz.
+
2017-03-30 Mark Wielaard <[email protected]>
* peel_type.c: New file.
diff --git a/tests/run-elflint-self.sh b/tests/run-elflint-self.sh
index 013109db..58fa7d0f 100755
--- a/tests/run-elflint-self.sh
+++ b/tests/run-elflint-self.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2005, 2007 Red Hat, Inc.
+# Copyright (C) 2005, 2007, 2017 Red Hat, Inc.
# This file is part of elfutils.
# Written by Ulrich Drepper <[email protected]>, 2005.
#
@@ -19,3 +19,4 @@
. $srcdir/test-subr.sh
testrun_on_self ${abs_top_builddir}/src/elflint --quiet --gnu-ld
+testrun_on_self_compressed ${abs_top_builddir}/src/elflint --quiet --gnu-ld
diff --git a/tests/run-elflint-test.sh b/tests/run-elflint-test.sh
index f3bd9012..caf172a6 100755
--- a/tests/run-elflint-test.sh
+++ b/tests/run-elflint-test.sh
@@ -33,6 +33,11 @@ testrun ${abs_top_builddir}/src/elflint -q testfile33
testfiles testfile42
testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile42
+# Contains debuginfo, compress it, recheck
+tempfiles testfile42z
+testrun ${abs_top_builddir}/src/elfcompress -f -q -o testfile42z testfile42
+testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile42z
+
testfiles testfile46
testrun ${abs_top_builddir}/src/elflint -q testfile46
@@ -47,4 +52,9 @@ testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testlib_dynseg.so
testfiles testfile-s390x-hash-both
testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile-s390x-hash-both
+# Compress the symtab/strtab just because and recheck
+tempfiles testfile-s390x-hash-bothz
+testrun ${abs_top_builddir}/src/elfcompress -f -q --name='.s??tab' -o testfile-s390x-hash-bothz testfile-s390x-hash-both
+testrun ${abs_top_builddir}/src/elflint -q --gnu-ld testfile-s390x-hash-bothz
+
exit 0
diff --git a/tests/test-subr.sh b/tests/test-subr.sh
index f397aed1..a765db63 100644
--- a/tests/test-subr.sh
+++ b/tests/test-subr.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2005-2015 Red Hat, Inc.
+# Copyright (C) 2005-2015, 2017 Red Hat, Inc.
# This file is part of elfutils.
#
# This file is free software; you can redistribute it and/or modify
@@ -139,6 +139,24 @@ testrun_on_self()
if test $exit_status != 0; then exit $exit_status; fi
}
+# Compress the files first. Compress both debug sections and symtab.
+testrun_on_self_compressed()
+{
+ exit_status=0
+
+ for file in $self_test_files; do
+ tempfiles ${file}z
+ testrun ${abs_top_builddir}/src/elfcompress -f -q -o ${file}z ${file}
+ testrun ${abs_top_builddir}/src/elfcompress -f -q --name='.s??tab' ${file}z
+
+ testrun $* ${file}z \
+ || { echo "*** failure in $* ${file}z"; exit_status=1; }
+ done
+
+ # Only exit if something failed
+ if test $exit_status != 0; then exit $exit_status; fi
+}
+
# Same as above, but redirects stdout to /dev/null
testrun_on_self_quiet()
{