1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
|
SUMMARY = "Linux Kernel Selftests"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
SRC_URI = "https://www.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz"
SRC_URI[md5sum] = "0a68ef3615c64bd5ee54a3320e46667d"
SRC_URI[sha256sum] = "029098dcffab74875e086ae970e3828456838da6e0ba22ce3f64ef764f3d7f1a"
S = "${WORKDIR}/linux-${PV}"
PACKAGE_ARCH = "${MACHINE_ARCH}"
DEPENDS = "libcap libcap-ng popt rsync-native"
inherit kernel-arch
# Filter out arch specific tests
TARGETS = " \
${@bb.utils.contains_any("TARGET_ARCH", [ "x86", "x86-64" ], "breakpoints", "", d)} \
capabilities \
cpu-hotplug \
efivarfs \
exec \
firmware \
ftrace \
futex \
${@bb.utils.contains_any("TARGET_ARCH", [ "x86", "x86-64" ], "ipc", "", d)} \
kcmp \
lib \
membarrier \
memfd \
memory-hotplug \
mount \
mqueue \
net \
nsfs \
${@bb.utils.contains_any("TARGET_ARCH", [ "powerpc", "powerpc64" ], "powerpc", "", d)} \
pstore \
ptrace \
seccomp \
sigaltstack \
size \
static_keys \
sysctl \
timers \
user \
vm \
${@bb.utils.contains_any("TARGET_ARCH", [ "x86", "x86-64" ], "x86", "", d)} \
zram \
"
EXTRA_OEMAKE += "-C tools/testing/selftests TARGETS="${TARGETS}" INSTALL_PATH=${D}${bindir}/kselftests CC="${CC}""
# Their Makefiles are so sloppy, let's clean up a bit
do_configure () {
sed "s|^CC := .*||g" -i ${S}/tools/testing/selftests/lib.mk
sed "s|^CC = .*||g" -i ${S}/tools/testing/selftests/timers/Makefile
sed "s|^CC = .*||g" -i ${S}/tools/testing/selftests/memfd/Makefile
sed "s|^CC := .*||g" -i ${S}/tools/testing/selftests/powerpc/switch_endian/Makefile
sed "s|gcc|\$(CC)|g" -i ${S}/tools/testing/selftests/breakpoints/Makefile
sed "s|TARGETS|F_TARGETS|g" -i ${S}/tools/testing/selftests/futex/functional/Makefile
sed "s|^LDFLAGS += -lpthread|LDLIBS += -lpthread|g" -i ${S}/tools/testing/selftests/seccomp/Makefile
sed "s|^LDFLAGS += -lrt -lpthread|LDLIBS += -lrt -lpthread|g" -i ${S}/tools/testing/selftests/timers/Makefile
sed "s|BINARIES|TEST_PROGS|g" -i ${S}/tools/testing/selftests/sigaltstack/Makefile
}
do_compile () {
oe_runmake
}
do_install () {
oe_runmake install
chown -R root:root ${D}
}
PACKAGE_BEFORE_PN = " \
${PN}-breakpoints \
${PN}-capabilities \
${PN}-cpu-hotplug \
${PN}-efivarfs \
${PN}-exec \
${PN}-firmware \
${PN}-ftrace \
${PN}-futex \
${PN}-ipc \
${PN}-kcmp \
${PN}-lib \
${PN}-membarrier \
${PN}-memfd \
${PN}-memory-hotplug \
${PN}-mount \
${PN}-mqueue \
${PN}-net \
${PN}-nsfs \
${PN}-powerpc \
${PN}-pstore \
${PN}-ptrace \
${PN}-seccomp \
${PN}-sigaltstack \
${PN}-size \
${PN}-static-keys \
${PN}-sysctl \
${PN}-timers \
${PN}-user \
${PN}-vm \
${PN}-x86 \
${PN}-zram \
"
FILES_${PN}-breakpoints = "${bindir}/kselftests/breakpoints"
FILES_${PN}-capabilities = "${bindir}/kselftests/capabilities"
FILES_${PN}-cpu-hotplug = "${bindir}/kselftests/cpu-hotplug"
FILES_${PN}-efivarfs = "${bindir}/kselftests/efivarfs"
FILES_${PN}-exec = "${bindir}/kselftests/exec"
FILES_${PN}-firmware = "${bindir}/kselftests/firmware"
FILES_${PN}-ftrace = "${bindir}/kselftests/ftrace"
FILES_${PN}-futex = "${bindir}/kselftests/futex"
FILES_${PN}-ipc = "${bindir}/kselftests/ipc"
FILES_${PN}-kcmp = "${bindir}/kselftests/kcmp"
FILES_${PN}-lib = "${bindir}/kselftests/lib"
FILES_${PN}-membarrier = "${bindir}/kselftests/membarrier"
FILES_${PN}-memfd = "${bindir}/kselftests/memfd"
FILES_${PN}-memory-hotplug = "${bindir}/kselftests/memory-hotplug"
FILES_${PN}-mount = "${bindir}/kselftests/mount"
FILES_${PN}-mqueue = "${bindir}/kselftests/mqueue"
FILES_${PN}-net = "${bindir}/kselftests/net"
FILES_${PN}-nsfs = "${bindir}/kselftests/nsfs"
FILES_${PN}-powerpc = "${bindir}/kselftests/powerpc"
FILES_${PN}-pstore = "${bindir}/kselftests/pstore"
FILES_${PN}-ptrace = "${bindir}/kselftests/ptrace"
FILES_${PN}-seccomp = "${bindir}/kselftests/seccomp"
FILES_${PN}-sigaltstack = "${bindir}/kselftests/sigaltstack"
FILES_${PN}-size = "${bindir}/kselftests/size"
FILES_${PN}-static-keys = "${bindir}/kselftests/static_keys"
FILES_${PN}-sysctl = "${bindir}/kselftests/sysctl"
FILES_${PN}-timers = "${bindir}/kselftests/timers"
FILES_${PN}-user = "${bindir}/kselftests/user"
FILES_${PN}-vm = "${bindir}/kselftests/vm"
FILES_${PN}-x86 = "${bindir}/kselftests/x86"
FILES_${PN}-zram = "${bindir}/kselftests/zram"
FILES_${PN}-dbg += "${bindir}/kselftests/*/.debug"
RDEPENDS_${PN}-cpu-hotplug += "bash"
RDEPENDS_${PN}-efivarfs += "bash"
RDEPENDS_${PN}-futex += "bash ncurses"
RDEPENDS_${PN}-memory-hotplug += "bash"
RDEPENDS_${PN}-net += "bash"
RDEPENDS_${PN}-vm += "bash"
RDEPENDS_${PN}-zram += "bash"
RDEPENDS_${PN} += "bash \
${PN}-capabilities \
${PN}-cpu-hotplug \
${PN}-efivarfs \
${PN}-exec \
${PN}-firmware \
${PN}-ftrace \
${PN}-futex \
${PN}-kcmp \
${PN}-lib \
${PN}-membarrier \
${PN}-memfd \
${PN}-memory-hotplug \
${PN}-mount \
${PN}-mqueue \
${PN}-net \
${PN}-nsfs \
${PN}-pstore \
${PN}-ptrace \
${PN}-seccomp \
${PN}-sigaltstack \
${PN}-size \
${PN}-static-keys \
${PN}-sysctl \
${PN}-timers \
${PN}-user \
${PN}-vm \
${PN}-zram \
"
RDEPENDS_${PN}_append_x86 = " ${PN}-breakpoints ${PN}-ipc ${PN}-x86"
RDEPENDS_${PN}_append_x86-64 = " ${PN}-breakpoints ${PN}-ipc ${PN}-x86"
RDEPENDS_${PN}_append_powerpc = " ${PN}-powerpc"
RDEPENDS_${PN}_append_powerpc64 = " ${PN}-powerpc"
INSANE_SKIP_${PN} = "already-stripped"
|