1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

makefile: enhance run-unit-test target

Use TMPDIR for executing test and also ensure
all libraries linked to the test are from builddir.
This commit is contained in:
Zdenek Kabelac 2021-10-15 09:45:26 +02:00
parent 037165300e
commit 2e2d673780

View File

@ -54,7 +54,12 @@ $(UNIT_TARGET): $(UNIT_OBJECTS) $(LVMINTERNAL_LIBS)
unit-test: $(UNIT_TARGET)
run-unit-test: $(UNIT_TARGET)
@echo "Running unit tests"
LD_LIBRARY_PATH=$(top_builddir)/libdm $(UNIT_TARGET) run
test -n "$$LVM_TEST_DIR" || LVM_TEST_DIR=$${TMPDIR:-/tmp} ;\
TESTDIR=$$(mktemp -d -t -p "$$LVM_TEST_DIR" "LVMTEST.XXXXXXXXXX") ;\
cd "$$TESTDIR" ;\
LD_LIBRARY_PATH=$(abs_top_builddir)/libdm:$(abs_top_builddir)/daemons/dmeventd $(abs_top_builddir)/$(UNIT_TARGET) run ;\
cd $$OLDPWD ;\
$(RM) -r "$${TESTDIR:?}"
ifeq ("$(DEPENDS)","yes")
-include $(UNIT_SOURCE:%.c=%.d)