linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add livepatch kselftests
@ 2018-03-28 19:49 Joe Lawrence
  2018-03-28 19:49 ` [PATCH] selftests/livepatch: introduce tests Joe Lawrence
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Lawrence @ 2018-03-28 19:49 UTC (permalink / raw)
  To: live-patching, linux-kernel

Hi all,

This patch was motivated by the increasing corner cases in the livepatch
code.  These tests don't cover anywhere near all of them, but were
mostly already written up as demonstrations / documentation of the
livepatch callback functionality.  Converting them into a test rig
didn't take long.

So the testing methodology is a little hokey as it relies on dmesg order
and filtering.  That said, it's already been used to verify livepatch
callback for "livepatch: Atomic replace feature" patchset.  Any
suggestions for better testing would be welcome.

I didn't get to the shadow variable testing script yet.  I figured that
I'd share the current state before I got too far along in writing tests.
Suggestions for additional tests and test categories welcome as well.

To try out the tests, configure with:
CONFIG_TEST_LIVEPATCH=m
  
Build kernel, modules, install, etc. then reboot and kick off:
% make -C tools/testing/selftests TARGETS=livepatch run_tests

The tests expect to on top of v10+ of the "livepatch: Atomic replace
feature" series and take ~2.5 minutes to complete.

rfc changes:
- SPDX-License-Identifiers
- Moved livepatch test modules into lib/livepatch
- Renamed livepatch.sh (filename suffix)
- Reduced between-test delay time
- Split off common functions.sh file
- Split into separate livepatch, callbacks, and shadow-vars scrips
- Gave the tests short descriptions instead of TEST1, TEST2, etc.

Joe Lawrence (1):
  selftests/livepatch: introduce tests

 lib/Kconfig.debug                                  |  12 +
 lib/Makefile                                       |   2 +
 lib/livepatch/Makefile                             |  18 +
 lib/livepatch/test_klp_atomic_replace.c            |  69 +++
 lib/livepatch/test_klp_callbacks_busy.c            |  43 ++
 lib/livepatch/test_klp_callbacks_demo.c            | 132 ++++++
 lib/livepatch/test_klp_callbacks_demo2.c           | 104 ++++
 lib/livepatch/test_klp_callbacks_mod.c             |  24 +
 lib/livepatch/test_klp_livepatch.c                 |  62 +++
 tools/testing/selftests/Makefile                   |   1 +
 tools/testing/selftests/livepatch/Makefile         |   8 +
 tools/testing/selftests/livepatch/config           |   1 +
 tools/testing/selftests/livepatch/functions.sh     | 202 ++++++++
 .../testing/selftests/livepatch/test-callbacks.sh  | 526 +++++++++++++++++++++
 .../testing/selftests/livepatch/test-livepatch.sh  | 177 +++++++
 .../selftests/livepatch/test-shadow-vars.sh        |  13 +
 16 files changed, 1394 insertions(+)
 create mode 100644 lib/livepatch/Makefile
 create mode 100644 lib/livepatch/test_klp_atomic_replace.c
 create mode 100644 lib/livepatch/test_klp_callbacks_busy.c
 create mode 100644 lib/livepatch/test_klp_callbacks_demo.c
 create mode 100644 lib/livepatch/test_klp_callbacks_demo2.c
 create mode 100644 lib/livepatch/test_klp_callbacks_mod.c
 create mode 100644 lib/livepatch/test_klp_livepatch.c
 create mode 100644 tools/testing/selftests/livepatch/Makefile
 create mode 100644 tools/testing/selftests/livepatch/config
 create mode 100644 tools/testing/selftests/livepatch/functions.sh
 create mode 100755 tools/testing/selftests/livepatch/test-callbacks.sh
 create mode 100755 tools/testing/selftests/livepatch/test-livepatch.sh
 create mode 100755 tools/testing/selftests/livepatch/test-shadow-vars.sh

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-10 17:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 19:49 [PATCH] Add livepatch kselftests Joe Lawrence
2018-03-28 19:49 ` [PATCH] selftests/livepatch: introduce tests Joe Lawrence
2018-03-29 20:42   ` kbuild test robot
2018-04-07  2:36   ` Josh Poimboeuf
2018-04-08 15:42     ` Joe Lawrence
2018-04-09 14:05       ` Petr Mladek
2018-04-10 14:31         ` Miroslav Benes
2018-04-10 17:51           ` Josh Poimboeuf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).