aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2020-10-20 18:11:10 +0100
committerEric Biggers <ebiggers@google.com>2020-10-21 11:12:34 -0700
commit50d51d8618c2d52844ef1d2da263ecda3067a5ee (patch)
treef90ea0ef6cb1685290e23a78330c5b9808804cff
parenta00024e8d7fef1d214fb3603ec247a8370a22ca7 (diff)
downloadfsverity-utils-50d51d8618c2d52844ef1d2da263ecda3067a5ee.tar.gz
Makefile check: use LD_LIBRARY_PATH with USE_SHARED_LIB
When USE_SHARED_LIB is set, the fsverity binary is dynamically linked, so the check rule fails. Set LD_LIBRARY_PATH to the working directory. Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> Link: https://lore.kernel.org/r/20201020171110.2718640-1-luca.boccassi@gmail.com Signed-off-by: Eric Biggers <ebiggers@google.com>
-rw-r--r--Makefile18
1 files changed, 13 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index deffe8b..2a2e067 100644
--- a/Makefile
+++ b/Makefile
@@ -71,6 +71,14 @@ DEFAULT_TARGETS :=
COMMON_HEADERS := $(wildcard common/*.h)
LDLIBS := -lcrypto
+# If we are dynamically linking, when running tests we need to override
+# LD_LIBRARY_PATH as no RPATH is set
+ifdef USE_SHARED_LIB
+RUN_FSVERITY = LD_LIBRARY_PATH=./ ./fsverity
+else
+RUN_FSVERITY = ./fsverity
+endif
+
##############################################################################
#### Library
@@ -166,12 +174,12 @@ check:fsverity test_programs
for prog in $(TEST_PROGRAMS); do \
$(TEST_WRAPPER_PROG) ./$$prog || exit 1; \
done
- ./fsverity --help > /dev/null
- ./fsverity --version > /dev/null
- ./fsverity sign fsverity fsverity.sig \
+ $(RUN_FSVERITY) --help > /dev/null
+ $(RUN_FSVERITY) --version > /dev/null
+ $(RUN_FSVERITY) sign fsverity fsverity.sig \
--key=testdata/key.pem --cert=testdata/cert.pem > /dev/null
- ./fsverity sign fsverity fsverity.sig --hash=sha512 --block-size=512 \
- --salt=12345678 \
+ $(RUN_FSVERITY) sign fsverity fsverity.sig --hash=sha512 \
+ --block-size=512 --salt=12345678 \
--key=testdata/key.pem --cert=testdata/cert.pem > /dev/null
rm -f fsverity.sig
@echo "All tests passed!"