Commit Graph

231 Commits

Author SHA1 Message Date
Josh Poimboeuf f85c1c6f43 test: detect kernel oopses and warnings 2014-06-27 13:24:14 -05:00
Josh Poimboeuf e8f396229d test: remove annoying printks
The printks in the integration tests aren't very useful and annoyingly
fill up the dmesg buffer.  Remove them by making them contingent on
unlikely conditions.
2014-06-27 13:15:02 -05:00
Josh Poimboeuf 2362d44783 create-diff-object: include new functions 2014-06-25 16:46:08 -05:00
Seth Jennings 88cac305be Merge pull request #230 from jpoimboe/isra
create-diff-object: support gcc function name mangling
2014-06-03 12:22:39 -05:00
Josh Poimboeuf 72e260f50c create-diff-object: support gcc function name mangling
Fixes #189.
Fixes #228.
2014-06-03 11:26:03 -05:00
Seth Jennings 5b62d5f169 add module for testing module patching
A simple kernel module for testing basic kernel module patching.

Just run doit.sh from test/testmod.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-06-02 20:34:38 -05:00
Josh Poimboeuf 401680a7c9 create-diff-object: tracepoint & jump label fixes
The current approach of trying to include the tracepoint-related
sections doesn't work at all.  The new tracepoints don't show up in
"perf list".

And also, with one patch (issue #219) I've seen a panic in
jump_label_del_module().  I suspect it's because the kernel is confused
by dynamic relocations' changing of the jump table after it was
registered with the jump table code.

I think the best approach for now is to just always exclude these
sections.  It should be harmless, with the only consequence being that
tracepoints and jump labels can't be enabled in patched functions (which
is already the case with the current code anyway).

Fixes #221.
2014-05-30 15:20:08 -05:00
Josh Poimboeuf 92a4ca2621 create-diff-object: support tracepoints and related sections
Add support for the following special sections:

- __jump_table
- __tracepoints
- __tracepoints_ptrs
- __tracepoints_strings

Fixes #157.
2014-05-27 12:47:45 -05:00
Josh Poimboeuf 698cc1c137 create-diff-object: support fixup and related sections
Add support for the following sections:

- .fixup
- __ex_table
- .altinstructions
- .altinstr_replacement

Fixes #187.
2014-05-27 12:47:45 -05:00
Josh Poimboeuf 6aee215b04 Merge pull request #213 from jpoimboe/test-combined
test: add much quicker combined test option
2014-05-27 09:51:57 -05:00
Josh Poimboeuf d7f209f838 test: add much quicker combined test option
Combine all the patch modules into a single kpatch-COMBINED.ko for a
much quicker test which still gives 95% or so of the coverage compared
to the full test suite.  Use "make quick" for use this new option.
2014-05-27 09:40:24 -05:00
Seth Jennings be4ee611c1 remove inventory based testing
The inventory based testing for create-diff-object was introduced at a
time when create-diff-object only needed the two object files to operate.
Now, it requires vmlinux as well.  This makes the inventory testing (a
unit testing framework for create-diff-object) obsolete and difficult to
update in it's current form.

This commit removes the inventory test framework.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-26 16:51:53 -05:00
Josh Poimboeuf b143442916 test: tell user to check test.log on error 2014-05-20 14:34:11 -05:00
Josh Poimboeuf ecfed91904 test: add basic tests for special sections
One of the tests is now failing:

    ERROR: smp-locks-section: kpatch replace failed

I suspect the issue is the vmlinux mismatch problem.  Fix for that
coming soon.
2014-05-15 17:14:25 -05:00
Josh Poimboeuf 707afe238c test: add make targets 2014-05-15 16:24:33 -05:00
Josh Poimboeuf c7d3c5d86c test: do load/unload testing for modules that don't have tests
Do some basic load/unload tests for all the test modules, even if they
don't have a corresponding -LOADED.test file.
2014-05-15 16:22:45 -05:00
Seth Jennings 08dbc37c75 add null symbol to inventory files
Add the null symbol to in inventory files.  Before the linked-link
change, the null symbol wasn't included in the inventory.  However,
it is required to be a valid ELF file and should be inventoried and
check for in the test.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-05-07 10:16:39 -05:00
Josh Poimboeuf b541692061 test: add test for loading multiple modules 2014-05-05 20:03:57 -05:00
Josh Poimboeuf 1fced0bc3d test: fix unload_all 2014-05-05 20:03:57 -05:00
Josh Poimboeuf df2e2daa92 test: send status messages to log file 2014-05-05 20:03:54 -05:00
Josh Poimboeuf 100f358b1d test: fix custom test error condition check 2014-05-05 17:05:49 -05:00
Josh Poimboeuf bcbc9d3109 test: make .init sections can't be changed 2014-05-05 17:05:49 -05:00
Josh Poimboeuf 7c60dcf2a3 test: make output messages easier to read 2014-05-05 17:05:49 -05:00
Josh Poimboeuf 46786dad93 test: add custom test for kpatch replace 2014-05-05 17:05:44 -05:00
Josh Poimboeuf 757120d8a0 test: add meminfo-cmdline test 2014-05-05 16:05:00 -05:00
Josh Poimboeuf a0c9aff4cc test: fix uninitialized skip variable 2014-05-05 16:05:00 -05:00
Josh Poimboeuf 3ae6bc46ff test: add cmdline-string test 2014-05-05 16:05:00 -05:00
Josh Poimboeuf d3aee7c734 test: test 'kpatch reload' and cleanup between tests 2014-05-05 16:04:58 -05:00
Josh Poimboeuf e19b0ad978 test: make load/unload errors fatal
No need to accumulate errors if the load or unload fails.  Leaving the
testprog failure non-fatal so that the test will then call unload to
clean up after itself.
2014-04-28 13:32:00 -05:00
Josh Poimboeuf 0d2ab160fe create integration test framework
This is a basic integration test framework for kpatch, which tests
building, loading, and unloading patches, as well as any other related
custom tests.

The kpatch-test script looks for test input files in the
tests/integration directory.  It expects certain file naming
conventions:

- foo.patch - patch that should build successfully

- bar-FAIL.patch - patch that should fail to build

- foo-LOADED.test - executable which tests whether the foo.patch module
  is loaded.  It will be used to test that loading/unloading the patch
  module works as expected.

Any other *.test files will be executed after all the patch modules have
been built from the *.patch files.  They can be used for more custom
tests above and beyond the simple loading and unloading tests.

I just have one test here, but many more to come eventually.  I'm
constantly doing manual testing of patches and am planning on automating
them with this framework.
2014-04-26 16:23:05 -05:00
Seth Jennings 0cbb7cf5ee add automated testing system
This commit introduces a simple automated testing system
with 3 simple testcase.

For each test case there is a .c, a .patch, and a .inventory
file.  The .c is compiled, using the flags from the kflags file,
to create the original object.  The .c file is then patched
with the .patch file and rebuilt to create the patched object.
The files are then analyzed by the differencing tool and an
output object is generated with a .inventory file that lists
the sections and symbol included in the output object.  That
inventory file is then compared to the .inventory file for
that testcase.  If they are the same, the test passes. If
not, the differences in the inventory files are displayed,
and the test fails.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-10 14:36:11 -05:00