1*4882a593SmuzhiyunSECTION = "devel" 2*4882a593SmuzhiyunSUMMARY = "Linux Trace Toolkit Control" 3*4882a593SmuzhiyunDESCRIPTION = "The Linux trace toolkit is a suite of tools designed \ 4*4882a593Smuzhiyunto extract program execution details from the Linux operating system \ 5*4882a593Smuzhiyunand interpret them." 6*4882a593SmuzhiyunHOMEPAGE = "https://github.com/lttng/lttng-tools" 7*4882a593Smuzhiyun 8*4882a593SmuzhiyunLICENSE = "GPL-2.0-only & LGPL-2.1-only" 9*4882a593SmuzhiyunLIC_FILES_CHKSUM = "file://LICENSE;md5=40ef17463fbd6f377db3c47b1cbaded8 \ 10*4882a593Smuzhiyun file://LICENSES/GPL-2.0;md5=e68f69a54b44ba526ad7cb963e18fbce \ 11*4882a593Smuzhiyun file://LICENSES/LGPL-2.1;md5=9920968d0f2ff585ce61fae30344dd95" 12*4882a593Smuzhiyun 13*4882a593Smuzhiyuninclude lttng-platforms.inc 14*4882a593Smuzhiyun 15*4882a593SmuzhiyunDEPENDS = "liburcu popt libxml2 util-linux bison-native" 16*4882a593SmuzhiyunRDEPENDS:${PN} = "libgcc" 17*4882a593SmuzhiyunRRECOMMENDS:${PN} += "${LTTNGMODULES}" 18*4882a593SmuzhiyunRDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep" 19*4882a593SmuzhiyunRDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils" 20*4882a593SmuzhiyunRDEPENDS:${PN}-ptest:append:libc-musl = " musl-utils" 21*4882a593Smuzhiyun# babelstats.pl wants getopt-long 22*4882a593SmuzhiyunRDEPENDS:${PN}-ptest += "perl-module-getopt-long" 23*4882a593Smuzhiyun 24*4882a593SmuzhiyunPYTHON_OPTION = "am_cv_python_pyexecdir='${PYTHON_SITEPACKAGES_DIR}' \ 25*4882a593Smuzhiyun am_cv_python_pythondir='${PYTHON_SITEPACKAGES_DIR}' \ 26*4882a593Smuzhiyun PYTHON_INCLUDE='-I${STAGING_INCDIR}/python${PYTHON_BASEVERSION}${PYTHON_ABI}' \ 27*4882a593Smuzhiyun" 28*4882a593SmuzhiyunPACKAGECONFIG ??= "${LTTNGUST} kmod" 29*4882a593SmuzhiyunPACKAGECONFIG[python] = "--enable-python-bindings ${PYTHON_OPTION},,python3 swig-native" 30*4882a593SmuzhiyunPACKAGECONFIG[lttng-ust] = "--with-lttng-ust, --without-lttng-ust, lttng-ust" 31*4882a593SmuzhiyunPACKAGECONFIG[kmod] = "--with-kmod, --without-kmod, kmod" 32*4882a593SmuzhiyunPACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages, asciidoc-native xmlto-native libxslt-native" 33*4882a593Smuzhiyun 34*4882a593SmuzhiyunSRC_URI = "https://lttng.org/files/lttng-tools/lttng-tools-${PV}.tar.bz2 \ 35*4882a593Smuzhiyun file://0001-tests-do-not-strip-a-helper-library.patch \ 36*4882a593Smuzhiyun file://run-ptest \ 37*4882a593Smuzhiyun file://lttng-sessiond.service \ 38*4882a593Smuzhiyun file://disable-tests.patch \ 39*4882a593Smuzhiyun " 40*4882a593Smuzhiyun 41*4882a593SmuzhiyunSRC_URI[sha256sum] = "8d94dc95b608cf70216b01203a3f8242b97a232db2e23421a2f43708da08f337" 42*4882a593Smuzhiyun 43*4882a593Smuzhiyuninherit autotools ptest pkgconfig useradd python3-dir manpages systemd 44*4882a593Smuzhiyun 45*4882a593SmuzhiyunCACHED_CONFIGUREVARS = "PGREP=/usr/bin/pgrep" 46*4882a593Smuzhiyun 47*4882a593SmuzhiyunSYSTEMD_SERVICE:${PN} = "lttng-sessiond.service" 48*4882a593SmuzhiyunSYSTEMD_AUTO_ENABLE = "disable" 49*4882a593Smuzhiyun 50*4882a593SmuzhiyunUSERADD_PACKAGES = "${PN}" 51*4882a593SmuzhiyunGROUPADD_PARAM:${PN} = "tracing" 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunFILES:${PN} += "${libdir}/lttng/libexec/* ${datadir}/xml/lttng \ 54*4882a593Smuzhiyun ${PYTHON_SITEPACKAGES_DIR}/*" 55*4882a593SmuzhiyunFILES:${PN}-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a" 56*4882a593SmuzhiyunFILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la" 57*4882a593Smuzhiyun 58*4882a593Smuzhiyun# Since files are installed into ${libdir}/lttng/libexec we match 59*4882a593Smuzhiyun# the libexec insane test so skip it. 60*4882a593Smuzhiyun# Python module needs to keep _lttng.so 61*4882a593SmuzhiyunINSANE_SKIP:${PN} = "libexec dev-so" 62*4882a593SmuzhiyunINSANE_SKIP:${PN}-dbg = "libexec" 63*4882a593Smuzhiyun 64*4882a593SmuzhiyunPRIVATE_LIBS:${PN}-ptest = "libfoo.so" 65*4882a593Smuzhiyun 66*4882a593Smuzhiyundo_install:append () { 67*4882a593Smuzhiyun # install systemd unit file 68*4882a593Smuzhiyun install -d ${D}${systemd_system_unitdir} 69*4882a593Smuzhiyun install -m 0644 ${WORKDIR}/lttng-sessiond.service ${D}${systemd_system_unitdir} 70*4882a593Smuzhiyun} 71*4882a593Smuzhiyun 72*4882a593Smuzhiyundo_install_ptest () { 73*4882a593Smuzhiyun for f in Makefile tests/Makefile tests/utils/utils.sh tests/regression/tools/save-load/*.lttng \ 74*4882a593Smuzhiyun tests/regression/tools/save-load/configuration/load-42*.lttng tests/regression/tools/health/test_health.sh \ 75*4882a593Smuzhiyun tests/regression/tools/metadata/utils.sh tests/regression/tools/rotation/rotate_utils.sh \ 76*4882a593Smuzhiyun tests/regression/tools/notification/util_event_generator.sh \ 77*4882a593Smuzhiyun tests/regression/tools/base-path/*.lttng; do 78*4882a593Smuzhiyun install -D "${B}/$f" "${D}${PTEST_PATH}/$f" 79*4882a593Smuzhiyun done 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun for f in tests/utils/tap-driver.sh config/test-driver src/common/config/session.xsd src/common/mi-lttng-4.1.xsd; do 82*4882a593Smuzhiyun install -D "${S}/$f" "${D}${PTEST_PATH}/$f" 83*4882a593Smuzhiyun done 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun # Patch in the correct path for the custom libraries a helper executable needs 86*4882a593Smuzhiyun sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!' "${D}${PTEST_PATH}/run-ptest" 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun # Prevent 'make check' from recursing into non-test subdirectories. 89*4882a593Smuzhiyun sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile" 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun # We don't need these 92*4882a593Smuzhiyun sed -i -e '/dist_noinst_SCRIPTS = /,/^$/d' "${D}${PTEST_PATH}/tests/Makefile" 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun # We shouldn't need to build anything in tests/utils 95*4882a593Smuzhiyun sed -i -e 's!am__append_1 = . utils!am__append_1 = . !' \ 96*4882a593Smuzhiyun "${D}${PTEST_PATH}/tests/Makefile" 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun # Copy the tests directory tree and the executables and 99*4882a593Smuzhiyun # Makefiles found within. 100*4882a593Smuzhiyun for d in $(find "${B}/tests" -type d -not -name .libs -printf '%P ') ; do 101*4882a593Smuzhiyun install -d "${D}${PTEST_PATH}/tests/$d" 102*4882a593Smuzhiyun find "${B}/tests/$d" -maxdepth 1 -executable -type f \ 103*4882a593Smuzhiyun -exec install -t "${D}${PTEST_PATH}/tests/$d" {} + 104*4882a593Smuzhiyun # Take all .py scripts for tests using the python bindings. 105*4882a593Smuzhiyun find "${B}/tests/$d" -maxdepth 1 -type f -name "*.py" \ 106*4882a593Smuzhiyun -exec install -t "${D}${PTEST_PATH}/tests/$d" {} + 107*4882a593Smuzhiyun test -r "${B}/tests/$d/Makefile" && \ 108*4882a593Smuzhiyun install -t "${D}${PTEST_PATH}/tests/$d" "${B}/tests/$d/Makefile" 109*4882a593Smuzhiyun done 110*4882a593Smuzhiyun 111*4882a593Smuzhiyun for d in $(find "${B}/tests" -type d -name .libs -printf '%P ') ; do 112*4882a593Smuzhiyun for f in $(find "${B}/tests/$d" -maxdepth 1 -executable -type f -printf '%P ') ; do 113*4882a593Smuzhiyun cp ${B}/tests/$d/$f ${D}${PTEST_PATH}/tests/`dirname $d`/$f 114*4882a593Smuzhiyun case $f in 115*4882a593Smuzhiyun *.so|userspace-probe-elf-*) 116*4882a593Smuzhiyun install -d ${D}${PTEST_PATH}/tests/$d/ 117*4882a593Smuzhiyun ln -s ../$f ${D}${PTEST_PATH}/tests/$d/$f 118*4882a593Smuzhiyun # Remove any rpath/runpath to pass QA check. 119*4882a593Smuzhiyun chrpath --delete ${D}${PTEST_PATH}/tests/$d/$f 120*4882a593Smuzhiyun ;; 121*4882a593Smuzhiyun esac 122*4882a593Smuzhiyun done 123*4882a593Smuzhiyun done 124*4882a593Smuzhiyun 125*4882a593Smuzhiyun chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary 126*4882a593Smuzhiyun chrpath --delete ${D}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary 127*4882a593Smuzhiyun chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libbar.so 128*4882a593Smuzhiyun chrpath --delete ${D}${PTEST_PATH}/tests/regression/ust/ust-dl/libfoo.so 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun # 131*4882a593Smuzhiyun # Use the versioned libs of liblttng-ust-dl. 132*4882a593Smuzhiyun # 133*4882a593Smuzhiyun ustdl="${D}${PTEST_PATH}/tests/regression/ust/ust-dl/test_ust-dl.py" 134*4882a593Smuzhiyun if [ -e $ustdl ]; then 135*4882a593Smuzhiyun sed -i -e 's!:liblttng-ust-dl.so!:liblttng-ust-dl.so.0!' $ustdl 136*4882a593Smuzhiyun fi 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun install ${B}/tests/unit/ini_config/sample.ini ${D}${PTEST_PATH}/tests/unit/ini_config/ 139*4882a593Smuzhiyun 140*4882a593Smuzhiyun # We shouldn't need to build anything in tests/regression/tools 141*4882a593Smuzhiyun sed -i -e 's!^SUBDIRS = tools !SUBDIRS = !' \ 142*4882a593Smuzhiyun "${D}${PTEST_PATH}/tests/regression/Makefile" 143*4882a593Smuzhiyun 144*4882a593Smuzhiyun # Prevent attempts to update Makefiles during test runs, and 145*4882a593Smuzhiyun # silence "Making check in $SUBDIR" messages. 146*4882a593Smuzhiyun find "${D}${PTEST_PATH}" -name Makefile -type f -exec \ 147*4882a593Smuzhiyun sed -i -e '/Makefile:/,/^$/d' -e '/%: %.in/,/^$/d' \ 148*4882a593Smuzhiyun -e '/echo "Making $$target in $$subdir"; \\/d' \ 149*4882a593Smuzhiyun -e 's/^srcdir = \(.*\)/srcdir = ./' \ 150*4882a593Smuzhiyun -e 's/^builddir = \(.*\)/builddir = ./' \ 151*4882a593Smuzhiyun -e 's/^all-am:.*/all-am:/' \ 152*4882a593Smuzhiyun {} + 153*4882a593Smuzhiyun 154*4882a593Smuzhiyun find "${D}${PTEST_PATH}" -name Makefile -type f -exec \ 155*4882a593Smuzhiyun touch -r "${B}/Makefile" {} + 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun # 158*4882a593Smuzhiyun # Need to stop generated binaries from rebuilding by removing their source dependencies 159*4882a593Smuzhiyun # 160*4882a593Smuzhiyun sed -e 's#\(^test.*OBJECTS.=\)#disable\1#g' \ 161*4882a593Smuzhiyun -e 's#\(^test.*DEPENDENCIES.=\)#disable\1#g' \ 162*4882a593Smuzhiyun -e 's#\(^test.*SOURCES.=\)#disable\1#g' \ 163*4882a593Smuzhiyun -e 's#\(^test.*LDADD.=\)#disable\1#g' \ 164*4882a593Smuzhiyun -i ${D}${PTEST_PATH}/tests/unit/Makefile 165*4882a593Smuzhiyun 166*4882a593Smuzhiyun # Fix hardcoded build path 167*4882a593Smuzhiyun sed -e 's#TESTAPP_PATH=.*/tests/regression/#TESTAPP_PATH="${PTEST_PATH}/tests/regression/#' \ 168*4882a593Smuzhiyun -i ${D}${PTEST_PATH}/tests/regression/ust/python-logging/test_python_logging 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun # Substitute links to installed binaries. 171*4882a593Smuzhiyun for prog in lttng lttng-relayd lttng-sessiond lttng-consumerd lttng-crash; do 172*4882a593Smuzhiyun exedir="${D}${PTEST_PATH}/src/bin/${prog}" 173*4882a593Smuzhiyun install -d "$exedir" 174*4882a593Smuzhiyun case "$prog" in 175*4882a593Smuzhiyun lttng-consumerd) 176*4882a593Smuzhiyun ln -s "${libdir}/lttng/libexec/$prog" "$exedir" 177*4882a593Smuzhiyun ;; 178*4882a593Smuzhiyun *) 179*4882a593Smuzhiyun ln -s "${bindir}/$prog" "$exedir" 180*4882a593Smuzhiyun ;; 181*4882a593Smuzhiyun esac 182*4882a593Smuzhiyun done 183*4882a593Smuzhiyun} 184*4882a593Smuzhiyun 185*4882a593SmuzhiyunINHIBIT_PACKAGE_STRIP_FILES = "\ 186*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/userspace-probe-elf-binary \ 187*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary \ 188*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/userspace-probe-elf-cxx-binary \ 189*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/userspace-probe-elf-cxx-binary/.libs/userspace-probe-elf-cxx-binary \ 190*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/gen-syscall-events \ 191*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events/.libs/gen-syscall-events \ 192*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/gen-syscall-events-callstack \ 193*4882a593Smuzhiyun ${PKGD}${PTEST_PATH}/tests/utils/testapp/gen-syscall-events-callstack/.libs/gen-syscall-events-callstack \ 194*4882a593Smuzhiyun " 195