2016-07-15 20:34:47 +03:00
BASE_TESTS_ENVIRONMENT = \
2016-06-06 19:46:48 +03:00
builddir=$(abs_builddir) \
topsrcdir=$(abs_top_srcdir) \
commondir=$(abs_top_srcdir)/tests/common
2016-02-10 13:42:57 +03:00
2016-07-15 20:34:47 +03:00
AM_TESTS_ENVIRONMENT = \
UNINSTALLEDTESTS=1 \
$(BASE_TESTS_ENVIRONMENT)
2016-08-03 21:30:17 +03:00
# we consume libdnf as a submodule, but we may not have installed it yet (and we
2016-07-04 22:42:31 +03:00
# don't want it to fall back to the system libhif if it's also installed)
AM_TESTS_ENVIRONMENT += \
2017-07-13 23:39:01 +03:00
LD_LIBRARY_PATH=$(abs_builddir)/libdnf-build/libdnf:$$(cd $(top_builddir)/.libs && pwd)$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}} \
GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
2016-07-04 22:42:31 +03:00
$(NULL)
2017-01-17 21:29:48 +03:00
if BUILDOPT_ASAN
2017-09-21 23:59:28 +03:00
AM_TESTS_ENVIRONMENT += BUILDOPT_ASAN=yes ASAN_OPTIONS=detect_leaks=false
2017-01-17 21:29:48 +03:00
endif
2016-07-04 22:42:31 +03:00
2017-06-29 17:01:28 +03:00
testbin_cppflags = $(AM_CPPFLAGS) -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx -I $(srcdir)/tests/common
2017-04-21 23:23:33 +03:00
testbin_cflags = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
testbin_ldadd = $(PKGDEP_RPMOSTREE_LIBS) librpmostree-1.la librpmostreepriv.la
2017-06-29 17:01:28 +03:00
noinst_LTLIBRARIES += libtest.la
libtest_la_SOURCES = tests/common/libtest.c
libtest_la_CPPFLAGS = $(testbin_cppflags)
libtest_la_CFLAGS = $(testbin_cflags)
libtest_la_LIBADD = $(testbin_ldadd)
2017-04-21 23:23:33 +03:00
tests_check_jsonutil_CPPFLAGS = $(testbin_cppflags)
tests_check_jsonutil_CFLAGS = $(testbin_cflags)
2017-06-29 17:01:28 +03:00
tests_check_jsonutil_LDADD = $(testbin_ldadd) libtest.la
2017-04-21 23:23:33 +03:00
tests_check_postprocess_CPPFLAGS = $(testbin_cppflags)
tests_check_postprocess_CFLAGS = $(testbin_cflags)
2017-06-29 17:01:28 +03:00
tests_check_postprocess_LDADD = $(testbin_ldadd) libtest.la
2017-03-16 18:29:21 +03:00
2017-04-27 20:40:34 +03:00
tests_check_test_utils_CPPFLAGS = $(testbin_cppflags)
tests_check_test_utils_CFLAGS = $(testbin_cflags)
2017-06-29 17:01:28 +03:00
tests_check_test_utils_LDADD = $(testbin_ldadd) libtest.la
2017-04-27 20:40:34 +03:00
2016-06-06 19:08:29 +03:00
uninstalled_test_programs = \
2016-06-06 19:46:48 +03:00
tests/check/jsonutil \
2017-03-16 18:29:21 +03:00
tests/check/postprocess \
2017-04-27 20:40:34 +03:00
tests/check/test-utils \
2014-07-16 17:02:45 +04:00
$(NULL)
2014-12-18 04:26:31 +03:00
2016-06-06 19:08:29 +03:00
uninstalled_test_scripts = \
2016-06-06 19:46:48 +03:00
tests/check/test-basic.sh \
tests/check/test-ucontainer.sh \
2014-12-18 04:26:31 +03:00
$(NULL)
2015-03-28 15:47:25 +03:00
2016-06-06 19:08:29 +03:00
uninstalled_test_extra_programs = dbus-run-session
2016-02-10 13:42:57 +03:00
2016-06-06 19:46:48 +03:00
dbus_run_session_SOURCES = tests/utils/dbus-run-session.c
2015-09-08 18:06:25 +03:00
2017-06-29 17:11:25 +03:00
check-local:
2015-03-28 15:47:25 +03:00
@echo " *** NOTE ***"
@echo " *** NOTE ***"
@echo " \"make check\" only runs a subset of rpm-ostree's tests."
2016-06-06 19:08:29 +03:00
@echo " Use \"make vmcheck\" to run remaining tests in a VM."
2015-03-28 15:47:25 +03:00
@echo " *** NOTE ***"
@echo " *** NOTE ***"
2016-02-26 19:31:33 +03:00
2017-09-01 20:33:36 +03:00
.PHONY: vmsync vmoverlay vmcheck testenv
2016-06-15 00:12:17 +03:00
2017-07-05 19:02:33 +03:00
HOSTS ?= "vmcheck"
2017-03-11 01:52:26 +03:00
2017-09-01 20:33:36 +03:00
vmsync:
2017-09-09 01:10:43 +03:00
@env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/install.sh && \
2017-09-01 20:33:36 +03:00
env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/sync.sh
2016-06-28 23:22:49 +03:00
vmoverlay:
2017-01-06 17:52:57 +03:00
@if [ -z "$(SKIP_VMOVERLAY)" ]; then \
2017-09-09 01:10:43 +03:00
env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/install.sh && \
2017-03-11 01:52:26 +03:00
echo -n "$(HOSTS)" | xargs -P 0 -n 1 -d ' ' -I {} \
env $(BASE_TESTS_ENVIRONMENT) VM={} \
./tests/vmcheck/overlay.sh; \
2017-01-06 17:52:57 +03:00
fi
2016-06-28 23:22:49 +03:00
2016-06-21 19:37:02 +03:00
# set up test environment to somewhat resemble uninstalled tests
2017-06-29 17:11:25 +03:00
vmcheck: vmoverlay
2017-03-11 01:52:26 +03:00
@env VMTESTS=1 $(BASE_TESTS_ENVIRONMENT) PYTHONUNBUFFERED=1 \
tests/vmcheck/multitest.py $(HOSTS)
2016-06-21 19:37:02 +03:00
2016-02-26 19:31:33 +03:00
testenv:
@echo "===== ENTERING TESTENV ====="
test_tmpdir=$$(mktemp -d test.XXXXXX) && \
cd $$test_tmpdir && \
2016-08-18 00:03:54 +03:00
env $(BASE_TESTS_ENVIRONMENT) PATH=$(abs_builddir):$$PATH TESTENV=1 \
2016-06-15 23:02:36 +03:00
sh ../tests/utils/setup-session.sh bash && \
2016-02-26 19:31:33 +03:00
cd .. && \
rm -rf $$test_tmpdir
@echo "===== LEAVING TESTENV ====="