Commit 5ffe76ae authored by Karel Koci's avatar Karel Koci 🤘

Merge branch 'libcurl'

parents 73a2bd4a 88004543
......@@ -6,6 +6,7 @@
/.objs/
/.gen/
/.lua_coverage/
/tests/openssl
# The desired results
*.html
*.so
......
UPDATER_VERSION := $(shell (git describe --match 'v*' --dirty || echo 'unknown') | sed -e 's/^v//')
LUA_NAME := $(shell for lua in lua5.1 lua-5.1 lua51 lua ; do if pkg-config $$lua ; then echo $$lua ; break ; fi ; done)
VALGRIND:=IN_VALGRIND=1 valgrind --leak-check=full --show-leak-kinds=all --track-fds=yes --trace-children=no --child-silent-after-fork=yes --error-exitcode=1
VALGRIND:=IN_VALGRIND=1 valgrind --leak-check=full --show-leak-kinds=all --track-fds=yes --trace-children=no --child-silent-after-fork=yes --error-exitcode=1 --track-origins=yes --suppressions=$(S)/tests/valgrind.supp
# For picosat, it otherwise needs some headers not available on musl for a feature we don't need. And we need trace enabled.
EXTRA_DEFINES := NGETRUSAGE TRACE UPDATER_VERSION='"$(UPDATER_VERSION)"'
......
......@@ -32,7 +32,7 @@ libupdater_MODULES_3RDPARTY := \
sha256 \
picosat-960/picosat
libupdater_PKG_CONFIGS := $(LUA_NAME) libevent
libupdater_PKG_CONFIGS := $(LUA_NAME) libevent libcurl
# Workaround, lua.pc doesn't containd -ldl, even when it uses dlopen
libupdater_SO_LIBS += dl
......
This diff is collapsed.
......@@ -54,7 +54,7 @@ $(O)/.coverage.info:
coverage: $(O)/.coverage.info
genhtml $< --output-directory $(O)/coverage
endif
clean: clean-coverage
clean: clean-coverage clean-openssl
clean-coverage:
rm -rf $(O)/.lua_coverage
rm -f $(O)/.coverage.info
......@@ -96,21 +96,47 @@ luacheck: $(addprefix luacheck-,$(LUA_AUTOLOAD))
TESTS_ENV = SUPPRESS_LOG=1 S=$(S) TMPDIR=$(abspath $(O)/testdir) COVERAGEDIR=$(abspath $(O)/.lua_coverage)
# Common distributions are compiling openssl without -DPURITY flag. This causes
# problems with valgrind so we compile our own version to be used for valgrind
# tests.
# See: https://www.openssl.org/docs/faq.html
OPENSSL_TEST_VERSION := $(shell openssl version | awk '{print $$2}')
OPENSSL_BUILD_PATH = $(O)/tests/openssl
OPENSSL_LIBS = $(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION)/libcrypto.so $(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION)/libssl.so
OPENSSL_ENV = LD_LIBRARY_PATH=$(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION):$$LD_LIBRARY_PATH
$(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION).tar.gz:
mkdir -p $(OPENSSL_BUILD_PATH)
wget https://www.openssl.org/source/openssl-$(OPENSSL_TEST_VERSION).tar.gz -O $@
# Usage of pattern with multiple targets causes gmake to understand that all of
# those files are produced by this target at once. So this target is run only
# once. See: https://www.gnu.org/software/make/manual/make.html#Pattern-Examples
$(OPENSSL_BUILD_PATH)/%/libcrypto.so $(OPENSSL_BUILD_PATH)/%/libssl.so: $(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION).tar.gz
tar -xzf $< -C $(OPENSSL_BUILD_PATH)
cd $(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION) && ./config shared -DPURIFY
+$(MAKE) -C $(OPENSSL_BUILD_PATH)/openssl-$(OPENSSL_TEST_VERSION)
clean-openssl:
rm -rf $(OPENSSL_BUILD_PATH)
# Tests
test-c-%: $(O)/bin/ctest-% FORCE
mkdir -p $(O)/testdir
$(TESTS_ENV) $<
valgrind-c-%: $(O)/bin/ctest-% FORCE
valgrind-c-%: $(O)/bin/ctest-% $(OPENSSL_LIBS) FORCE
mkdir -p $(O)/testdir
CK_FORK=no $(TESTS_ENV) $(VALGRIND) $<
CK_FORK=no $(TESTS_ENV) $(OPENSSL_ENV) $(VALGRIND) $<
test-lua-%: $(S)/tests/%.lua $(O)/bin/lulaunch FORCE
mkdir -p $(O)/testdir
$(TESTS_ENV) $(O)/bin/lulaunch $<
valgrind-lua-%: $(S)/tests/%.lua $(O)/bin/lulaunch FORCE
valgrind-lua-%: $(S)/tests/%.lua $(O)/bin/lulaunch $(OPENSSL_LIBS) FORCE
mkdir -p $(O)/testdir
$(TESTS_ENV) $(VALGRIND) $(O)/bin/lulaunch $<
$(TESTS_ENV) $(OPENSSL_ENV) $(VALGRIND) $(O)/bin/lulaunch $<
luac-autoload-%: $(S)/src/lib/autoload/a_%.lua FORCE
luac -p $<
......
......@@ -90,7 +90,7 @@ function test_download()
local id2 = download(function (status, answer)
assert_equal(500, status)
called2 = called2 + 1
end, "https://api.turri.cz/does/not/exist", cert);
end, "https://api.turris.cz/does/not/exist", cert);
events_wait(id1, id2);
assert_equal(1, called1);
assert_equal(1, called2);
......
# This ignores leaks in openssl (libcrypto). We can't do anything else with it.
{
libcrypto_leaks
Memcheck:Leak
...
obj:*/libcrypto.so.*
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment