summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2019-06-17 11:23:23 +0200
committerPanu Matilainen <pmatilai@redhat.com>2019-06-19 15:06:55 +0300
commitb0147ecc9ba5d8f81b4176af2e1adc019521c920 (patch)
tree2f4a44fe3176068ead690e86cdf7ec60cc4f39e6 /tools
parent0c6a9841a7b03ac80b2289cf7f7bb36458c93d1b (diff)
downloadrpm-b0147ecc9ba5d8f81b4176af2e1adc019521c920.tar.gz
Add some debugedit tests.
debugedit didn't have any direct tests, it was only tested indirectly through some other debuginfo testcases. So add some testcases that just test debugedit functionality directly. The tests create different kinds of ELF files (object files, partially linked files and executables) and run debugedit path replacements on them, checking that the resulting .debug_str, .debug_info and .debug_line sections look sane. Testcases verified against various different gcc and binutils versions. gcc 4.8 and gcc 6 generate slightly different .debuginfo Also add debugedit --version. Which makes it easy to see we are testing the correct version/install of debugedit in rpmtests.log. Adjust autotest paths to include rpmlibexecdir, where debuginfo is installed. Note that rpmlibexecdir != libexecdir (see rpm.am).
Diffstat (limited to 'tools')
-rw-r--r--tools/debugedit.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/debugedit.c b/tools/debugedit.c
index 84568dd29..4be85b979 100644
--- a/tools/debugedit.c
+++ b/tools/debugedit.c
@@ -88,6 +88,8 @@ int do_build_id = 0;
int no_recompute_build_id = 0;
char *build_id_seed = NULL;
+int show_version = 0;
+
/* We go over the debug sections in two phases. In phase zero we keep
track of any needed changes and collect strings, indexes and
sizes. In phase one we do the actual replacements updating the
@@ -2291,6 +2293,8 @@ static struct poptOption optionsTable[] = {
"if recomputing the build ID note use this string as hash seed", NULL },
{ "no-recompute-build-id", 'n', POPT_ARG_NONE, &no_recompute_build_id, 0,
"do not recompute build ID note even when -i or -s are given", NULL },
+ { "version", '\0', POPT_ARG_NONE, &show_version, 0,
+ "print the debugedit version", NULL },
POPT_AUTOHELP
{ NULL, 0, 0, NULL, 0, NULL, NULL }
};
@@ -2527,6 +2531,12 @@ main (int argc, char *argv[])
exit (1);
}
+ if (show_version)
+ {
+ printf("RPM debugedit %s\n", VERSION);
+ exit(EXIT_SUCCESS);
+ }
+
args = poptGetArgs (optCon);
if (args == NULL || args[0] == NULL || args[1] != NULL)
{