aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/exec (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-01-05selftests: enable O and KBUILD_OUTPUTbamvor.zhangjian@huawei.com1-6/+7
Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest to another directory by passing O or KBUILD_OUTPUT. And O is high priority than KBUILD_OUTPUT. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: add EXTRA_CLEAN for clean targetbamvor.zhangjian@huawei.com1-10/+9
Some testcases need the clean extra data after running. This patch introduce the "EXTRA_CLEAN" variable to address this requirement. After KBUILD_OUTPUT is enabled in later patch, it will be easy to decide to if we need do the cleanup in the KBUILD_OUTPUT path(if the testcase ran immediately after compiled). Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: add default rules for c source filebamvor.zhangjian@huawei.com1-2/+0
There are difference rules for compiling c source file in different testcases. In order to enable KBUILD_OUTPUT support in later patch, this patch introduce the default rules in "tools/testing/selftest/lib.mk" and remove the existing rules in each testcase. Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: remove duplicated all and clean targetbamvor.zhangjian@huawei.com1-6/+4
Currently, kselftest use TEST_PROGS, TEST_PROGS_EXTENDED, TEST_FILES to indicate the test program, extended test program and test files. It is easy to understand the purpose of these files. But mix of compiled and uncompiled files lead to duplicated "all" and "clean" targets. In order to remove the duplicated targets, introduce TEST_GEN_PROGS, TEST_GEN_PROGS_EXTENDED, TEST_GEN_FILES to indicate the compiled objects. Also, the later patch will make use of TEST_GEN_XXX to redirect these files to output directory indicated by KBUILD_OUTPUT or O. And add this changes to "Contributing new tests(details)" of Documentation/kselftest.txt. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-06-15selftests/exec: Makefile is a run-time dependency, add it to the install listYannick Brosseau1-1/+2
The execveat test try to exec the Makefile file and expect an EACCES results. When running the test in the installed destination it would fail with ENOENT since the file is not there. Add Makefile to the TEST_FILES list so it's copied at install time. Signed-off-by: Yannick Brosseau <scientist@fb.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-09-14selftests: exec: revert to default emit ruleBamvor Jian Zhang1-3/+1
With the previous patch, the installation method change from install to rsync. There is no need to create subdir during test, the default EMIT_TESTS is enough. This patch essentially revert commit 84cbd9e4 ("selftests/exec: do not install subdir as it is already created"). Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-05-26selftests/exec: do not install subdir as it is already createdTyler Baker1-1/+1
Remove subdir from DEPS as it is already created at runtime. Without this, make install fails. Acked-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Tyler Baker <tyler.baker@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-04-13Merge tag 'linux-kselftest-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftestLinus Torvalds1-3/+6
Pull kselftest updates from Shuah Khan: "This is a milestone update in a sense. Several new tests and install and packaging support is added in this update. This update adds install and packaging tools developed on top of back-end shared logic enhancemnets to run and install tests. In addition several timer tests are added. - New timer tests from John Stultz - rtc test from Prarit Bhargava - Enhancements to un and install tests from Michael Ellerman - Install and packaging tools from Shuah Khan - Cross-compilation enablement from Tyler Baker - A couple of bug fixes" * tag 'linux-kselftest-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (42 commits) ftracetest: Do not use usleep directly selftest/mqueue: enable cross compilation selftest/ipc: enable cross compilation selftest/memfd: include default header install path selftest/mount: enable cross compilation selftest/memfd: enable cross compilation kselftests: timers: Make set-timer-lat fail more gracefully for !CAP_WAKE_ALARM selftests: Change memory on-off-test.sh name to be unique selftests: change cpu on-off-test.sh name to be unique selftests/mount: Make git ignore all binaries in mount test suite kselftests: timers: Reduce default runtime on inconsistency-check and set-timer-lat ftracetest: Convert exit -1 to exit $FAIL ftracetest: Cope properly with stack tracer not being enabled tools, update rtctest.c to verify passage of time Documentation, split up rtc.txt into documentation and test file selftests: Add tool to generate kselftest tar archive selftests: Add kselftest install tool selftests: Set CC using CROSS_COMPILE once in lib.mk selftests: Add install support for the powerpc tests selftests/timers: Use shared logic to run and install tests ...
2015-03-19selftests: Set CC using CROSS_COMPILE once in lib.mkMichael Ellerman1-1/+0
This avoids repeating the logic in every Makefile. We mimic the top-level Makefile and use $(CROSS_COMPILE)gcc. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-13selftests: Add install targetMichael Ellerman1-0/+3
This adds make install support to selftests. The basic usage is: $ cd tools/testing/selftests $ make install That installs into tools/testing/selftests/install, which can then be copied where ever necessary. The install destination is also configurable using eg: $ INSTALL_PATH=/mnt/selftests make install The implementation uses two targets in the child makefiles. The first "install" is expected to install all files into $(INSTALL_PATH). The second, "emit_tests", is expected to emit the test instructions (ie. bash script) on stdout. Separating this from install means the child makefiles need no knowledge of the location of the test script. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-13selftests: Introduce minimal shared logic for running testsMichael Ellerman1-2/+3
This adds a Make include file which most selftests can then include to get the run_tests logic. On its own this has the advantage of some reduction in repetition, and also means the pass/fail message is defined in fewer places. However the key advantage is it will allow us to implement install very simply in a subsequent patch. The default implementation just executes each program in $(TEST_PROGS). We use a variable to hold the default implementation of $(RUN_TESTS) because that gives us a clean way to override it if necessary, ie. using override. The mount, memory-hotplug and mqueue tests use that to provide a different implementation. Tests are not run via /bin/bash, so if they are scripts they must be executable, we add a+x to several. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-03-11selftests/exec: Check if the syscall exists and bail if notMichael Ellerman1-1/+9
On systems which don't implement sys_execveat(), this test produces a lot of output. Add a check at the beginning to see if the syscall is present, and if not just note one error and return. When we run on a system that doesn't implement the syscall we will get ENOSYS back from the kernel, so change the logic that handles __NR_execveat not being defined to also use ENOSYS rather than -ENOSYS. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Acked-by: David Drysdale <drysdale@google.com> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-01-06selftests/exec: allow shell return code of 126David Drysdale1-6/+13
When the shell fails to invoke a script because its path name is too long (ENAMETOOLONG), most shells return 127 to indicate command not found. However, some systems report 126 (which POSIX suggests should indicate a non-executable file) for this case, so allow that too. Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: David Drysdale <drysdale@google.com> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-12-22selftests/exec: Use %zu to format size_tGeert Uytterhoeven1-2/+2
On 32-bit: execveat.c: In function 'check_execveat_pathmax': execveat.c:183: warning: format '%lu' expects type 'long unsigned int', but argument 3 has type 'size_t' execveat.c:187: warning: format '%lu' expects type 'long unsigned int', but argument 2 has type 'size_t' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-12-13syscalls: add selftest for execveat(2)David Drysdale3-0/+431
Signed-off-by: David Drysdale <drysdale@google.com> Cc: Meredydd Luff <meredydd@senatehouse.org> Cc: Shuah Khan <shuah.kh@samsung.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Rich Felker <dalias@aerifal.cx> Cc: Christoph Hellwig <hch@infradead.org> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>