This commit adds scripts/make targets to run integration tests on
fedora/ubuntu/centos through vagrant.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Vagrant installation functions for fedora/centos with libvirt plugin.
This is intended to be used in scripts to provision a new test-machine,
human users of vagrant integration test targets are expected to have
working vagrant installation.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Add functions to prepare a separate partition/disk for cache use
(.ccache and .kpatch dirs). This is useful for vagrant images that are
generally not big enough for kpatch build.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Add test/integration/lib.sh for use in other kpatch related scripts
and or directly by end-users. Initial version contains per-distro
dependency functions, so it can be quickly installed as follows:
$ . test/integration/lib.sh
$ kpatch_dependencies
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Treat -SLOW patches the same way as normal ones, i.e. include them
during "quick" testing. Keeping "-SLOW" suffix in patch names to as a
way to distinguish them manually.
Signed-off-by: Artem Savkov <asavkov@redhat.com>
We are not including -SLOW patches into combined module, so there is no
reason to expect their -LOADED tests to succeed with combined module.
Skip them in run_combined_test().
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Since c0105ea467 ("kpatch-build: set default module prefix
accordingly") kpatch-build has automatically named resulting patch
modules with a "kpatch-" or "livepatch-" prefix (depending on its type).
To avoid naming confusion, have kpatch-test name all of its patch
modules with a "test-" prefix.
Fixes#867.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Cleaning house a bit. Now that we have unit tests, a lot of these tests
aren't very useful anymore.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
After doing some research, I've discovered that most of these tests no
longer test what they were originally intended to test.
An exception here is the 'macro-hooks' test, which is probably better
suited as an integration test, so I removed its unit test and kept its
integration test.
Really, most of these tests weren't all that useful to begin with, so
it's not a big loss. The one exception is 'gcc-static-local-var-2',
which was originally meant to test multiple static local variables with
the same name in the name function. That's a good thing, so I'll try to
come up with another test for that which works with Linux 4.16.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
The test case gcc-static-local-var-2 doesn't uses any macros
from kpatch-macros.h, so remove the hunk including it.
Cc: Joe Lawrence <jdl1291@gmail.com>
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
This patch adds a reproducer testcase for correlating static local
variables added in .rodata* section, ahead of .toc section. This
testcase is for issue seen on PowerPC. For more details on the issue
refer pull request: 793.
It add's the testcase for:
- Fedora-27 Kernel version 4.15.10-300
- Centos-7 Kernel version 3.10.0-693 and
- Ubuntu-16.04 Kernel version 4.13.0-25.29
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Upstream 4.15 kernels provide support for pre and post (un)patch
callbacks, inspired by the kpatch load hooks. Add support for them
in the livepatch-patch-hook.
At the same time, convert the kpatch hooks to use the same API.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Now that kpatch-build can accept multiple patches on the command line,
ditch the combinediff and associated logic in the integration test
script.
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
If kpatch-test processes a single .patch file, it will skip creating a
COMBINED.patch.
Do the same on the testing side (instead of complaining that it "can't
find kpatch-COMBINED.ko, skipping.")
If kpatch-test looks for *.patch or *.test globs in a directory that
contains no such files, it will try to handle a single file named
"*.patch" or "*.test".
Set the global nullglob option to avoid this problem. At the same time,
stop and whine to the user if no .patch files were found.
Instead of building *.patch, allow the user to specify patch files on
the command line. For example:
kpatch-test --quick centos-7/cmdline-string.patch centos-7/data-new.patch
Update the top-level Makefile as well, so it can be similarly invoked:
PATCHES="centos-7/cmdline-string.patch centos-7/data-new.patch" make quick
If no patches are specified on the kpatch-test command line, then fall
back to the previous behavior of *.patch.
NOTE: If patches *are* specified, then only the .test files
corresponding to those patches will be executed. Provided patch paths
will also override any --directory value.
Move the integration tests Makefile up a directory level so that it can
be shared. Update the kpatch-test script to accept a patch-directory
argument and the multiple.test cases to handle this new arrangement.
Prepare for updating the integration tests and move into a standard path
(this should be easier for future automation).
The patch directory name(s) should be in the form ${ID}-${VERSION_ID}/
as defined by the target's /etc/os-release.
Create a "make remote" target and a poor man's ansible to allow setting
up a remote F22 system and running integration tests on it.
To run tests remotely:
make remote SSH_HOST=my.remote.f22.box
The integration tests are targeted for Fedora kernels, so move them to a
new f22 directory. The README file specifies the exact kernel version
they're targeted for.
The _rs variable is used for printk ratelimiting, similar to __warned,
which makes it a logical candidate to be "special": don't correlate it,
yet don't mark a function as changed just because it references it.
When patching a kernel module, if we can't find a needed dynrela symbol,
we currently assume it's exported. However, it's also possible that
it's provided by another .o in the patch module. Add support for that.
Fixes#445.
Currently unbundled section references are only replaced if the start of
the symbol is referenced. It's also useful to support replacement of
references which point to inside the symbol.
Improve the static local variable correlation logic, for the case where
a static local is used by multiple functions. For each usage of the
variable, look for a corresponding usage in the base object. If we find
at least one matching usage, consider it a twin.