xref: /OK3568_Linux_fs/yocto/poky/meta/recipes-extended/ltp/ltp_20220121.bb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunSUMMARY = "Linux Test Project"
2*4882a593SmuzhiyunDESCRIPTION = "The Linux Test Project is a joint project with SGI, IBM, OSDL, and Bull with a goal to deliver test suites to the open source community that validate the reliability, robustness, and stability of Linux. The Linux Test Project is a collection of tools for testing the Linux kernel and related features."
3*4882a593SmuzhiyunHOMEPAGE = "https://linux-test-project.github.io/"
4*4882a593SmuzhiyunSECTION = "console/utils"
5*4882a593SmuzhiyunLICENSE = "GPL-2.0-only & GPL-2.0-or-later & LGPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause"
6*4882a593SmuzhiyunLIC_FILES_CHKSUM = "\
7*4882a593Smuzhiyun    file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
8*4882a593Smuzhiyun    file://testcases/open_posix_testsuite/COPYING;md5=48b1c5ec633e3e30ec2cf884ae699947 \
9*4882a593Smuzhiyun    file://testcases/network/can/filter-tests/COPYING;md5=5b155ea7d7f86eae8e8832955d8b70bc \
10*4882a593Smuzhiyun"
11*4882a593Smuzhiyun
12*4882a593SmuzhiyunDEPENDS = "attr libaio libcap acl openssl zip-native"
13*4882a593SmuzhiyunDEPENDS:append:libc-musl = " fts "
14*4882a593SmuzhiyunEXTRA_OEMAKE:append:libc-musl = " LIBC=musl "
15*4882a593SmuzhiyunEXTRA_OECONF:append:libc-musl = " LIBS=-lfts "
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun# since ltp contains x86-64 assembler which uses the frame-pointer register,
18*4882a593Smuzhiyun# set -fomit-frame-pointer x86-64 to handle cases where optimisation
19*4882a593Smuzhiyun# is set to -O0 or frame pointers have been enabled by -fno-omit-frame-pointer
20*4882a593Smuzhiyun# earlier in CFLAGS, etc.
21*4882a593SmuzhiyunCFLAGS:append:x86-64 = " -fomit-frame-pointer"
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunCFLAGS:append:powerpc64 = " -D__SANE_USERSPACE_TYPES__"
24*4882a593SmuzhiyunCFLAGS:append:mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
25*4882a593SmuzhiyunSRCREV = "b0561ad8d9ee9fe1244b5385e941eb65a21e91a1"
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunSRC_URI = "git://github.com/linux-test-project/ltp.git;branch=master;protocol=https \
28*4882a593Smuzhiyun           file://0001-Remove-OOM-tests-from-runtest-mm.patch \
29*4882a593Smuzhiyun           file://0001-metadata-parse.sh-sort-filelist-for-reproducibility.patch \
30*4882a593Smuzhiyun           file://disable_hanging_tests.patch \
31*4882a593Smuzhiyun           file://0001-syscalls-pread02-extend-buffer-to-avoid-glibc-overflow-detection.patch \
32*4882a593Smuzhiyun           file://0001-clock_gettime04-set-threshold-based-on-the-clock-res.patch \
33*4882a593Smuzhiyun           "
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunS = "${WORKDIR}/git"
36*4882a593Smuzhiyun
37*4882a593Smuzhiyuninherit autotools-brokensep pkgconfig
38*4882a593Smuzhiyun
39*4882a593SmuzhiyunTARGET_CC_ARCH += "${LDFLAGS}"
40*4882a593Smuzhiyun
41*4882a593Smuzhiyunexport prefix = "/opt/${PN}"
42*4882a593Smuzhiyunexport exec_prefix = "/opt/${PN}"
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunPACKAGECONFIG[numa] = "--with-numa, --without-numa, numactl,"
45*4882a593SmuzhiyunEXTRA_AUTORECONF += "-I ${S}/testcases/realtime/m4"
46*4882a593SmuzhiyunEXTRA_OECONF = " --with-realtime-testsuite --with-open-posix-testsuite "
47*4882a593Smuzhiyun# ltp network/rpc test cases ftbfs when libtirpc is found
48*4882a593SmuzhiyunEXTRA_OECONF += " --without-tirpc "
49*4882a593Smuzhiyun
50*4882a593Smuzhiyundo_compile() {
51*4882a593Smuzhiyun    oe_runmake HOSTCC="${CC_FOR_BUILD}" HOST_CFLAGS="${CFLAGS_FOR_BUILD}" HOST_LDFLAGS="${LDFLAGS_FOR_BUILD}"
52*4882a593Smuzhiyun}
53*4882a593Smuzhiyun
54*4882a593Smuzhiyundo_install(){
55*4882a593Smuzhiyun    install -d ${D}${prefix}/
56*4882a593Smuzhiyun    oe_runmake DESTDIR=${D} SKIP_IDCHECK=1 install include-install
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun    # fixup not deploy STPfailure_report.pl to avoid confusing about it fails to run
59*4882a593Smuzhiyun    # as it lacks dependency on some perl moudle such as LWP::Simple
60*4882a593Smuzhiyun    # And this script previously works as a tool for analyzing failures from LTP
61*4882a593Smuzhiyun    # runs on the OSDL's Scaleable Test Platform (STP) and it mainly accesses
62*4882a593Smuzhiyun    # http://khack.osdl.org to retrieve ltp test results run on
63*4882a593Smuzhiyun    # OSDL's Scaleable Test Platform, but now http://khack.osdl.org unaccessible
64*4882a593Smuzhiyun    rm -rf ${D}${prefix}/bin/STPfailure_report.pl
65*4882a593Smuzhiyun
66*4882a593Smuzhiyun    # Copy POSIX test suite into ${D}${prefix}/testcases by manual
67*4882a593Smuzhiyun    cp -r testcases/open_posix_testsuite ${D}${prefix}/testcases
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun    # Makefile were configured in the build system
70*4882a593Smuzhiyun    find ${D}${prefix} -name Makefile | xargs -n 1 sed -i \
71*4882a593Smuzhiyun         -e 's@[^ ]*-fdebug-prefix-map=[^ "]*@@g' \
72*4882a593Smuzhiyun         -e 's@[^ ]*-fmacro-prefix-map=[^ "]*@@g' \
73*4882a593Smuzhiyun         -e 's@[^ ]*-ffile-prefix-map=[^ "]*@@g' \
74*4882a593Smuzhiyun         -e 's@[^ ]*--sysroot=[^ "]*@@g'
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun    # The controllers memcg_stree test seems to cause us hangs and takes 900s
77*4882a593Smuzhiyun    # (maybe we expect more regular output?), anyhow, skip it
78*4882a593Smuzhiyun    sed -e '/^memcg_stress/d' -i ${D}${prefix}/runtest/controllers
79*4882a593Smuzhiyun}
80*4882a593Smuzhiyun
81*4882a593SmuzhiyunRDEPENDS:${PN} = "\
82*4882a593Smuzhiyun    attr \
83*4882a593Smuzhiyun    bash \
84*4882a593Smuzhiyun    bc \
85*4882a593Smuzhiyun    coreutils \
86*4882a593Smuzhiyun    cpio \
87*4882a593Smuzhiyun    cronie \
88*4882a593Smuzhiyun    curl \
89*4882a593Smuzhiyun    e2fsprogs \
90*4882a593Smuzhiyun    e2fsprogs-mke2fs \
91*4882a593Smuzhiyun    expect \
92*4882a593Smuzhiyun    file \
93*4882a593Smuzhiyun    gawk \
94*4882a593Smuzhiyun    gdb \
95*4882a593Smuzhiyun    gzip \
96*4882a593Smuzhiyun    iproute2 \
97*4882a593Smuzhiyun    ldd \
98*4882a593Smuzhiyun    libaio \
99*4882a593Smuzhiyun    logrotate \
100*4882a593Smuzhiyun    net-tools \
101*4882a593Smuzhiyun    perl \
102*4882a593Smuzhiyun    python3-core \
103*4882a593Smuzhiyun    procps \
104*4882a593Smuzhiyun    quota \
105*4882a593Smuzhiyun    unzip \
106*4882a593Smuzhiyun    util-linux \
107*4882a593Smuzhiyun    which \
108*4882a593Smuzhiyun    tar \
109*4882a593Smuzhiyun"
110*4882a593Smuzhiyun
111*4882a593SmuzhiyunFILES:${PN} += "${prefix}/* ${prefix}/runtest/* ${prefix}/scenario_groups/* ${prefix}/testcases/bin/* ${prefix}/testcases/bin/*/bin/* ${prefix}/testscripts/* ${prefix}/testcases/open_posix_testsuite/* ${prefix}/testcases/open_posix_testsuite/conformance/* ${prefix}/testcases/open_posix_testsuite/Documentation/* ${prefix}/testcases/open_posix_testsuite/functional/* ${prefix}/testcases/open_posix_testsuite/include/* ${prefix}/testcases/open_posix_testsuite/scripts/* ${prefix}/testcases/open_posix_testsuite/stress/* ${prefix}/testcases/open_posix_testsuite/tools/* ${prefix}/testcases/data/nm01/lib.a ${prefix}/lib/libmem.a"
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun# Avoid stripping some generated binaries otherwise some of the ltp tests such as ldd01 & nm01 fail
114*4882a593SmuzhiyunINHIBIT_PACKAGE_STRIP_FILES = "${prefix}/testcases/bin/nm01 ${prefix}/testcases/bin/ldd01"
115*4882a593SmuzhiyunINSANE_SKIP:${PN} += "already-stripped staticdev"
116*4882a593Smuzhiyun
117*4882a593Smuzhiyunremove_broken_musl_sources() {
118*4882a593Smuzhiyun	[ "${TCLIBC}" = "musl" ] || return 0
119*4882a593Smuzhiyun
120*4882a593Smuzhiyun	cd ${S}
121*4882a593Smuzhiyun	echo "WARNING: remove unsupported tests (until they're fixed)"
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun	# sync with upstream
124*4882a593Smuzhiyun	# https://github.com/linux-test-project/ltp/blob/master/ci/alpine.sh#L33
125*4882a593Smuzhiyun	rm -rfv \
126*4882a593Smuzhiyun		testcases/kernel/syscalls/confstr/confstr01.c \
127*4882a593Smuzhiyun		testcases/kernel/syscalls/fmtmsg/fmtmsg01.c \
128*4882a593Smuzhiyun		testcases/kernel/syscalls/getcontext/getcontext01.c \
129*4882a593Smuzhiyun		testcases/kernel/syscalls/rt_tgsigqueueinfo/rt_tgsigqueueinfo01.c \
130*4882a593Smuzhiyun		testcases/kernel/syscalls/timer_create/timer_create01.c \
131*4882a593Smuzhiyun		testcases/kernel/syscalls/timer_create/timer_create03.c \
132*4882a593Smuzhiyun		utils/benchmark/ebizzy-0.3
133*4882a593Smuzhiyun}
134*4882a593Smuzhiyundo_patch[postfuncs] += "remove_broken_musl_sources"
135*4882a593Smuzhiyun
136*4882a593Smuzhiyun# Avoid file dependency scans, as LTP checks for things that may or may not
137*4882a593Smuzhiyun# exist on the running system.  For instance it has specific checks for
138*4882a593Smuzhiyun# csh and ksh which are not typically part of OpenEmbedded systems (but
139*4882a593Smuzhiyun# can be added via additional layers.)
140*4882a593SmuzhiyunSKIP_FILEDEPS:${PN} = '1'
141