Commit Graph

43 Commits

Author SHA1 Message Date
Isaac J. Manjarres ba520a32ce ANDROID: Add memfd self tests
Memfd is important to Android, so add support for building and running
the memfd self test in presubmit.

Bug: 382547417
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:f369010a2a779c5df3c4063ba88e4cc04e92496a)
Merged-In: I5df07ae00f6ee861c41f55e5ef46517b960c9d8f
Change-Id: I5df07ae00f6ee861c41f55e5ef46517b960c9d8f
2024-12-11 16:49:59 -08:00
Cheng-Cheng Lo 07be6b4d90 ANDROID: use INDIVIDUAL_LEAVES for kselftests parser resolution
Bug: 371481715
Test: presubmit
Change-Id: I7b4c7d4ea7683f12c140c2ac7fc3ad67f02cd4cb
Signed-off-by: Cheng-Cheng Lo <locc@google.com>
(cherry picked from commit ff4969e8ce)
2024-11-06 17:42:44 +00:00
Hsin-Yi Chen 3fdb51797f ANDROID: Update README about kunit and selftest
Test: kernel/tests/tools/run_test_only.sh \
      -t 'kunit soc-utils-test' -s 127.0.0.1:6520
Bug: 355559072
Change-Id: I256855673cbe0ec1ea02d213d9c35c49e2d8e21b
Signed-off-by: Hsin-Yi Chen <hsinyichen@google.com>
2024-10-30 20:42:50 +00:00
HONG Yifan 2c1488cabe ANDROID: Add bionic-compat.h to kselftests.
Bionic does not provide pthread_cancel(). Copy bionic-compat.h from
previous fork of kselftests to here to solve the issue.

Link: https://android.googlesource.com/platform/external/linux-kselftest/+/refs/heads/main/android/include/bionic-compat.h
Bug: 369330443
Change-Id: Ifa1b5cbe55d6e8ab007787d94e31902ed8dfc37c
Signed-off-by: HONG Yifan <elsk@google.com>
Signed-off-by: Edward Liaw <edliaw@google.com>
2024-09-26 23:01:08 +00:00
Betty Zhou cb6fcbe17c ANDROID: Update README with CONFIG_KUNT=m approach.
Test: local tests
Bug: 345309292
Change-Id: I609800e40b40609b5d0c2f6a91a4bb9a00bbdb7a
Signed-off-by: Betty Zhou <bettyzhou@google.com>
2024-07-30 16:37:28 -07:00
Edward Liaw 71f973ebfe ANDROID: Build kselftests for 32bit x86
Add build rules and test config for kselftests on x86 32

Bug: 291147200
Change-Id: I6a9957bcf13a27c4b91d45a044b8985f1938b8ee
Signed-off-by: Edward Liaw <edliaw@google.com>
2024-01-17 00:40:39 +00:00
Edward Liaw b9f78826d0 ANDROID: Build kselftests for 32bit arm
Add build rules and test config for kselftests on arm 32

Bug: 291147200
Change-Id: Ic9f23062740316cddaeef019847b9570fd0b5f26
Signed-off-by: Edward Liaw <edliaw@google.com>
2024-01-17 00:25:48 +00:00
Edward Liaw ef3a3d71a8 ANDROID: Specify arch for kselftest test suites
Tradefed will run tests against all abis by default.  The kselftest
suite is built per architecture so it needs to only run when the abi
matches the build.

Bug: 310227391
Bug: 318413396
Change-Id: I55a7f5cea2b3970dea06cb0a2f68d6c9ed865887
Signed-off-by: Edward Liaw <edliaw@google.com>
2024-01-03 18:31:47 +00:00
Edward Liaw ec2e16e516 ANDROID: update binary names for timer tests
Fix the names for binaries that are called by name in vts test config.

Bug: 291147200
Change-Id: I2e0f1accdd7320c39a8db206d2cff8f1246b1e34
Signed-off-by: Edward Liaw <edliaw@google.com>
2024-01-02 17:05:13 +00:00
Edward Liaw 4e9b6d4f3e ANDROID: timers: Don't run destructive timer tests
Some timer tests can modify system time and cause the device to suspend.
These should not run as part of the test suite.

Bug: 291147200
Change-Id: Ie8b378b782dc6fa11f864a9445f07e80796335d3
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-19 21:13:21 +00:00
Weijia He bb9d33b2a7 ANDROID: Add x86 specific self tests
Build and enable x86 kselftests

Bug: 310227391
Change-Id: Ica58f1e8e0994bbd7768a0e99ffe41c9e4741c81
Signed-off-by: Weijia He <hwj@google.com>
2023-12-19 21:13:21 +00:00
Weijia He 07e3cca929 ANDROID: Add capabilities and seccomp self tests
Build and enable capabilities and seccomp kselftests

Change-Id: Ia7dfdc6557551d2349c53093d32b3e27c8a76edd
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-12-19 21:13:21 +00:00
Weijia He 98ed5d2867 ANDROID: Add net self tests
Build and enable net kselftests

Change-Id: Icb86869296dd82ebdb2929e302269f3b44409544
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-12-19 21:13:21 +00:00
Edward Liaw a0b51f579f ANDROID: Run tests from selftest directory
Some tests need to be run with the working directory set to the selftest
directory so that they have the appropriate file permissions.

Bug: 291147200
Change-Id: Ia49ceee3904e4bcd6865cd1a6a0724e659ee8cad
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-11 21:18:57 +00:00
Edward Liaw 4ff8382d3b ANDROID: Run futex tests individually
Instead of using the shell script to run each test, run each futex test
on its own.  The shell script does not handle skipped subtests and does
not add any additional testing logic.

Bug: 291147200
Change-Id: Id8687e722bbdc0df527eb0bbe87bb442fb2f0c60
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-11 21:18:57 +00:00
Edward Liaw efcc94783e ANDROID: Disable breakpoints step_after_suspend
Android device will not suspend while usb is connected.

Bug: 67016038
Change-Id: I2a4330dac7fe2ce69c27d61b4ba67e25bd73df30
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-11 20:50:20 +00:00
Weijia He 2597aed6bc ANDROID: Update license for selftest build and configs
Bug: 291147200
Change-Id: I41c7c067c62b8fb038a96bf516710010b617d363
Signed-off-by: Weijia He <hwj@google.com>
2023-12-11 04:28:41 +00:00
Weijia He 0e4e05eaf8 ANDROID: Add mm self tests
This change adds mm self tests

Change-Id: Ib193d852701db59189f586257146d89582987836
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-12-07 22:16:05 +00:00
Weijia He e49cb50c6a ANDROID: Add timer self tests
This change adds timer self tests

Change-Id: I478103a90e7497ec44575fcfbc9852453dafd2e1
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-12-07 22:13:15 +00:00
Weijia He 80979fab46 ANDROID: Add futex self tests
This change adds futex self tests

Change-Id: I20fcc0ecc139db017e235ee679f22ca1aa0ea71c
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-06 22:33:13 +00:00
Edward Liaw 93dd59141d ANDROID: kselftests: Use KernelTargetTest and handle skip exit code
kselftests use exit code 4 when skipping tests.  Use KernelTargetTest to
handle this correctly.

Bug: 291147200
Change-Id: I6a8dfb67b29b04f6e54b2ca9a42c138a2d6b65f6
Signed-off-by: Edward Liaw <edliaw@google.com>
2023-12-04 20:35:52 +00:00
Weijia He db07b9d659 ANDROID: Fix selftest x86_64 config and add --skip-cvd-kill option to kselftest.sh
Change-Id: I9c661f8958eecd3d3a3870295a9e2acd6b199590
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-11-30 03:09:22 +00:00
Weijia He d86db500cf ANDROID: Add more cc binary rules to selftests
This change adds more cc_binary for selftests

Change-Id: Iecac2bc5727775238f8483d0c316b885b477695c
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-11-21 18:39:26 +00:00
Weijia He 6e498d5efd ANDROID: Fix device lost issue for self test
The ExecutableTargetTest expects "value" to be a list of executables,
not a command line string. Moving chmod statement to post-push to
resolve unexpected behaviors in previous config.

Change-Id: I5e21a777d9f73138264a295098f3b5c65e163dbb
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-11-01 17:13:41 +00:00
Weijia He 8453aa945e ANDROID: Add build rules for selftests
tests.zip file contents:
  Length      Date    Time    Name
---------  ---------- -----   ----
    43552  2008-01-01 00:00   bazel-out/k8-fastbuild-ST-c33f95032a75/bin/common/testcases/selftests/x86_64/kselftest_binderfs_test
    14080  2008-01-01 00:00   bazel-out/k8-fastbuild-ST-c33f95032a75/bin/common/testcases/selftests/x86_64/kselftest_breakpoints_tests_breakpoint_test
    14216  2008-01-01 00:00   bazel-out/k8-fastbuild-ST-c33f95032a75/bin/common/testcases/selftests/x86_64/kselftest_breakpoints_tests_step_after_suspend_test
     2955  2008-01-01 00:00   bazel-out/k8-fastbuild-ST-c33f95032a75/bin/common/testcases/selftests/selftests.config
---------                     -------
    74803                     4 files

Change-Id: I34a0ca205d9b505bc38689b03bdb6463288fe56b
Signed-off-by: Weijia He <hwj@google.com>
Bug: 291147200
2023-10-25 21:41:45 +00:00
Greg Kroah-Hartman 0b2a6b9137 ANDROID: delete ION code
Upstream commit e722a295cf ("staging: ion: remove from the tree")
removes the ION code from the kernel tree, but the version of ION that
is in the ANDROID tree is a bit more complex and different.  To make it
"easier" if someone needs to bring the ION code back, revert it all
here, in this commit, so that when the upstream merge happens, the
deletion is not burried in a merge commit.

Fixes: e722a295cf ("staging: ion: remove from the tree")
Cc: Hridya Valsaraju <hridya@google.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ibd9332f5878879579508c947976d943d1fd6023a
2020-12-17 19:16:56 +01:00
Linus Torvalds ff2ae607c6 Merge tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx
Pull SPDX updates from Greg KH:
 "Here are three SPDX patches for 5.7-rc1.

  One fixes up the SPDX tag for a single driver, while the other two go
  through the tree and add SPDX tags for all of the .gitignore files as
  needed.

  Nothing too complex, but you will get a merge conflict with your
  current tree, that should be trivial to handle (one file modified by
  two things, one file deleted.)

  All three of these have been in linux-next for a while, with no
  reported issues other than the merge conflict"

* tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
  ASoC: MT6660: make spdxcheck.py happy
  .gitignore: add SPDX License Identifier
  .gitignore: remove too obvious comments
2020-04-03 13:12:26 -07:00
Masahiro Yamada d198b34f38 .gitignore: add SPDX License Identifier
Add SPDX License Identifier to all .gitignore files.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-25 11:50:48 +01:00
Shuah Khan fb0bb39524 selftests: android: Fix custom install from skipping test progs
Update custom install rule to install all generated test programs. This
fixes android/ion tests to be installed correctly.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-03-13 13:46:55 -06:00
Shuah Khan 1dc74544ed selftests: android: ion: Fix ionmap_test compile error
ionmap_test compile rule is missing ipcsocket.c dependency. Add it to
fix the following compile errors:

..android/ion/ionutils.c:221: undefined reference to `sendtosocket'
..android/ion/ionutils.c:243: undefined reference to `receivefromsocket'

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-03-13 13:46:39 -06:00
Thomas Gleixner 9c92ab6191 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282
Based on 1 normalized pattern(s):

  this software is licensed under the terms of the gnu general public
  license version 2 as published by the free software foundation and
  may be copied distributed and modified under those terms this
  program is distributed in the hope that it will be useful but
  without any warranty without even the implied warranty of
  merchantability or fitness for a particular purpose see the gnu
  general public license for more details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 285 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-05 17:36:37 +02:00
Thomas Gleixner ec8f24b7fa treewide: Add SPDX license identifier - Makefile/Kconfig
Add SPDX license identifiers to all Make/Kconfig files which:

 - Have no license information of any form

These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:

  GPL-2.0-only

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-21 10:50:46 +02:00
Shuah Khan 211929fd3f selftests: Fix test errors related to lib.mk khdr target
Commit b2d35fa5fc ("selftests: add headers_install to lib.mk") added
khdr target to run headers_install target from the main Makefile. The
logic uses KSFT_KHDR_INSTALL and top_srcdir as controls to initialize
variables and include files to run headers_install from the top level
Makefile. There are a few problems with this logic.

1. Exposes top_srcdir to all tests
2. Common logic impacts all tests
3. Uses KSFT_KHDR_INSTALL, top_srcdir, and khdr in an adhoc way. Tests
   add "khdr" dependency in their Makefiles to TEST_PROGS_EXTENDED in
   some cases, and STATIC_LIBS in other cases. This makes this framework
   confusing to use.

The common logic that runs for all tests even when KSFT_KHDR_INSTALL
isn't defined by the test. top_srcdir is initialized to a default value
when test doesn't initialize it. It works for all tests without a sub-dir
structure and tests with sub-dir structure fail to build.

e.g: make -C sparc64/drivers/ or make -C drivers/dma-buf

../../lib.mk:20: ../../../../scripts/subarch.include: No such file or directory
make: *** No rule to make target '../../../../scripts/subarch.include'.  Stop.

There is no reason to require all tests to define top_srcdir and there is
no need to require tests to add khdr dependency using adhoc changes to
TEST_* and other variables.

Fix it with a consistent use of KSFT_KHDR_INSTALL and top_srcdir from tests
that have the dependency on headers_install.

Change common logic to include khdr target define and "all" target with
dependency on khdr when KSFT_KHDR_INSTALL is defined.

Only tests that have dependency on headers_install have to define just
the KSFT_KHDR_INSTALL, and top_srcdir variables and there is no need to
specify khdr dependency in the test Makefiles.

Fixes: b2d35fa5fc ("selftests: add headers_install to lib.mk")
Cc: stable@vger.kernel.org
Signed-off-by: Shuah Khan <shuah@kernel.org>
2018-12-13 16:51:30 -07:00
Anders Roxell b2d35fa5fc selftests: add headers_install to lib.mk
If the kernel headers aren't installed we can't build all the tests.
Add a new make target rule 'khdr' in the file lib.mk to generate the
kernel headers and that gets include for every test-dir Makefile that
includes lib.mk If the testdir in turn have its own sub-dirs the
top_srcdir needs to be set to the linux-rootdir to be able to generate
the kernel headers.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Fathi Boudra <fathi.boudra@linaro.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-09-05 08:12:09 -06:00
Anders Roxell 88bc243a3f selftests: android: move config up a level
'make kselftest-merge' assumes that the config files for the tests are
located under the 'main' test dir, like tools/testing/selftests/android/
and not in a subdir to android.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-08-27 13:35:57 -06:00
Li Zhijian cc7c673032 selftests/android: initialize heap_type to avoid compiling warning
Initialize heap_type to ION_HEAP_TYPE_SYSTEM to avoid "used uninitialized"
compiler warning. heap_type gets used after initialization, this change is
to just keep the compiler happy.

root@vm-lkp-nex04-8G-7 ~/linux-v4.18-rc2/tools/testing/selftests/android# make
make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
make[1]: Entering directory '/root/linux-v4.18-rc2/tools/testing/selftests/android/ion'
gcc  -I. -I../../../../../drivers/staging/android/uapi/ -I../../../../../usr/include/ -Wall -O2 -g    ionapp_export.c ipcsocket.c ionutils.c   -o ionapp_export
ionapp_export.c: In function 'main':
ionapp_export.c:91:2: warning: 'heap_type' may be used uninitialized in
this function [-Wmaybe-uninitialized]
  printf("heap_type: %ld, heap_size: %ld\n", heap_type, heap_size);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CC: Shuah Khan <shuah@kernel.org>
CC: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-07-11 10:13:17 -06:00
Shuah Khan (Samsung OSG) 5104acdb9f selftests: android: ion: return Kselftest Skip code for skipped tests
When ion test is skipped because of unmet dependencies and/or unsupported
configuration, it returns 0 which is treated as a pass by the Kselftest
framework. This leads to false positive result even when the test could
not be run.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate
messages to indicate that the test is skipped.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
Acked-by: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-05-30 15:21:52 -06:00
Shuah Khan (Samsung OSG) bf1fc76b51 selftests: android: delete RUN_TESTS and EMIT_TESTS overrides
Delete RUN_TESTS and EMIT_TESTS overrides and use common defines in
lib.mk. Common defines work just fine and there is no need to define
custom overrides.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-05-30 15:21:52 -06:00
Anders Roxell 55c1b5f4af selftests/android/ion: Makefile: fix build error
Fails to build iomap_test.c due to missing include

gcc  -I. -I../../../../../drivers/staging/android/uapi/ -Wall -O2 -g
ionmap_test.c ipcsocket.c ionutils.c   -o ionmap_test
ionmap_test.c:12:27: fatal error: linux/dma-buf.h: No such file or
directory
 #include <linux/dma-buf.h>
                           ^
compilation terminated.
<builtin>: recipe for target 'ionmap_test' failed
make[2]: *** [ionmap_test] Error 1

In the current code, we add a new -I ../../../../../usr/include/ to the
INCLUDEDIR variable. Also add ionmap_test to the .gitignore file.

Fixes: ac93f7046a ("selftests: ion: Add simple test with the vgem driver")
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2018-03-21 10:40:04 -06:00
Laura Abbott ac93f7046a selftests: ion: Add simple test with the vgem driver
Ion is designed to be a framework used by other clients who perform
operations on the buffer. Use the DRM vgem client as a simple consumer.
In conjunction with the dma-buf sync ioctls, this tests the full attach/map
path for the system heap.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2018-03-05 18:56:24 -07:00
Laura Abbott 829dd7d642 selftests: ion: Remove some prints
There's no need to print messages each time we alloc and free. Remove them.

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2018-03-05 18:56:14 -07:00
Daniel Díaz 64136fb760 selftests/android: Fix line continuation in Makefile
The Makefile lacks a couple of line continuation backslashes
in an `if' clause, which can make the subsequent rsync
command go awry over the whole filesystem (`rsync -a / /`).

  /bin/sh: -c: line 5: syntax error: unexpected end of file
  make[1]: [all] Error 1 (ignored)
  TEST=$DIR"_test.sh"; \
                  if [ -e $DIR/$TEST ]; then
  /bin/sh: -c: line 2: syntax error: unexpected end of file
  make[1]: [all] Error 1 (ignored)
  rsync -a $DIR/$TEST $BUILD_TARGET/;
  [...a myriad of:]
  [  rsync: readlink_stat("...") failed: Permission denied (13)]
  [  skipping non-regular file "..."]
  [  rsync: opendir "..." failed: Permission denied (13)]
  [and many other errors...]
  fi
  make[1]: fi: Command not found
  make[1]: [all] Error 127 (ignored)
  done
  make[1]: done: Command not found
  make[1]: [all] Error 127 (ignored)

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
Acked-by: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2018-02-13 13:59:39 -07:00
Pintu Agarwal 47a18c42d9 android/ion: userspace test utility for ion buffer sharing
This is a test utility to verify ION buffer sharing in user space
between 2 independent processes.
It uses unix domain socket (with SCM_RIGHTS) as IPC to transfer an FD to
another process to share the same buffer.
This utility demonstrates how ION buffer sharing can be implemented between
two user space processes, using various heap types.

This utility is made to be run as part of kselftest framework in kernel.
The utility is verified on Ubuntu-32 bit system with Linux Kernel 4.14,
using ION system heap.

For more information about the utility please check the README file.

Signed-off-by: Pintu Agarwal <pintu.ping@gmail.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-11-15 08:07:53 -07:00