Commit Graph

17 Commits

Author SHA1 Message Date
Josh Poimboeuf c6259d898c
Merge pull request #1006 from sm00th/unit_fail
tests/unit: fix inconsistent FAIL test failures
2019-07-24 09:58:14 -05:00
Artem Savkov 8c6a031cdb tests/unit: fix inconsistent FAIL test failures
Use make's .DELETE_ON_ERROR special target to make sure we don't have
any .OUTPUT.o leftovers for failed tests.

Fixes: #999

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-07-23 10:57:43 +02:00
Josh Poimboeuf 64f07c6c72 test/unit: Fix symtab generation for ppc64le
The ppc64le unit tests are failing because the lookup code is getting
confused by the "[<localentry>: 8]" string in the readelf symbol table
output.

Remove the string so the lookup code can parse it correctly.
kpatch-build already uses the same sed, so they should match.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2019-07-22 14:48:25 -05:00
Josh Poimboeuf b7edef7360 test/unit: Fix env override for Make 3.x
Make 3.8 doesn't support the "file" function, which is used by the unit
test Makefile to output the contents of a custom env file, if one
exists.  Use shell instead.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2019-07-16 21:58:41 -05:00
chenzefeng d91b416b00 test: use readelf instead of eu-readelf
readelf is more standard, using readelf insteaded

test/difftree.sh: the symbol name may be with "FILE", which may be
get a incorrect count, here add "awk".

test/unit/Makefile.include: use "readelf -s --wide" instead of
"eu-readelf -s".

Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
2019-05-30 17:45:44 +08:00
Joe Lawrence ccd0615407 test/unit: relax stripped object requirement
Some unit tests may need debug symbols to reproduce problems (see
issue #928 for example), so skip the unit-test Makefile.include
check_stripped call for objects that include "NOSTRIP" in their
filename.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
2019-02-22 10:49:54 -05:00
Artem Savkov e94bba2b94 test/unit: add support for .env files
Add support for optional <test-name>.env files that contain additional
environment variables. This can also be used to override per-arch env
vars we have because last value assigned will be used.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2019-02-08 15:16:17 +01:00
Artem Savkov 3aa5abb807 kpatch-build: use symbol table instead of kobject
create-diff-object doesn't really need the full kernel object file as
input. All it requires is a symbol table. Switch to using "eu-readelf -s"'s
output instead of object files. This will enable us to cover more cases
in unit tests.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-05-18 09:24:40 +02:00
Artem Savkov e0acd5f835 unittests: object submodule update
Update submodule to 6774fbc "ppc64le: initial object files"
Remove CDO_ENV since it is moved to per-arch makefiles.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-27 20:10:43 +02:00
Artem Savkov ffc4122efb Add kpatch-unit-objs submodule
Add a submodule containing object files for unittests.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-26 18:49:29 +02:00
Josh Poimboeuf 3feb694c91 test/unit: further silence non-verbose mode
Just show a summary of each test command in non-verbose mode.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-04-20 08:16:26 -05:00
Josh Poimboeuf 4c1184dcf7 test/unit: add a library for common functions
I placed the library in the top-level test directory, as the same
assertions could also be used by the integration tests once we rework
them a bit.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-04-20 08:16:20 -05:00
Josh Poimboeuf ff5bcc2fdc test/unit: broaden the 'clean' target
Broaden the impact of the 'clean' target so that output objects will
still get cleaned when when old tests get removed or renamed.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-04-19 17:19:08 -05:00
Josh Poimboeuf 69ba464462 unit: don't suppress stderr in non-fail tests
Don't suppress stderr in the non-fail unit tests so that
create-diff-object error messages will be printed.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-04-18 08:03:25 -05:00
Artem Savkov a0edfc1ded unittests: check that obj files are fetched
Check that tested .o is not an lfs meta-file before testing.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-13 18:11:50 +02:00
Artem Savkov b9c56c475a uinttests: add strip check
Check that files are stripped of debuginfo as it is useless for
unittesting at this moment.

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-13 18:11:17 +02:00
Artem Savkov a05c644c7b Add create-diff-object unittest framework
Add a simple unittest framework for create-diff-object implemented in
GNU Make.
It will automatically scan the kpatch-unit-objs/$(uname -m) directory
for specifically named files running one of 3 tests:
  - creating diff object with expected success
  - creating diff object with expected failure
  - creating diff object and running a shell script on it with expected
  success

Signed-off-by: Artem Savkov <asavkov@redhat.com>
2018-04-13 18:09:37 +02:00