mirror of
https://github.com/dynup/kpatch
synced 2024-12-28 08:12:01 +00:00
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>
This commit is contained in:
parent
b9c56c475a
commit
a0edfc1ded
@ -18,12 +18,23 @@ TENV = PARA_STRUCT_SIZE=16 EX_STRUCT_SIZE=12 BUG_STRUCT_SIZE=12 ALT_STRUCT_SIZE=
|
||||
TARGETS = $(patsubst %.$(EXT_ORIG),%.$(EXT_OUTPUT),$(wildcard *.$(EXT_ORIG)))
|
||||
TEST_TARGETS = $(patsubst %.$(EXT_TEST),%.$(EXT_TEST_OUTPUT),$(wildcard *.$(EXT_TEST)))
|
||||
|
||||
define check_lfs =
|
||||
$(if $(shell head -1 $(1) | grep git-lfs.github.com),
|
||||
$(error $(1) is not fetched. Unittests require https://git-lfs.github.com/),
|
||||
)
|
||||
endef
|
||||
|
||||
define check_stripped =
|
||||
$(if $(shell readelf --debug-dump $(1)),
|
||||
$(error $(1) is not properly stripped, use 'strip --strip-debug --keep-file-symbols $(1)' to fix this),
|
||||
)
|
||||
endef
|
||||
|
||||
define check_all =
|
||||
$(call check_lfs,$(1))
|
||||
$(call check_stripped,$(1))
|
||||
endef
|
||||
|
||||
all: $(TARGETS) $(TEST_TARGETS)
|
||||
|
||||
clean:
|
||||
@ -35,14 +46,14 @@ clean:
|
||||
@touch $@
|
||||
|
||||
%.$(EXT_OUTPUT): %.$(EXT_ORIG) %.$(EXT_PATCHED) $(CDO)
|
||||
$(call check_stripped,$(TNAME).$(EXT_ORIG))
|
||||
$(call check_stripped,$(TNAME).$(EXT_PATCHED))
|
||||
$(call check_all,$(TNAME).$(EXT_ORIG))
|
||||
$(call check_all,$(TNAME).$(EXT_PATCHED))
|
||||
$(TENV) $(CDO) $(TNAME).$(EXT_ORIG) $(TNAME).$(EXT_PATCHED) \
|
||||
$(TNAME).$(EXT_ORIG) $@ /dev/null test_$(TNAME) $(MUTE)
|
||||
|
||||
%.$(EXT_OUTPUT): %.$(EXT_ORIG) %.$(EXT_FAIL) $(CDO)
|
||||
$(call check_stripped,$(TNAME).$(EXT_ORIG))
|
||||
$(call check_stripped,$(TNAME).$(EXT_FAIL))
|
||||
$(call check_all,$(TNAME).$(EXT_ORIG))
|
||||
$(call check_all,$(TNAME).$(EXT_FAIL))
|
||||
! $(TENV) $(CDO) $(TNAME).$(EXT_ORIG) $(TNAME).$(EXT_FAIL) \
|
||||
$(TNAME).$(EXT_ORIG) $@ /dev/null test_$(TNAME) $(MUTE)
|
||||
# Expecting to fail, thus create output file manually so we won't rerun the
|
||||
|
Loading…
Reference in New Issue
Block a user