Commit graph

10 commits

Author SHA1 Message Date
Shuah Khan
7c466b97cc selftests: kselftest.h: Add SPDX license identifier
Replace GPL license statement with SPDX GPL-2.0 license identifier.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2018-01-12 11:46:21 -07:00
Shuah Khan
11867a77eb selftests: kselftest framework: change skip exit code to 0
When a test is skipped, instead of using a special exit code of 4, treat
it as pass condition and use exit code of 0. It makes sense to treat skip
as pass since the test couldn't be run as opposed to a failed test.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-25 10:02:00 -06:00
Shuah Khan
c0bb2cf40e selftests: kselftest framework: add error counter
Some tests track errors in addition to test failures. Add ksft_error
counter, ksft_get_error_cnt(), and ksft_test_result_error() API to
get the counter value and print error message.

Update ksft_print_cnts(), and ksft_test_num() to include error counter.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-08-09 10:39:05 -06:00
Shuah Khan
1d3ee8bef9 selftests: kselftest framework: add API to return pass/fail/* counts
Some tests print final pass/fail message based on fail count. Add
ksft_get_*_cnt() API to kselftest framework to return counts.

Update ksft_print_cnts() to print the test results summary message with
individual pass, fail, ... counters.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com>
2017-07-28 13:20:19 -06:00
Paul Elder
ab52a48445 kselftest: add ksft_print_msg() function to output general information
Add a generic information output function: ksft_print_msg()

Signed-off-by: Paul Elder <paul.elder@pitt.edu>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30 16:15:04 -06:00
Paul Elder
151b273211 kselftest: make ksft_* output functions variadic
Make the ksft_* output functions variadic to allow string formatting
directly in these functions.

Signed-off-by: Paul Elder <paul.elder@pitt.edu>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-30 16:14:55 -06:00
Paul Elder
54f57baab6 kselftest: make ksft_exit_skip() output a reason for skipping
Make ksft_exit_skip() input an optional message string as the reason
for skipping all the tests and outputs it prior to exiting.

Signed-off-by: Paul Elder <paul.elder@pitt.edu>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-15 18:07:45 -06:00
Paul Elder
b6a4b66d84 kselftest: add TAP13 conformant versions of ksft_* functions
Add TAP13 conformat output functions to kselftest.h.

Also add exit functions that output TAP13 exiting text, as well as
functions to keep track of testing progress.

Signed-off-by: Paul Elder <paul.elder@pitt.edu>
Signed-off-by: Alice Ferrazzi <alice.ferrazzi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-06-13 12:57:35 -06:00
Darren Hart
4100e675a9 kselftest: Add exit code defines
Define the exit codes with KSFT_PASS and similar so tests can use these
directly if they choose. Also enable harnesses and other tooling to use
the defines instead of hardcoding the return codes.

Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: linux-api@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-05-26 15:58:08 -06:00
Shuah Khan
7fb2c3ea28 selftests: add kselftest framework for uniform test reporting
Add kselftest framework for tests to use. This is a light
weight framework provides a set of interfaces to report test
results. Tests can use these interfaces to report pass, and
fail cases as well as when failure is due to configuration
problems such as missing modules, or when a test that is should
fail, fails as expected, and a test that should fail, passes.
The framework uses POSIX standard return codes for reporting
results to address the needs of users that want to run the kernel
selftests from their user-space test suites and want to know why a
test failed. In addition, the framework includes interfaces to use
to report test statistics on number of tests passed and failed.

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2014-11-17 10:38:56 -07:00