diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py --- a/lldb/packages/Python/lldbsuite/test/decorators.py +++ b/lldb/packages/Python/lldbsuite/test/decorators.py @@ -11,6 +11,7 @@ import sys import tempfile import subprocess +import distutils.spawn # Third-party modules import six @@ -881,3 +882,18 @@ return unittest2.skipIf( configuration.capture_path or configuration.replay_path, "reproducers unsupported")(func) + +def skipUnlessDWZInstalled(func): + """Decorate the item to skip tests when no DWZ optimization tool is available. + /usr/lib/rpm/sepdebugcrcfix is not tested here but it may be needed + when build-ids cannot be used.""" + + def is_dwz_missing(self): + if distutils.spawn.find_executable("dwz") is None: + return "skipping because dwz is not found" + # dwz has a bug it can process only separate debug info files. + # Moreover dwz is compatible only with debug infos created by eu-strip. + if distutils.spawn.find_executable("eu-strip") is None: + return "skipping because eu-strip is not found" + return None + return skipTestIfFn(is_dwz_missing)(func) diff --git a/lldb/packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile b/lldb/packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile new file mode 100644 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/linux/buildidsymlink/Makefile @@ -0,0 +1,24 @@ +LEVEL = ../../make +C_SOURCES := main.c +LD_EXTRAS += -Wl,--build-id=sha1 + +all: .build-id + +.PHONY: .build-id +stripped.out stripped.debug stripped.debug.dwz: a.out + eu-strip --remove-comment -f stripped.debug -F stripped.debugx -o stripped.out $< + cp -p stripped.debug stripped.debug.dup + dwz -m stripped.debug.dwz stripped.debug stripped.debug.dup + +.build-id: stripped.debug + $(OBJCOPY) -j .note.gnu.build-id -O binary $< tmp + rm -rf .build-id + fn=`od -An -tx1