Commit Graph

16 Commits

Author SHA1 Message Date
Khem Raj a62ed77703 kernel-selftest: Exclude from world builds
Avoid need for installing clang on host, or depending on meta-clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-09-18 18:51:03 -07:00
Khem Raj 6de4264bde kernel-selftest: Needs error.h which is missing in musl
prog_tests/flow_dissector.c:3:10: fatal error: error.h: No such file or directory
| #include <error.h>
|          ^~~~~~~~~

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-09-09 09:59:54 -07:00
Khem Raj 44c020f87a kernel-selftest: Explicitly disable stack protector
selftests do not support it and clang from meta-clang builds with this
turned on by default

Disable security flags completely, drop all workarounds used to get
around the hoop

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-08-29 09:06:54 -07:00
Khem Raj e1acbf33f7 kernel-selftest: Warn conditionally about clang-native dependency
When meta-clang is in mix then it does the right thing already so no
need to warn in that case

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-08-29 09:06:54 -07:00
Martin Jansa 1ed7486a87 kernel-selftest: skip -Werror=format-security and fortify
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-08-12 09:11:01 -07:00
Andrea Adami 6cb64da8fa kernel-selftest: temporary disable bpf for arm - fix build for qemuarm
Even running on 32bit the bpf objects are 64bit: this triggers the QA  about
bitsize mismatch 32 vs. 64. Besides, objdump does not recognize the arch 0xf7.

Trying the workaround to use the llvm-objdump and setting TOOLCHAIN = "clang"
the build for arm fails on libcxx

  |include/c++/8.2.0/atomic:250: undefined reference to `__atomic_load_4'

Temporary disable bpf as done for x86/32bit as it seems still unstable.

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-10-27 18:23:07 -07:00
Khem Raj a84c46158f kernel-selftest: Remove bpf on x86/32bit
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-09-26 21:15:21 -07:00
Khem Raj 0cdf87dd8f kernel-selftest: Newer kernels 4.18+ need llc from llvm
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-09-24 11:49:45 -07:00
Khem Raj 6e9c34d6a1 kernel-selftest: Fix build on musl
* (Depends upon a linux-libc-headers patch proposed to oe-core)
* Delete unused patch
* Mark Clang 6.0 as minimum required version
* Do not hardcode python3 interpreter path

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Hongzhi.Song <hongzhi.song@windriver.com>
Cc: Martin Jansa <Martin.Jansa@gmail.com>
2018-09-14 19:01:41 -07:00
Khem Raj 196a373fb4 kernel-selftest: Fix the COPYING checksum variablity
COPYING coming from kernel sources but the md5 is static value
saved in recipe does not scale to all kind of machines which may
have different kernel providers filling in, therefore keep a static
copy of COPYING file as well, additionally copy LICENSES directory ( if
it exists) into sources where all the real license texts are living

Document need for clang

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-28 09:36:28 -07:00
Martin Jansa 0d614c4220 kernel-selftest: add dependency on libcap
* vm selftest uses it as well:
i586-webos-linux-gcc  -m32 -march=i586 -fstack-protector-strong   -Wformat -Wformat-security -Werror=format-security --sysroot=kernel-selftest/1.0-r0/recipe-sysroot -Wall -I ../../../../usr/include   -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now  mlock-random-test.c -lrt -lcap -o kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/vm/mlock-random-test
mlock-random-test.c:8:10: fatal error: sys/capability.h: No such file or directory
 #include <sys/capability.h>
          ^~~~~~~~~~~~~~~~~~
compilation terminated.

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-19 16:09:28 -07:00
Dengke Du e88b38a9d2 kernel-selftest: add ptest support
Group the kernel-selftest testcases in run-ptest.

Signed-off-by: Dengke Du <dengke.du@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-19 16:09:28 -07:00
Martin Jansa 8a2a36e66b kernel-selftest: fix various issues
* respect PACKAGECONFIG when setting TEST_LIST
* call the sed in remove_clang_related only when bpf PACKAGECONFIG is
  enabled and if ${S}/tools/testing/selftests/bpf/Makefile doesn't exist
  then show more useful error message than:
  sed: can't read kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/bpf/Makefile: No such file or directory
  because kernels older than 4.10 don't have bpf selftest which was
  added in:
  https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
* disable ldflags QA errors, the selftests Makefile explicitly overrides
  LDFLAGS to empty:
  https://github.com/torvalds/linux/blob/5aa5bd14c5f8660c64ceedf14a549781be47e53d/tools/testing/selftests/Makefile#L46
  and the vm/Makefile doesn't respect LDFLAGS anyway:
  https://github.com/torvalds/linux/blob/5aa5bd14c5f8660c64ceedf14a549781be47e53d/tools/testing/selftests/vm/Makefile#L17
  so it was causing a lot of errors:
  ERROR: kernel-selftest-1.0-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/thuge-gen'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/thuge-gen'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/transhuge-stress'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/transhuge-stress'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/userfaultfd'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/userfaultfd'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-shm'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-shm'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/on-fault-limit'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/on-fault-limit'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-mmap'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-mmap'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/compaction_test'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/compaction_test'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/mlock2-tests'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/mlock2-tests'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/map_hugetlb'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/map_hugetlb' [ldflags]
* fix the formatting and useless append
* add dependency on rsync-native as it's used during do_install:
  | make: Entering directory 'kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/vm'
  | rsync -a  run_vmtests  compaction_test hugepage-mmap hugepage-shm map_hugetlb mlock2-tests on-fault-limit thuge-gen transhuge-stress userfaultfd kernel-selftest/1.0-r0/image/usr/kernel-selftest/vm/
  | /bin/sh: 1: rsync: not found
  | ../lib.mk:24: recipe for target 'install' failed

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-19 16:09:28 -07:00
Hongzhi.Song 86860bd860 kernel-selftest: compatible with latest kernel
There are some new program added for bpf. So we make corresponding
modifications.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-19 16:09:28 -07:00
Martin Jansa c96c6a01e4 kernel-selftest: fix various issues
* respect PACKAGECONFIG when setting TEST_LIST
* call the sed in remove_clang_related only when bpf PACKAGECONFIG is
  enabled and if ${S}/tools/testing/selftests/bpf/Makefile doesn't exist
  then show more useful error message than:
  sed: can't read kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/bpf/Makefile: No such file or directory
  because kernels older than 4.10 don't have bpf selftest which was
  added in:
  https://github.com/torvalds/linux/commit/5aa5bd14c5f8660c64ceedf14a549781be47e53d
* disable ldflags QA errors, the selftests Makefile explicitly overrides
  LDFLAGS to empty:
  https://github.com/torvalds/linux/blob/5aa5bd14c5f8660c64ceedf14a549781be47e53d/tools/testing/selftests/Makefile#L46
  and the vm/Makefile doesn't respect LDFLAGS anyway:
  https://github.com/torvalds/linux/blob/5aa5bd14c5f8660c64ceedf14a549781be47e53d/tools/testing/selftests/vm/Makefile#L17
  so it was causing a lot of errors:
  ERROR: kernel-selftest-1.0-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/thuge-gen'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/thuge-gen'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/transhuge-stress'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/transhuge-stress'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/userfaultfd'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/userfaultfd'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-shm'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-shm'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/on-fault-limit'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/on-fault-limit'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-mmap'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/hugepage-mmap'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/compaction_test'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/compaction_test'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/mlock2-tests'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/mlock2-tests'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/map_hugetlb'
  No GNU_HASH in the elf binary: 'kernel-selftest/1.0-r0/packages-split/kernel-selftest/usr/kernel-selftest/vm/map_hugetlb' [ldflags]
* fix the formatting and useless append
* add dependency on rsync-native as it's used during do_install:
  | make: Entering directory 'kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/vm'
  | rsync -a  run_vmtests  compaction_test hugepage-mmap hugepage-shm map_hugetlb mlock2-tests on-fault-limit thuge-gen transhuge-stress userfaultfd kernel-selftest/1.0-r0/image/usr/kernel-selftest/vm/
  | /bin/sh: 1: rsync: not found
  | ../lib.mk:24: recipe for target 'install' failed

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
2018-08-16 21:41:15 -04:00
Hongzhi.Song 146de1dfda kernel-selftest: Add a recipe on kernel selftest
The recipe builds the framework for kernel-selftest. Now, it just
contains two sets of testcase, bpf and vm. We will append more to
this recipe.

The following kernel config fragments must be manually enabled,
i.e. in local.conf, to use this test suite.
KERNEL_FEATURES_append += "features/bpf/bpf.scc \
                        cfg/debug-kselftest.scc \
                   features/hugetlb/hugetlb.scc \
"

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
2018-08-02 11:23:03 -07:00