bb86912de9
This adds a shell primitive to make it easy to execute a playbook task list. The big picture idea is to sync with https://github.com/ostreedev/ostree/pull/1462 and rewrite some of the libvm shell stuff as playbooks, allowing easier code sharing with a-h-t and just in general being a better library for talking ssh and executing commnads. Closes: #1297 Approved by: jlebon
115 lines
3.7 KiB
Plaintext
115 lines
3.7 KiB
Plaintext
BASE_TESTS_ENVIRONMENT = \
|
|
builddir=$(abs_builddir) \
|
|
topsrcdir=$(abs_top_srcdir) \
|
|
commondir=$(abs_top_srcdir)/tests/common
|
|
|
|
|
|
AM_TESTS_ENVIRONMENT = \
|
|
UNINSTALLEDTESTS=1 \
|
|
$(BASE_TESTS_ENVIRONMENT)
|
|
|
|
# we consume libdnf 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)/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} \
|
|
$(NULL)
|
|
if BUILDOPT_ASAN
|
|
AM_TESTS_ENVIRONMENT += BUILDOPT_ASAN=yes ASAN_OPTIONS=detect_leaks=false
|
|
endif
|
|
|
|
GITIGNOREFILES += ssh-config ansible-inventory.yml vmcheck/ test-compose-logs/
|
|
|
|
testbin_cppflags = $(AM_CPPFLAGS) -I $(srcdir)/src/lib -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx -I $(srcdir)/tests/common
|
|
testbin_cflags = $(AM_CFLAGS) $(PKGDEP_RPMOSTREE_CFLAGS)
|
|
testbin_ldadd = $(PKGDEP_RPMOSTREE_LIBS) librpmostree-1.la librpmostreepriv.la
|
|
|
|
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)
|
|
|
|
tests_check_jsonutil_CPPFLAGS = $(testbin_cppflags)
|
|
tests_check_jsonutil_CFLAGS = $(testbin_cflags)
|
|
tests_check_jsonutil_LDADD = $(testbin_ldadd) libtest.la
|
|
|
|
tests_check_postprocess_CPPFLAGS = $(testbin_cppflags)
|
|
tests_check_postprocess_CFLAGS = $(testbin_cflags)
|
|
tests_check_postprocess_LDADD = $(testbin_ldadd) libtest.la
|
|
|
|
tests_check_test_utils_CPPFLAGS = $(testbin_cppflags)
|
|
tests_check_test_utils_CFLAGS = $(testbin_cflags)
|
|
tests_check_test_utils_LDADD = $(testbin_ldadd) libtest.la
|
|
|
|
tests_check_test_kargs_CPPFLAGS = $(testbin_cppflags)
|
|
tests_check_test_kargs_CFLAGS = $(testbin_cflags)
|
|
tests_check_test_kargs_LDADD = $(testbin_ldadd) libtest.la
|
|
|
|
uninstalled_test_programs = \
|
|
tests/check/jsonutil \
|
|
tests/check/postprocess \
|
|
tests/check/test-utils \
|
|
tests/check/test-kargs \
|
|
$(NULL)
|
|
|
|
uninstalled_test_scripts = \
|
|
tests/check/test-basic.sh \
|
|
tests/check/test-ucontainer.sh \
|
|
$(NULL)
|
|
|
|
uninstalled_test_extra_programs = \
|
|
inject-pkglist \
|
|
dbus-run-session \
|
|
$(NULL)
|
|
|
|
dbus_run_session_SOURCES = tests/utils/dbus-run-session.c
|
|
|
|
inject_pkglist_CPPFLAGS = $(testbin_cppflags)
|
|
inject_pkglist_CFLAGS = $(testbin_cflags)
|
|
inject_pkglist_LDADD = $(testbin_ldadd) libtest.la
|
|
inject_pkglist_SOURCES = tests/utils/inject-pkglist.c
|
|
|
|
check-local:
|
|
@echo " *** NOTE ***"
|
|
@echo " *** NOTE ***"
|
|
@echo " \"make check\" only runs a subset of rpm-ostree's tests."
|
|
@echo " Use \"make vmcheck\" to run remaining tests in a VM."
|
|
@echo " *** NOTE ***"
|
|
@echo " *** NOTE ***"
|
|
|
|
.PHONY: vmsync vmoverlay vmcheck testenv
|
|
|
|
HOSTS ?= "vmcheck"
|
|
|
|
vmsync:
|
|
@set -e; if [ -z "$(SKIP_INSTALL)" ]; then \
|
|
env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/install.sh; \
|
|
fi; \
|
|
env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/sync.sh
|
|
|
|
vmoverlay: inject-pkglist
|
|
@set -e; if [ -z "$(SKIP_VMOVERLAY)" ]; then \
|
|
if [ -z "$(SKIP_INSTALL)" ]; then \
|
|
env $(BASE_TESTS_ENVIRONMENT) ./tests/vmcheck/install.sh; \
|
|
fi; \
|
|
echo -n "$(HOSTS)" | xargs -P 0 -n 1 -d ' ' -I {} \
|
|
env $(BASE_TESTS_ENVIRONMENT) VM={} \
|
|
./tests/vmcheck/overlay.sh; \
|
|
fi
|
|
|
|
# set up test environment to somewhat resemble uninstalled tests
|
|
vmcheck: vmoverlay
|
|
@env VMTESTS=1 $(BASE_TESTS_ENVIRONMENT) PYTHONUNBUFFERED=1 \
|
|
tests/vmcheck/multitest.py $(HOSTS)
|
|
|
|
testenv:
|
|
@echo "===== ENTERING TESTENV ====="
|
|
test_tmpdir=$$(mktemp -d test.XXXXXX) && \
|
|
cd $$test_tmpdir && \
|
|
env $(BASE_TESTS_ENVIRONMENT) PATH=$(abs_builddir):$$PATH TESTENV=1 \
|
|
sh ../tests/utils/setup-session.sh bash && \
|
|
cd .. && \
|
|
rm -rf $$test_tmpdir
|
|
@echo "===== LEAVING TESTENV ====="
|