summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tests: Add missing debuginfod-rpms/fedora31/hello3-*.rpm to EXTRA_DIST.Mark Wielaard2020-03-262-0/+16
| | | | | | | The new rpms were used in the new test. Make sure they are in the dist tar ball. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR25548: support canonicalized source-path names in debuginfod webapiFrank Ch. Eigler2020-03-269-4/+81
| | | | | | | | | | | | | Programs are sometimes compiled with source path names containing noise like /./ or // or /foo/../, and these survive into DWARF. This code allows either raw or canonicalized pathnames in the webapi, by letting the client pass things verbatim, and letting the server store/accept both raw and canonicalized path names for source files. Tests included & docs updated. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Reported-by: Eli Schwartz <eschwartz@archlinux.org> Tested-by: Eli Schwartz <eschwartz@archlinux.org>
* PR25367: improve debuginfod webapi loggingFrank Ch. Eigler2020-03-262-1/+19
| | | | | | | Improve debuginfod logging to show webapi query results including http status, sizes, and processing times. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* tests: Fix getphdrnum and run-lfs-symbols.sh testcase.Mark Wielaard2020-03-233-12/+23
| | | | | | | | | | | getphdrnum.c didn't include config.h which is why run-lfs-symbols.sh flagged it for containing bad (non-lfs) symbols. run-lfs-symbols.sh was still checking the libebl modules, which we don't create anymore. But it didn't fail the test for non-existing tests. Add some extra logging and explicitly check files exist. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add testcase for elf_getphdrnum with more than 65535 entries.Mark Wielaard2020-03-235-3/+201
| | | | | Signed-off-by: Mark Wielaard <mark@klomp.org> Signed-off-by: Omar Sandoval <osandov@fb.com>
* debuginfod client API: add get_url functionFrank Ch. Eigler2020-03-222-1/+7
| | | | | | | This function lets a client know, during or after a progressfn callback, what the url of the winning outgoing download is/was. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client: Update cache_path when the new default path existsAaron Merey2020-03-041-0/+7
| | | | | | | | | Update cache_path with the path of the new default directory when this directory already exists. Previously cache_path was updated only when creating the new default directory and would otherwise be set to the old default path. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod-client: default to XDG cache.Aaron Merey2020-02-282-1/+43
| | | | | | | | | | | | PR25502: debuginfod client should default to XDG cache Location of client cache now defaults to $XDG_CACHE_HOME/debuginfod_client. If XDG_CACHE_HOME is not set then fallback to $HOME/.cache/debuginfod_client. Also maintain backwards compatibility with the previous default path- if $HOME/.debuginfod_client_cache exists, use that instead of the new defaults. Signed-off-by: Aaron Merey <amerey@redhat.com>
* debuginfod: file:// URLs: handle curl resp. codeKonrad Kleine2020-02-262-1/+22
| | | | | | | | | | | | | | When file:// is used for DEBUGINFOD_URLS, then the response code for a successful server query is 0 and not 200. Using file:// can be helpful when you want to test your debuginfod-client integration against a mocked file tree that mimics the HTTP URLs from the debuginfod server. This way you don't have to run the debuginfod server at all. Fixes https://sourceware.org/bugzilla/show_bug.cgi?id=25600 Signed-off-by: Konrad Kleine <kkleine@redhat.com>
* tests: Explicitly unset DEBUGINFOD_URLS.Mark Wielaard2020-02-212-0/+7
| | | | | | | | | | If DEBUGINFOD_URLS is set various tests will try to query the debuginfod server which can stall the tests a bit. If other evironment variables like DEBUGINFOD_PROGRESS are set it will make various tests fail because the expected output doesn't match. Tests should PASS without needing a debuginfod server, unless they test (and set) one themselves. Signed-off-by: Mark Wielaard <mark@klomp.org>
* PR25365: debuginfod-client: restrict cleanup to client-pattern filesAaron Merey2020-02-192-0/+17
| | | | | | | | Avoid deleting general files and directories in case a user mis-sets $DEBUGINFOD_CACHE_PATH or accidentally moves a file into the cache. Signed-off-by: Aaron Merey <amerey@redhat.com>
* readelf, elflint: Handle PT_GNU_PROPERTY.Mark Wielaard2020-02-185-3/+149
| | | | | | | | | binutils 2.32 ld emits a new PT_GNU_PROPERTY segment that overlaps with the PT_NOTE segment covering the .note.gnu.property section data. https://sourceware.org/bugzilla/show_bug.cgi?id=25511 Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod testing: SIGUSR2 vs "groom" metric synchFrank Ch. Eigler2020-02-101-1/+2
| | | | | | | | | Previous code did not account for a groom job that was already completed at startup, so the SIGUSR2-triggered one may not have completed in time for the test. The shell won the race condition on most buildbot VMs, but a debian builder showed the error of our ways. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: testsuite for general archive (arch-linux) supportFrank Ch. Eigler2020-02-103-6/+25
| | | | | | Tested analogously to how RPMs are. Signed-Off-By: Frank Ch. Eigler <fche@redhat.com>
* debuginfod arch-linux test binariesEli Schwartz2020-02-105-0/+44
| | | | Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
* ChangeLog catchup for two recent commitsFrank Ch. Eigler2020-02-031-0/+4
| | | | Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod test: assert curl & rpm2cpio during test prologueFrank Ch. Eigler2020-02-031-9/+10
| | | | | | | | On debian & ubuntu hosts, rpm2cpio is not available by default, and heck, curl might not be either. Check for both these programs during tests/run-debuginfod-find.sh startup, else exit-77 (skip). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* PR25394 cont'd: debuginfod testsuite fix for -USR1 timingFrank Ch. Eigler2020-01-201-0/+1
| | | | | | If a SIGUSR1 is sent before the initial traversal, it no longer results in an extra traversal. That's a sensible effect. The test case just needs to wait before the kill -USR1.
* PR25394: debuginfod mutex between grooming and scanningfche/debuginfod-PR25394Frank Ch. Eigler2020-01-192-0/+5
| | | | | | | | | | | | | | | | | | | | Extended the work-queue concept with "idlers" - other threads that block on the work queue until it becomes empty (rather than normal consumers that block on it until it becomes non-empty). Use this facility for the groomer thread to avoid working at the same time as the scanner threads. Use this for the fts traversal thread for similar reasons. One user-visible effect: response to SIGUSR1 and SIGUSR2 will wait until the work queue runs empty, but the man page was unspecific so does not need changing. It's not obvious how to test this with a tests/ dataset so small that scanning takes negligible time, so the former races are very tight. P.S. We also evaluated using sqlite level transactions to isolate the scanner thread groups-of-operations from the groomer. These experiments failed to produce a nominally concurrent debuginfod, having triggered "database locked" type errors. So we remain single-threaded (fully serialized) at the sqlite API level.
* PR25415: fix debuginfod SEGV for empty search path listFrank Ch. Eigler2020-01-182-0/+16
| | | | | Prevent triggering undefined behaviour of fts(3), which causes a SEGV on fedora glibc 2.29.
* libasm.h: Don't include libebl.h. Define an opaque Ebl handle.Mark Wielaard2020-01-1210-0/+13
| | | | | | | | | Using libasm isn't really usable without a way to create an Ebl handle. But we don't support libebl.h (and libebl itself). Just define the Ebl handle as an opaque struct. Code that uses it needs to figure out how to instantiate one itself (they cannot in any supportable way...) Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod: extracted-from-archive file cacheFrank Ch. Eigler2020-01-112-7/+21
| | | | | | | | | | | Add a facility to service webapi and dwz/altdebug requests that resolve to archives via a $TMPDIR file cache. This permits instantaneous dwz resolution during -debuginfo rpm scanning, and also instantanous duplicate webapi requests. The cache is limited both in number of entries and in storage space. Heuristics provide serviceable defaults. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: rework threading model for file/archive scanningFrank Ch. Eigler2020-01-112-2/+10
| | | | | | | | | | We switch from a thread per supplied PATH, with a semaphore based concurrency control, to a fixed number of worker threads collecting the result of a plain directory traversal being put into a work queue. This allows maximal continuous concurrency, even if the PATH directories are dramatically differently sized. There is no more need to use concurrency-motivated subdirectory wildcards for PATH entries: just a single top level directory will work fast. doc & tests incl.
* debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.Mark Wielaard2020-01-102-1/+5
| | | | | | | Use just one timeout using CURLOPT_LOW_SPEED_TIME (default 90 seconds) and CURLOPT_LOW_SPEED_LIMIT (100K). Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod server: support .deb/.ddeb archivesFrank Ch. Eigler2019-12-228-23/+77
| | | | | | | | | Add support for scanning .deb / .ddeb files, enabled with a new command line option "-U". Using a synthetic .deb/.ddeb from a Ubuntu 18 machine, extend the debuginfod testsuite with some .deb processing, if the dpkg-deb binary is installed. Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* debuginfod: usability tweaks, incl. $DEBUGINFOD_PROGRESS client supportFrank Ch. Eigler2019-12-192-2/+9
| | | | | | | | | | This facility allows a default progress-printing function to be installed if the given environment variable is set. Some larger usage experience (systemtap fetching kernels) indicates the default timeout is too short, so forked it into a connection timeout (default short) and a transfer timeout (default unlimited). Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
* libdwfl: remove broken coalescing logic in dwfl_report_segmentOmar Sandoval2019-12-183-2/+91
| | | | | | | | | | | | dwfl_report_segment has some logic that detects when a segment is contiguous with the previously reported segment, in which case it's supposed to coalesce them. However, in this case, it actually returns without updating the segment array at all. As far as I can tell, this has always been broken. It appears that no one uses the coalescing logic anyways, as they pass IDENT as NULL. Let's just get rid of the logic and add a test case. Signed-off-by: Omar Sandoval <osandov@fb.com>
* Make sure to always build with build-ids.Mark Wielaard2019-12-112-2/+6
| | | | | | | | We really need build-ids for various things. If the system compiler doesn't generate build-ids warn and generate them anyway for both the binaries and the tests. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Run strip under testrun in run-debuginfod-find.shMark Wielaard2019-12-112-1/+5
| | | | | | | Otherwise strip might run against the system libelf which might be too old or missing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add break to avoid implicit-fallthrough warningMark Wielaard2019-12-112-0/+5
| | | | | | | | For some reason gcc might fail to recognize the assert (0) will never return and emit an implicit-fallthrough warning. Just add a break to silence it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Run elfcompress under testrun in run-elfclassify.shMark Wielaard2019-12-112-2/+6
| | | | | | | Otherwise elfcompress might run against the system libelf which might be too old or missing. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Fix BUILD_STATIC build and enable gcov for debuginfod.Mark Wielaard2019-11-263-3/+9
| | | | | | | | libdw now always needs -lpthread and -ld even when BUILD_STATIC. BUILD_STATIC is only used when doing a gcov enabled build. Enable gcov coverage also for debuginfod. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Don't sleep in run-debuginfod-find.sh, but wait till ready.Mark Wielaard2019-11-252-18/+88
| | | | | | | | Wait for the debuginfod server to finish and use the metrics to see when a server is ready for the next test instead of sleeping. Also remove DEBUGINFOD_TEST_WEBAPI_SLEEP. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Use 127.0.0.1 in run-debuginfod-find.sh instead of localhost.Mark Wielaard2019-11-232-10/+14
| | | | | | | | The way curl does hostname lookups in multi_curl mode takes a very long time under valgrind. Replace all localhosti hostnames with 127.0.0.1 so no lookups are necessary. Signed-off-by: Mark Wielaard <mark@klomp.org>
* debuginfod 5: add /metrics endpointFrank Ch. Eigler2019-11-232-1/+17
| | | | | | | | This webapi extensions allows admins to hook up debuginfod to a prometheus-compatible monitoring system for general situational statistics. The metrics are simple enough that local curl requests can give a user a sense of what's going on. The metrics are documented as unstable with respect to future versions.
* debuginfod 4: symbolic link traversal modeFrank Ch. Eigler2019-11-222-6/+27
| | | | | | In order to support file/rpm archives that are organized via symlink trees, add an "-L" option to debuginfod, meaning about the same as for find(1) or ls(1): to traverse rather than ignore symlinks.
* debuginfod 3/3: client interruptabilityFrank Ch. Eigler2019-11-222-2/+10
| | | | | | | | For interactive clients such as gdb, interruptibility is important for usability during longer downloads. This patchset adds a download-progress callback function to the debuginfod client library, with which a caller app can interrupt a download as well as be notified of its quantitative progress.
* debuginfod 2/2: server sideFrank Ch. Eigler2019-11-2219-3/+383
| | | | | | | | | | Add the server to the debuginfod/ subdirectory. This is a highly multithreaded c++11 program (still buildable on rhel7's gcc 4.8, which is only partly c++11 compliant). Includes an initial suite of tests, man pages, and a sample systemd service. Signed-off-by: Frank Ch. Eigler <fche@redhat.com> Signed-off-by: Aaron Merey <amerey@redhat.com>
* run-large-elf-file.sh: skip if free memory information is not availableAndreas Schwab2019-11-142-2/+7
|
* dwelf_elf_e_machine_string: Clear errno before calling strtolAndreas Schwab2019-11-142-0/+6
| | | | | | | Avoid spurious failure if errno is modified by any other library call in the test. Signed-off-by: Andreas Schwab <schwab@suse.de>
* readelf: Add --dyn-sym option.Mark Wielaard2019-09-102-0/+7
| | | | | | | | | | | It is already possible to select the symbol table to print by name, using --symbols=SECTION. This allows printing the dynamic symbol table with --symbols=.dynsym. binutils readelf allows printing just the dynamic symbol table by type using --dyn-sym. Add the same option and document it. Also add a testcase to show --symbols=.dynsym and --dyn-sym produce the same output. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add new riscv64 test files to EXTRA_DISTMark Wielaard2019-09-072-1/+8
| | | | Signed-off-by: Mark Wielaard <mark@klomp.org>
* Implement RISC-V disassemblerUlrich Drepper2019-09-065-1/+531
|
* readelf: Actually dump hex or strings when -p or -x get section number.Mark Wielaard2019-08-292-0/+11
| | | | | | | | The readelf code did parse section numbers, but then failed to actually dump the section found. Fixed by actually calling the dump function (either the hex or string variant). Add testcase for readelf -x num. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Use smaller self test files.Mark Wielaard2019-08-292-4/+10
| | | | | | Don't use the largest executables/libraries to reduce the make check time. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Don't use dlopen() for libebl modulesOmar Sandoval2019-08-293-21/+24
| | | | | | | | | | | | Currently, architecture-specific code for libebl exists in separate libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime. This makes it impossible to have standalone, statically-linked binaries which use libdwfl if they depend on any architecture-specific functionality. Additionally, when these libraries cannot be found, the failure modes are non-obvious. So, let's get rid of libebl_$arch.so and move it all into libdw.so/libdw.a, which simplifies things considerably. Signed-off-by: Omar Sandoval <osandov@fb.com>
* elfclassify: New tool to analyze ELF objects.Florian Weimer2019-08-134-3/+376
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usage: elfclassify [OPTION...] FILE... Determine the type of an ELF file. All of the classification options must apply at the same time to a particular file. Classification options can be negated using a "--not-" prefix. Since modern ELF does not clearly distinguish between programs and dynamic shared objects, you should normally use either --executable or --shared to identify the primary purpose of a file. Only one of the --shared and --executable checks can pass for a file. If you want to know whether an ELF object might a program or a shared library (but could be both), then use --program or --library. Some ELF files will classify as both a program and a library. If you just want to know whether an ELF file is loadable (as program or library) use --loadable. Note that files that only contain (separate) debug information (--debug-only) are never --loadable (even though they might contain program headers). Linux kernel modules are also not --loadable (in the normal sense). Without any of the --print options, the program exits with status 0 if the requested checks pass for all input files, with 1 if a check fails for any file, and 2 if there is an environmental issue (such as a file read error or a memory allocation error). When printing file names, the program exits with status 0 even if no file names are printed, and exits with status 2 if there is an environmental issue. On usage error (e.g. a bad option was given), the program exits with a status code larger than 2. The --quiet or -q oose_filestion suppresses some error warning output, but doesn't change the exit status. Classification options --core File is an ELF core dump file --debug-only File is a debug only ELF file (separate .debug, .dwo or dwz multi-file) --elf File looks like an ELF object or archive/static library (default) --elf-archive File is an ELF archive or static library --elf-file File is an regular ELF object (not an archive/static library) --executable File is (primarily) an ELF program executable (not primarily a DSO) --library File is an ELF shared object (DSO) (might also be an executable) --linux-kernel-module File is a linux kernel module --loadable File is a loadable ELF object (program or shared object) --program File is an ELF program executable (might also be a DSO) --shared File is (primarily) an ELF shared object (DSO) (not primarily an executable) --unstripped File is an ELF file with symbol table or .debug_* sections and can be stripped further Input flags -f, --file Only classify regular (not symlink nor special device) files --no-stdin Do not read files from standard input (default) --stdin Also read file names to process from standard input, separated by newlines --stdin0 Also read file names to process from standard input, separated by ASCII NUL bytes -z, --compressed Try to open compressed files or embedded (kernel) ELF images Output flags --matching If printing file names, print matching files (default) --no-print Do not output file names --not-matching If printing file names, print files that do not match --print Output names of files, separated by newline --print0 Output names of files, separated by ASCII NUL Additional flags -q, --quiet Suppress some error output (counterpart to --verbose) -v, --verbose Output additional information (can be specified multiple times) -?, --help Give this help list --usage Give a short usage message -V, --version Print program version Report bugs to https://sourceware.org/bugzilla. Signed-off-by: Florian Weimer <fweimer@redhat.com> Signed-off-by: Mark Wielaard <mark@klomp.org>
* Add backend support for C-SKYMao Han2019-07-176-2/+56
| | | | | | | | | C-SKY V2 ABI manual: https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf C-SKY architecture user guide: https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf Signed-off-by: Mao Han <han_mao@c-sky.com>
* libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.Mark Wielaard2019-07-104-3/+112
| | | | | | | | | | | | | | | | To print eh human readable description of the ELF e_machine header field we used the ebl name. But this is not set for most EM constants. Introduce a new function dwelf_elf_e_machine_string that does work for all known EM values. Use that in eu-readelf to print a string representation of the e_machine value. Since this was the only usage of ebl->name, remove that from struct ebl. Also add a testcase that makes sure dwelf_elf_e_machine_string works for all EM values in the libelf/elf.h header so we will immediately notice when a new value appears. Signed-off-by: Mark Wielaard <mark@klomp.org>
* tests: Add 2GB to mem_needed running run-large-elf-file.sh with valgrindMark Wielaard2019-07-012-2/+13
| | | | | | Running under valgrind just requires even more free memory. Signed-off-by: Mark Wielaard <mark@klomp.org>