2014-12-18 02:11:47 +03:00
include $(top_srcdir)/buildutil/glib-tap.mk
2014-07-16 17:02:45 +04:00
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 += \
2016-08-03 21:30:17 +03:00
LD_LIBRARY_PATH=$(abs_builddir)/libdnf-build/libdnf \
2016-07-04 22:42:31 +03:00
$(NULL)
2017-01-17 21:29:48 +03:00
if BUILDOPT_ASAN
AM_TESTS_ENVIRONMENT += ASAN_OPTIONS=detect_leaks=false
endif
2016-07-04 22:42:31 +03:00
2015-04-22 12:10:53 +03:00
CLEANFILES += \
2016-06-24 23:42:27 +03:00
tests/common/compose/yum/repo \
2016-06-06 19:46:48 +03:00
tests/common/compose/test-repo.repo \
2015-04-22 12:10:53 +03:00
$(NULL)
2015-03-23 14:23:29 +03:00
2016-06-21 22:19:27 +03:00
testpackages = \
2016-06-24 23:42:27 +03:00
tests/common/compose/yum/repo/packages/x86_64/empty-1.0-1.x86_64.rpm \
tests/common/compose/yum/repo/packages/x86_64/foo-1.0-1.x86_64.rpm \
tests/common/compose/yum/repo/packages/x86_64/bar-1.0-1.x86_64.rpm \
2016-08-18 00:15:30 +03:00
tests/common/compose/yum/repo/packages/x86_64/scriptpkg1-1.0-1.x86_64.rpm \
2017-01-06 17:52:57 +03:00
tests/common/compose/yum/repo/packages/x86_64/nonrootcap-1.0-1.x86_64.rpm \
2017-01-10 17:35:58 +03:00
tests/common/compose/yum/repo/packages/x86_64/test-post-rofiles-violation-1.0-1.x86_64.rpm \
2017-02-13 19:33:50 +03:00
tests/common/compose/yum/repo/packages/x86_64/test-opt-1.0-1.x86_64.rpm \
2016-06-21 22:19:27 +03:00
$(NULL)
# Create a rule for each testpkg with their respective spec file as dep.
# The static pattern feature is almost a fit for this, but does not allow string
# substitutions and wildcards in the patterns to allow rpm-filename -->
# spec-filename without also encoding the arch, release, and rev.
define testpkgbuild_template =
$(1): tests/common/compose/yum/$(2).spec
(cd tests/common/compose/yum && \
rm -rf .build && \
rpmbuild -ba $$$$(basename $$<) \
--define "_sourcedir $$$$PWD" \
--define "_specdir $$$$PWD" \
--define "_builddir $$$$PWD/.build" \
--define "_srcrpmdir $$$$PWD" \
2016-06-24 23:42:27 +03:00
--define "_rpmdir $$$$PWD/repo/packages" \
2016-06-21 22:19:27 +03:00
--define "_buildrootdir $$$$PWD" && \
rm -rf .build && \
rm -f *.src.rpm)
endef
2017-01-10 17:35:58 +03:00
$(foreach pkg,$(testpackages),$(eval $(call testpkgbuild_template,$(pkg),$(shell basename $(pkg) | sed -e 's,-1\.0.*,,'))))
2015-03-23 14:23:29 +03:00
2016-06-24 23:42:27 +03:00
tests/common/compose/yum/repo/repodata/repomd.xml: $(testpackages)
(cd tests/common/compose/yum/repo && \
2016-06-21 22:19:27 +03:00
createrepo_c --no-database $$PWD)
2015-03-23 14:23:29 +03:00
2016-06-24 23:42:27 +03:00
tests/common/compose/test-repo.repo: tests/common/compose/test-repo.repo.in \
tests/common/compose/yum/repo/repodata/repomd.xml
2016-06-06 19:08:29 +03:00
cat $< | sed -e "s|%WHERE%|$(abs_top_srcdir)|" > $@
2016-02-24 01:50:07 +03:00
2016-06-06 19:46:48 +03:00
CLEANFILES += \
tests/common/compose/test-repo-local.repo \
2016-03-10 22:36:44 +03:00
$(NULL)
2016-07-15 06:12:37 +03:00
tests_check_jsonutil_CPPFLAGS = $(AM_CPPFLAGS) -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx
tests_check_jsonutil_CFLAGS = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
2016-06-06 19:46:48 +03:00
tests_check_jsonutil_LDADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la
2014-07-16 17:02:45 +04:00
2017-03-03 23:42:00 +03:00
tests_check_cache_branch_to_nevra_CPPFLAGS = $(AM_CPPFLAGS) -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx
tests_check_cache_branch_to_nevra_CFLAGS = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
tests_check_cache_branch_to_nevra_LDADD = $(PKGDEP_RPMOSTREE_LIBS) librpmostreepriv.la
2016-06-06 19:46:48 +03:00
tests/check/test-compose.sh: tests/common/compose/test-repo.repo
2015-03-23 14:23:29 +03:00
2016-06-06 19:46:48 +03:00
tests/check/test-ucontainer.sh: tests/common/compose/test-repo.repo
2015-09-01 21:46:32 +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-03 23:42:00 +03:00
tests/check/cache_branch_to_nevra \
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-compose.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
2015-03-28 15:47:25 +03:00
check-local:
@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
2016-11-22 06:22:51 +03:00
.PHONY: vmsync vmoverlay vmshell vmcheck testenv
2016-06-24 23:42:27 +03:00
2016-11-14 20:07:43 +03:00
vmsync:
@env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/sync.sh
2016-06-15 00:12:17 +03:00
2017-03-11 01:52:26 +03:00
HOSTS := "vmcheck"
2016-06-28 23:22:49 +03:00
vmoverlay:
2017-01-06 17:52:57 +03:00
@if [ -z "$(SKIP_VMOVERLAY)" ]; then \
2017-03-11 01:52:26 +03:00
rm -rf $(abs_top_srcdir)/insttree; \
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-11-14 20:07:43 +03:00
vmshell: vmsync
2016-07-15 20:34:47 +03:00
ssh -F ssh-config vmcheck
2016-06-15 00:12:17 +03:00
2016-06-21 19:37:02 +03:00
# set up test environment to somewhat resemble uninstalled tests
2016-11-14 20:07:43 +03:00
vmcheck: vmoverlay tests/common/compose/yum/repo/repodata/repomd.xml
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 ====="