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-07-04 22:42:31 +03:00
# we consume libhif as a submodule, but we may not have installed it yet (and we
# don't want it to fall back to the system libhif if it's also installed)
AM_TESTS_ENVIRONMENT += \
LD_LIBRARY_PATH=$(abs_builddir)/libhif-build/libhif \
$(NULL)
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-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
$(foreach pkg,$(testpackages),$(eval $(call testpkgbuild_template,$(pkg),$(shell basename $(pkg) | cut -d- -f1))))
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
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 \
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-06-24 23:42:27 +03:00
.PHONY: vmbuild vmshell vmcheck testenv
2016-06-15 00:12:17 +03:00
vmbuild:
2016-06-21 19:37:02 +03:00
@if [ -z "$(SKIP_VMBUILD)" ]; then \
2016-07-15 20:34:47 +03:00
env $(BASE_TESTS_ENVIRONMENT) \
tests/utils/vmbuild.sh; \
2016-06-21 19:37:02 +03:00
fi
2016-06-15 00:12:17 +03:00
2016-06-28 23:22:49 +03:00
vmoverlay:
2016-07-15 20:34:47 +03:00
@env $(BASE_TESTS_ENVIRONMENT) \
tests/utils/vmoverlay.sh
2016-06-28 23:22:49 +03:00
2016-06-15 00:12:17 +03:00
vmshell: vmbuild
2016-07-15 20:34:47 +03:00
sleep 2
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-06-24 23:42:27 +03:00
vmcheck: vmbuild tests/common/compose/yum/repo/repodata/repomd.xml
2016-07-15 20:34:47 +03:00
@env VMTESTS=1 $(BASE_TESTS_ENVIRONMENT) \
sh tests/vmcheck/test.sh
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-07-15 20:34:47 +03:00
env $(BASE_TESTS_ENVIRONMENT) 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 ====="