Commit 1f58ffa4 authored by Karel Koci's avatar Karel Koci 🤘

Allow running valgrind tests with system openssl and add README

parent a2d5e035
Updater (New generation)
------------------------
Updating software for Turris OS. This is alternative hands off package manager.
Requested system state (set of installed packages) are specified in Lua
configuration scripts.
Dependencies
------------
Binary dependencies:
* C compiler (gcc preferred)
* Lua 5.1
* libcurl
* libevent2
Runtime dependencies:
* usign (for signatures validation)
Documentation dependencies:
* asciidoc
Coverage info generation:
* lcov
Dependencies for tests:
* perl common::sense
* check
* cppcheck
* luacheck
* valgrind
Running tests
-------------
There are two types of tests. Unit and integration tests. (Integration tests are
called as system one in this project).
You can run all tests using following command:
````
make check
```
To run just unit tests then run `make test` and if you want to run just system
tests then run `make test-sys`. To run specific test then run `make test-c-*` for
C tests and `make test-lua-*` for lua test (where `*` should be replaced with name
of that test).
All tests can also be executed with valgrind. You can do that by replacing `test`
with `valgrind` in all previous possible `make` calls.
There is a known problem with OpenSSL and valgrind. Because of that we have to
compile our own OpenSSL version (although we link against system one) with PURITY
flag set. If you have OpenSSL on your system compiled with this flag then you can
specify `OPENSSL_PURITY=y` to makefile calls.
On top of standard tests this project can be also checked with cppcheck and
luacheck. Both of these have their make target. Respectively it's `make cppcheck`
and `make luacheck`.
......@@ -38,7 +38,7 @@ $(O)/.coverage.info:
coverage: $(O)/.coverage.info
genhtml $< --output-directory $(O)/coverage
endif
clean: clean-coverage clean-openssl
clean: clean-coverage
clean-coverage:
rm -rf $(O)/.lua_coverage
rm -f $(O)/.coverage.info
......@@ -77,34 +77,13 @@ 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_LIBS_TARGET = $(OPENSSL_BUILD_PATH)/%/libcrypto.so $(OPENSSL_BUILD_PATH)/%/libssl.so
$(OPENSSL_LIBS_TARGET): $(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)
# Make marks these libraries as intermediate, but we need we don't want them
# compile every time so lets set them as precious.
.PRECIOUS: $(OPENSSL_LIBS_TARGET)
clean-openssl:
rm -rf $(OPENSSL_BUILD_PATH)
ifeq (,$(OPENSSL_PURITY))
include $(S)/tests/openssl_purity.mk
else
# Otherwise just set these variables as empty
OPENSSL_LIBS=
OPENSSL_ENV=
endif
# Tests
test-c-%: $(O)/bin/ctest-% FORCE
......
# 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_LIBS_TARGET = $(OPENSSL_BUILD_PATH)/%/libcrypto.so $(OPENSSL_BUILD_PATH)/%/libssl.so
$(OPENSSL_LIBS_TARGET): $(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)
# Make marks these libraries as intermediate, but we need we don't want them
# compile every time so lets set them as precious.
.PRECIOUS: $(OPENSSL_LIBS_TARGET)
clean-openssl:
rm -rf $(OPENSSL_BUILD_PATH)
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