tests: Port to glib-tap.mk, make `make check` run all of the tests
OSTree's code for testing predates the `glib-tap.mk` making its way into GLib. Let's switch to it, as it provides a number of advantages. By far the biggest advantage is that `make check` can start to run most of the tests *in addition* to having them work installed. This commit keeps the installed tests working, but `make check` turns out to be really broken because...our TAP usage has bitrotted to say the least. Fix that all up. Do some hacks so that the tests work uninstalled as well - in particular, `glib-tap.mk` and the bits encoded into `g_test_build_filename()` assume *recursive* Automake (blah). Work around that by creating a symlink when installed to loop back.
This commit is contained in:
parent
6d73a620e1
commit
d25212f04a
|
|
@ -17,68 +17,68 @@
|
||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
include $(top_srcdir)/buildutil/glib-tap.mk
|
||||||
|
|
||||||
if BUILDOPT_INSTALL_TESTS
|
# We should probably consider flipping the default for DEBUG. Also,
|
||||||
|
# include the builddir in $PATH so we find our just-built ostree
|
||||||
|
# binary.
|
||||||
|
TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
|
||||||
|
PATH=$$(cd $(top_builddir) && pwd):$${PATH}
|
||||||
|
|
||||||
insttestdir=$(pkglibexecdir)/installed-tests
|
test_scripts = \
|
||||||
testfiles = test-basic \
|
tests/test-basic.sh \
|
||||||
test-pull-subpath \
|
tests/test-pull-subpath.sh \
|
||||||
test-archivez \
|
tests/test-archivez.sh \
|
||||||
test-remote-add \
|
tests/test-remote-add.sh \
|
||||||
test-remote-gpg-import \
|
tests/test-remote-gpg-import.sh \
|
||||||
test-commit-sign \
|
tests/test-commit-sign.sh \
|
||||||
test-export \
|
tests/test-export.sh \
|
||||||
test-help \
|
tests/test-help.sh \
|
||||||
test-libarchive \
|
tests/test-libarchive.sh \
|
||||||
test-pull-archive-z \
|
tests/test-pull-archive-z.sh \
|
||||||
test-pull-commit-only \
|
tests/test-pull-commit-only.sh \
|
||||||
test-pull-corruption \
|
tests/test-pull-corruption.sh \
|
||||||
test-pull-depth \
|
tests/test-pull-depth.sh \
|
||||||
test-pull-mirror-summary \
|
tests/test-pull-mirror-summary.sh \
|
||||||
test-pull-large-metadata \
|
tests/test-pull-large-metadata.sh \
|
||||||
test-pull-metalink \
|
tests/test-pull-metalink.sh \
|
||||||
test-pull-summary-sigs \
|
tests/test-pull-summary-sigs.sh \
|
||||||
test-pull-resume \
|
tests/test-pull-resume.sh \
|
||||||
test-local-pull-depth \
|
tests/test-local-pull-depth.sh \
|
||||||
test-gpg-signed-commit \
|
tests/test-gpg-signed-commit.sh \
|
||||||
test-admin-upgrade-unconfigured \
|
tests/test-admin-upgrade-unconfigured.sh \
|
||||||
test-admin-deploy-syslinux \
|
tests/test-admin-deploy-syslinux.sh \
|
||||||
test-admin-deploy-2 \
|
tests/test-admin-deploy-2.sh \
|
||||||
test-admin-deploy-karg \
|
tests/test-admin-deploy-karg.sh \
|
||||||
test-admin-deploy-switch \
|
tests/test-admin-deploy-switch.sh \
|
||||||
test-admin-deploy-etcmerge-cornercases \
|
tests/test-admin-deploy-etcmerge-cornercases.sh \
|
||||||
test-admin-deploy-uboot \
|
tests/test-admin-deploy-uboot.sh \
|
||||||
test-admin-instutil-set-kargs \
|
tests/test-admin-instutil-set-kargs.sh \
|
||||||
test-admin-upgrade-not-backwards \
|
tests/test-admin-upgrade-not-backwards.sh \
|
||||||
test-admin-pull-deploy-commit \
|
tests/test-admin-pull-deploy-commit.sh \
|
||||||
test-admin-locking \
|
tests/test-admin-locking.sh \
|
||||||
test-admin-deploy-clean \
|
tests/test-admin-deploy-clean.sh \
|
||||||
test-repo-checkout-subpath \
|
tests/test-repo-checkout-subpath.sh \
|
||||||
test-reset-nonlinear \
|
tests/test-reset-nonlinear.sh \
|
||||||
test-oldstyle-partial \
|
tests/test-oldstyle-partial.sh \
|
||||||
test-setuid \
|
tests/test-setuid.sh \
|
||||||
test-delta \
|
tests/test-delta.sh \
|
||||||
test-xattrs \
|
tests/test-xattrs.sh \
|
||||||
test-auto-summary \
|
tests/test-auto-summary.sh \
|
||||||
test-prune \
|
tests/test-prune.sh \
|
||||||
test-refs \
|
tests/test-refs.sh \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if BUILDOPT_FUSE
|
if BUILDOPT_FUSE
|
||||||
testfiles += test-rofiles-fuse
|
test_scripts += tests/test-rofiles-fuse.sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
insttest_SCRIPTS = $(addprefix tests/,$(testfiles:=.sh))
|
|
||||||
|
|
||||||
# This one uses corrupt-repo-ref.js
|
# This one uses corrupt-repo-ref.js
|
||||||
if BUILDOPT_GJS
|
if BUILDOPT_GJS
|
||||||
testfiles += test-corruption
|
test_scripts += tests/test-corruption.sh
|
||||||
endif
|
endif
|
||||||
|
|
||||||
testmetadir = $(datadir)/installed-tests/$(PACKAGE)
|
installed_test_data = tests/archive-test.sh \
|
||||||
testmeta_DATA = $(testfiles:=.test)
|
|
||||||
|
|
||||||
insttest_DATA = tests/archive-test.sh \
|
|
||||||
tests/pull-test.sh \
|
tests/pull-test.sh \
|
||||||
tests/libtest.sh \
|
tests/libtest.sh \
|
||||||
tests/admin-test.sh \
|
tests/admin-test.sh \
|
||||||
|
|
@ -90,67 +90,46 @@ insttest_DATA = tests/archive-test.sh \
|
||||||
tests/pre-endian-deltas-repo-little.tar.xz \
|
tests/pre-endian-deltas-repo-little.tar.xz \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
insttest_SCRIPTS += \
|
test_extra_scripts = tests/syslinux-entries-crosscheck.py
|
||||||
tests/syslinux-entries-crosscheck.py \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
gpginsttestdir = $(pkglibexecdir)/installed-tests/gpghome
|
gpginsttestdir = $(installed_testdir)/gpghome
|
||||||
gpginsttest_DATA = tests/gpghome/secring.gpg \
|
gpginsttest_DATA = tests/gpghome/secring.gpg \
|
||||||
|
tests/gpghome/pubring.gpg \
|
||||||
tests/gpghome/trustdb.gpg \
|
tests/gpghome/trustdb.gpg \
|
||||||
tests/gpghome/key1.asc \
|
tests/gpghome/key1.asc \
|
||||||
tests/gpghome/key2.asc \
|
tests/gpghome/key2.asc \
|
||||||
tests/gpghome/key3.asc
|
tests/gpghome/key3.asc
|
||||||
gpginsttest_trusteddir = $(pkglibexecdir)/installed-tests/gpghome/trusted
|
gpginsttest_trusteddir = $(installed_testdir)/gpghome/trusted
|
||||||
gpginsttest_trusted_DATA = tests/gpghome/trusted/pubring.gpg
|
gpginsttest_trusted_DATA = tests/gpghome/trusted/pubring.gpg
|
||||||
|
|
||||||
install-gpg-data-hook:
|
gpgvinsttestdir = $(installed_testdir)/gpg-verify-data
|
||||||
ln -sf trusted/pubring.gpg $(DESTDIR)$(gpginsttestdir)/pubring.gpg
|
gpgvinsttest_DATA = $(addprefix tests/gpg-verify-data/, \
|
||||||
INSTALL_DATA_HOOKS += install-gpg-data-hook
|
gpg.conf lgpl2 lgpl2.sig pubring.gpg secring.gpg trustdb.gpg)
|
||||||
|
|
||||||
%.test: tests/%.sh Makefile
|
|
||||||
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
|
|
||||||
echo 'Exec=$(pkglibexecdir)/installed-tests/$(notdir $<)' >> $@.tmp; \
|
|
||||||
echo 'Type=session' >> $@.tmp; \
|
|
||||||
echo 'Output=TAP' >> $@.tmp; \
|
|
||||||
mv $@.tmp $@)
|
|
||||||
|
|
||||||
%.test: tests/%.js Makefile
|
|
||||||
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
|
|
||||||
echo 'Exec=env TESTDATADIR=$(pkglibexecdir)/installed-tests $(pkglibexecdir)/installed-tests/$(notdir $<)' >> $@.tmp; \
|
|
||||||
echo 'Type=session' >> $@.tmp; \
|
|
||||||
mv $@.tmp $@)
|
|
||||||
|
|
||||||
if BUILDOPT_GJS
|
if BUILDOPT_GJS
|
||||||
insttest_SCRIPTS += tests/test-core.js \
|
installed_test_scripts = tests/test-core.js \
|
||||||
tests/test-sizes.js \
|
tests/test-sizes.js \
|
||||||
tests/test-sysroot.js \
|
tests/test-sysroot.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
testmeta_DATA += test-core.test test-sizes.test test-sysroot.test
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
insttest_LTLIBRARIES = libreaddir-rand.la
|
test_ltlibraries = libreaddir-rand.la
|
||||||
libreaddir_rand_la_SOURCES = tests/readdir-rand.c
|
libreaddir_rand_la_SOURCES = tests/readdir-rand.c
|
||||||
libreaddir_rand_la_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS)
|
libreaddir_rand_la_CFLAGS = $(OT_INTERNAL_GIO_UNIX_CFLAGS)
|
||||||
libreaddir_rand_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS)
|
libreaddir_rand_la_LIBADD = $(OT_INTERNAL_GIO_UNIX_LIBS)
|
||||||
libreaddir_rand_la_LDFLAGS = -avoid-version
|
libreaddir_rand_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
endif
|
test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
|
||||||
|
|
||||||
# "make check" do not depend from --enable-installed-tests
|
|
||||||
noinst_PROGRAMS += tests/test-rollsum-cli
|
|
||||||
|
|
||||||
TESTS = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
|
|
||||||
tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \
|
tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \
|
||||||
tests/test-gpg-verify-result tests/test-checksum tests/test-lzma tests/test-rollsum
|
tests/test-gpg-verify-result tests/test-checksum tests/test-lzma tests/test-rollsum
|
||||||
|
|
||||||
|
# An interactive tool
|
||||||
|
noinst_PROGRAMS += tests/test-rollsum-cli
|
||||||
|
|
||||||
if USE_LIBARCHIVE
|
if USE_LIBARCHIVE
|
||||||
TESTS += tests/test-libarchive-import
|
test_programs += tests/test-libarchive-import
|
||||||
endif
|
endif
|
||||||
|
|
||||||
check_PROGRAMS = $(TESTS)
|
|
||||||
TESTS_ENVIRONMENT = \
|
|
||||||
G_TEST_SRCDIR=$(abs_srcdir)/tests \
|
|
||||||
G_TEST_BUILDDIR=$(abs_builddir)/tests
|
|
||||||
TESTS_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
|
TESTS_CFLAGS = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
|
||||||
TESTS_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
|
TESTS_LDADD = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
|
||||||
|
|
||||||
|
|
@ -211,3 +190,13 @@ EXTRA_DIST += \
|
||||||
tests/gpg-verify-data/secring.gpg \
|
tests/gpg-verify-data/secring.gpg \
|
||||||
tests/gpg-verify-data/trustdb.gpg \
|
tests/gpg-verify-data/trustdb.gpg \
|
||||||
tests/gpg-verify-data/gpg.conf
|
tests/gpg-verify-data/gpg.conf
|
||||||
|
|
||||||
|
# Unfortunately the glib test data APIs don't actually handle
|
||||||
|
# non-recursive Automake, so we change our code to canonically look
|
||||||
|
# for tests/ which is just a symlink when installed.
|
||||||
|
install-test-data-file-path-hack:
|
||||||
|
if test -L $(DESTDIR)$(installed_testdir)/tests; then \
|
||||||
|
rm $(DESTDIR)$(installed_testdir)/tests; \
|
||||||
|
fi
|
||||||
|
ln -s . $(DESTDIR)$(installed_testdir)/tests
|
||||||
|
INSTALL_DATA_HOOKS += install-test-data-file-path-hack
|
||||||
|
|
|
||||||
11
Makefile.am
11
Makefile.am
|
|
@ -19,7 +19,7 @@ include Makefile-decls.am
|
||||||
|
|
||||||
shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||')
|
shortened_sysconfdir = $$(echo "$(sysconfdir)" | sed -e 's|^$(prefix)||' -e 's|^/||')
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
ACLOCAL_AMFLAGS = -I buildutil ${ACLOCAL_FLAGS}
|
||||||
AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
|
AM_CPPFLAGS += -DDATADIR='"$(datadir)"' -DLIBEXECDIR='"$(libexecdir)"' \
|
||||||
-DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \
|
-DLOCALEDIR=\"$(datadir)/locale\" -DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||||
-DSHORTENED_SYSCONFDIR=\"$(shortened_sysconfdir)\" \
|
-DSHORTENED_SYSCONFDIR=\"$(shortened_sysconfdir)\" \
|
||||||
|
|
@ -100,12 +100,3 @@ release-tarball-embedded:
|
||||||
$(embed_dependency) embedded-dependencies/libsoup; \
|
$(embed_dependency) embedded-dependencies/libsoup; \
|
||||||
mv ostree-embeddeps-$${GITVERSION}.tar{.tmp,}; \
|
mv ostree-embeddeps-$${GITVERSION}.tar{.tmp,}; \
|
||||||
gzip -f ostree-embeddeps-$${GITVERSION}.tar
|
gzip -f ostree-embeddeps-$${GITVERSION}.tar
|
||||||
|
|
||||||
check-local:
|
|
||||||
@echo " *** NOTE ***"
|
|
||||||
@echo " *** NOTE ***"
|
|
||||||
@echo " \"make check\" only runs a subset of OSTree's tests."
|
|
||||||
@echo " The other tests use: use https://live.gnome.org/GnomeGoals/InstalledTests"
|
|
||||||
@echo " To run them, ostree must be configured with --enable-installed-tests and installed"
|
|
||||||
@echo " *** NOTE ***"
|
|
||||||
@echo " *** NOTE ***"
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,125 @@
|
||||||
|
# GLIB - Library of useful C routines
|
||||||
|
|
||||||
|
TESTS_ENVIRONMENT= \
|
||||||
|
G_TEST_SRCDIR="$(abs_srcdir)" \
|
||||||
|
G_TEST_BUILDDIR="$(abs_builddir)" \
|
||||||
|
UNINSTALLEDTESTS=1 \
|
||||||
|
G_DEBUG=gc-friendly \
|
||||||
|
MALLOC_CHECK_=2 \
|
||||||
|
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
|
||||||
|
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/buildutil/tap-driver.sh
|
||||||
|
LOG_COMPILER = $(top_srcdir)/buildutil/tap-test
|
||||||
|
|
||||||
|
TESTS =
|
||||||
|
|
||||||
|
installed_test_LTLIBRARIES =
|
||||||
|
installed_test_PROGRAMS =
|
||||||
|
installed_test_SCRIPTS =
|
||||||
|
installed_test_DATA =
|
||||||
|
nobase_installed_test_DATA =
|
||||||
|
|
||||||
|
noinst_SCRIPTS =
|
||||||
|
noinst_DATA =
|
||||||
|
|
||||||
|
check_LTLIBRARIES =
|
||||||
|
check_PROGRAMS =
|
||||||
|
check_SCRIPTS =
|
||||||
|
check_DATA =
|
||||||
|
|
||||||
|
# We support a fairly large range of possible variables. It is expected that all types of files in a test suite
|
||||||
|
# will belong in exactly one of the following variables.
|
||||||
|
#
|
||||||
|
# First, we support the usual automake suffixes, but in lowercase, with the customary meaning:
|
||||||
|
#
|
||||||
|
# test_programs, test_scripts, test_data, test_ltlibraries
|
||||||
|
#
|
||||||
|
# The above are used to list files that are involved in both uninstalled and installed testing. The
|
||||||
|
# test_programs and test_scripts are taken to be actual testcases and will be run as part of the test suite.
|
||||||
|
# Note that _data is always used with the nobase_ automake variable name to ensure that installed test data is
|
||||||
|
# installed in the same way as it appears in the package layout.
|
||||||
|
#
|
||||||
|
# In order to mark a particular file as being only for one type of testing, use 'installed' or 'uninstalled',
|
||||||
|
# like so:
|
||||||
|
#
|
||||||
|
# installed_test_programs, uninstalled_test_programs
|
||||||
|
# installed_test_scripts, uninstalled_test_scripts
|
||||||
|
# installed_test_data, uninstalled_test_data
|
||||||
|
# installed_test_ltlibraries, uninstalled_test_ltlibraries
|
||||||
|
#
|
||||||
|
# Additionally, we support 'extra' infixes for programs and scripts. This is used for support programs/scripts
|
||||||
|
# that should not themselves be run as testcases (but exist to be used from other testcases):
|
||||||
|
#
|
||||||
|
# test_extra_programs, installed_test_extra_programs, uninstalled_test_extra_programs
|
||||||
|
# test_extra_scripts, installed_test_extra_scripts, uninstalled_test_extra_scripts
|
||||||
|
#
|
||||||
|
# Additionally, for _scripts and _data, we support the customary dist_ prefix so that the named script or data
|
||||||
|
# file automatically end up in the tarball.
|
||||||
|
#
|
||||||
|
# dist_test_scripts, dist_test_data, dist_test_extra_scripts
|
||||||
|
# dist_installed_test_scripts, dist_installed_test_data, dist_installed_test_extra_scripts
|
||||||
|
# dist_uninstalled_test_scripts, dist_uninstalled_test_data, dist_uninstalled_test_extra_scripts
|
||||||
|
#
|
||||||
|
# Note that no file is automatically disted unless it appears in one of the dist_ variables. This follows the
|
||||||
|
# standard automake convention of not disting programs scripts or data by default.
|
||||||
|
#
|
||||||
|
# test_programs, test_scripts, uninstalled_test_programs and uninstalled_test_scripts (as well as their disted
|
||||||
|
# variants) will be run as part of the in-tree 'make check'. These are all assumed to be runnable under
|
||||||
|
# gtester. That's a bit strange for scripts, but it's possible.
|
||||||
|
|
||||||
|
TESTS += $(test_programs) $(test_scripts) $(uninstalled_test_programs) $(uninstalled_test_scripts) \
|
||||||
|
$(dist_test_scripts) $(dist_uninstalled_test_scripts)
|
||||||
|
|
||||||
|
# Note: build even the installed-only targets during 'make check' to ensure that they still work.
|
||||||
|
# We need to do a bit of trickery here and manage disting via EXTRA_DIST instead of using dist_ prefixes to
|
||||||
|
# prevent automake from mistreating gmake functions like $(wildcard ...) and $(addprefix ...) as if they were
|
||||||
|
# filenames, including removing duplicate instances of the opening part before the space, eg. '$(addprefix'.
|
||||||
|
all_test_programs = $(test_programs) $(uninstalled_test_programs) $(installed_test_programs) \
|
||||||
|
$(test_extra_programs) $(uninstalled_test_extra_programs) $(installed_test_extra_programs)
|
||||||
|
all_test_scripts = $(test_scripts) $(uninstalled_test_scripts) $(installed_test_scripts) \
|
||||||
|
$(test_extra_scripts) $(uninstalled_test_extra_scripts) $(installed_test_extra_scripts)
|
||||||
|
all_dist_test_scripts = $(dist_test_scripts) $(dist_uninstalled_test_scripts) $(dist_installed_test_scripts) \
|
||||||
|
$(dist_test_extra_scripts) $(dist_uninstalled_test_extra_scripts) $(dist_installed_test_extra_scripts)
|
||||||
|
all_test_scripts += $(all_dist_test_scripts)
|
||||||
|
EXTRA_DIST += $(all_dist_test_scripts)
|
||||||
|
all_test_data = $(test_data) $(uninstalled_test_data) $(installed_test_data)
|
||||||
|
all_dist_test_data = $(dist_test_data) $(dist_uninstalled_test_data) $(dist_installed_test_data)
|
||||||
|
all_test_data += $(all_dist_test_data)
|
||||||
|
EXTRA_DIST += $(all_dist_test_data)
|
||||||
|
all_test_ltlibs = $(test_ltlibraries) $(uninstalled_test_ltlibraries) $(installed_test_ltlibraries)
|
||||||
|
|
||||||
|
if ENABLE_ALWAYS_BUILD_TESTS
|
||||||
|
noinst_LTLIBRARIES += $(all_test_ltlibs)
|
||||||
|
noinst_PROGRAMS += $(all_test_programs)
|
||||||
|
noinst_SCRIPTS += $(all_test_scripts)
|
||||||
|
noinst_DATA += $(all_test_data)
|
||||||
|
else
|
||||||
|
check_LTLIBRARIES += $(all_test_ltlibs)
|
||||||
|
check_PROGRAMS += $(all_test_programs)
|
||||||
|
check_SCRIPTS += $(all_test_scripts)
|
||||||
|
check_DATA += $(all_test_data)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if ENABLE_INSTALLED_TESTS
|
||||||
|
installed_test_PROGRAMS += $(test_programs) $(installed_test_programs) \
|
||||||
|
$(test_extra_programs) $(installed_test_extra_programs)
|
||||||
|
installed_test_SCRIPTS += $(test_scripts) $(installed_test_scripts) \
|
||||||
|
$(test_extra_scripts) $(test_installed_extra_scripts)
|
||||||
|
installed_test_SCRIPTS += $(dist_test_scripts) $(dist_test_extra_scripts) \
|
||||||
|
$(dist_installed_test_scripts) $(dist_installed_test_extra_scripts)
|
||||||
|
installed_test_DATA += $(test_data) $(installed_test_data)
|
||||||
|
installed_test_DATA += $(dist_test_data) $(dist_installed_test_data)
|
||||||
|
installed_test_LTLIBRARIES += $(test_ltlibraries) $(installed_test_ltlibraries)
|
||||||
|
installed_testcases = $(test_programs) $(installed_test_programs) \
|
||||||
|
$(test_scripts) $(installed_test_scripts) \
|
||||||
|
$(dist_test_scripts) $(dist_installed_test_scripts)
|
||||||
|
|
||||||
|
installed_test_meta_DATA = $(installed_testcases:=.test)
|
||||||
|
|
||||||
|
%.test: %$(EXEEXT) Makefile
|
||||||
|
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
|
||||||
|
echo 'Type=session' >> $@.tmp; \
|
||||||
|
echo 'Exec=env G_TEST_SRCDIR=$(installed_testdir) G_TEST_BUILDDIR=$(installed_testdir) $(installed_testdir)/$(notdir $<)' >> $@.tmp; \
|
||||||
|
mv $@.tmp $@)
|
||||||
|
|
||||||
|
CLEANFILES += $(installed_test_meta_DATA)
|
||||||
|
endif
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
dnl GLIB_TESTS
|
||||||
|
dnl
|
||||||
|
|
||||||
|
AC_DEFUN([GLIB_TESTS],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE(installed-tests,
|
||||||
|
AS_HELP_STRING([--enable-installed-tests],
|
||||||
|
[Enable installation of some test cases]),
|
||||||
|
[case ${enableval} in
|
||||||
|
yes) ENABLE_INSTALLED_TESTS="1" ;;
|
||||||
|
no) ENABLE_INSTALLED_TESTS="" ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
|
||||||
|
esac])
|
||||||
|
AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1")
|
||||||
|
AC_ARG_ENABLE(always-build-tests,
|
||||||
|
AS_HELP_STRING([--enable-always-build-tests],
|
||||||
|
[Enable always building tests during 'make all']),
|
||||||
|
[case ${enableval} in
|
||||||
|
yes) ENABLE_ALWAYS_BUILD_TESTS="1" ;;
|
||||||
|
no) ENABLE_ALWAYS_BUILD_TESTS="" ;;
|
||||||
|
*) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;;
|
||||||
|
esac])
|
||||||
|
AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1")
|
||||||
|
if test "$ENABLE_INSTALLED_TESTS" == "1"; then
|
||||||
|
AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME)
|
||||||
|
AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
@ -0,0 +1,652 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
scriptversion=2011-12-27.17; # UTC
|
||||||
|
|
||||||
|
# Make unconditional expansion of undefined variables an error. This
|
||||||
|
# helps a lot in preventing typo-related bugs.
|
||||||
|
set -u
|
||||||
|
|
||||||
|
me=tap-driver.sh
|
||||||
|
|
||||||
|
fatal ()
|
||||||
|
{
|
||||||
|
echo "$me: fatal: $*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
usage_error ()
|
||||||
|
{
|
||||||
|
echo "$me: $*" >&2
|
||||||
|
print_usage >&2
|
||||||
|
exit 2
|
||||||
|
}
|
||||||
|
|
||||||
|
print_usage ()
|
||||||
|
{
|
||||||
|
cat <<END
|
||||||
|
Usage:
|
||||||
|
tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||||
|
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||||
|
[--enable-hard-errors={yes|no}] [--ignore-exit]
|
||||||
|
[--diagnostic-string=STRING] [--merge|--no-merge]
|
||||||
|
[--comments|--no-comments] [--] TEST-COMMAND
|
||||||
|
The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
|
||||||
|
END
|
||||||
|
}
|
||||||
|
|
||||||
|
# TODO: better error handling in option parsing (in particular, ensure
|
||||||
|
# TODO: $log_file, $trs_file and $test_name are defined).
|
||||||
|
test_name= # Used for reporting.
|
||||||
|
log_file= # Where to save the result and output of the test script.
|
||||||
|
trs_file= # Where to save the metadata of the test run.
|
||||||
|
expect_failure=0
|
||||||
|
color_tests=0
|
||||||
|
merge=0
|
||||||
|
ignore_exit=0
|
||||||
|
comments=0
|
||||||
|
diag_string='#'
|
||||||
|
while test $# -gt 0; do
|
||||||
|
case $1 in
|
||||||
|
--help) print_usage; exit $?;;
|
||||||
|
--version) echo "$me $scriptversion"; exit $?;;
|
||||||
|
--test-name) test_name=$2; shift;;
|
||||||
|
--log-file) log_file=$2; shift;;
|
||||||
|
--trs-file) trs_file=$2; shift;;
|
||||||
|
--color-tests) color_tests=$2; shift;;
|
||||||
|
--expect-failure) expect_failure=$2; shift;;
|
||||||
|
--enable-hard-errors) shift;; # No-op.
|
||||||
|
--merge) merge=1;;
|
||||||
|
--no-merge) merge=0;;
|
||||||
|
--ignore-exit) ignore_exit=1;;
|
||||||
|
--comments) comments=1;;
|
||||||
|
--no-comments) comments=0;;
|
||||||
|
--diagnostic-string) diag_string=$2; shift;;
|
||||||
|
--) shift; break;;
|
||||||
|
-*) usage_error "invalid option: '$1'";;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
test $# -gt 0 || usage_error "missing test command"
|
||||||
|
|
||||||
|
case $expect_failure in
|
||||||
|
yes) expect_failure=1;;
|
||||||
|
*) expect_failure=0;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test $color_tests = yes; then
|
||||||
|
init_colors='
|
||||||
|
color_map["red"]="[0;31m" # Red.
|
||||||
|
color_map["grn"]="[0;32m" # Green.
|
||||||
|
color_map["lgn"]="[1;32m" # Light green.
|
||||||
|
color_map["blu"]="[1;34m" # Blue.
|
||||||
|
color_map["mgn"]="[0;35m" # Magenta.
|
||||||
|
color_map["std"]="[m" # No color.
|
||||||
|
color_for_result["ERROR"] = "mgn"
|
||||||
|
color_for_result["PASS"] = "grn"
|
||||||
|
color_for_result["XPASS"] = "red"
|
||||||
|
color_for_result["FAIL"] = "red"
|
||||||
|
color_for_result["XFAIL"] = "lgn"
|
||||||
|
color_for_result["SKIP"] = "blu"'
|
||||||
|
else
|
||||||
|
init_colors=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
# :; is there to work around a bug in bash 3.2 (and earlier) which
|
||||||
|
# does not always set '$?' properly on redirection failure.
|
||||||
|
# See the Autoconf manual for more details.
|
||||||
|
:;{
|
||||||
|
(
|
||||||
|
# Ignore common signals (in this subshell only!), to avoid potential
|
||||||
|
# problems with Korn shells. Some Korn shells are known to propagate
|
||||||
|
# to themselves signals that have killed a child process they were
|
||||||
|
# waiting for; this is done at least for SIGINT (and usually only for
|
||||||
|
# it, in truth). Without the `trap' below, such a behaviour could
|
||||||
|
# cause a premature exit in the current subshell, e.g., in case the
|
||||||
|
# test command it runs gets terminated by a SIGINT. Thus, the awk
|
||||||
|
# script we are piping into would never seen the exit status it
|
||||||
|
# expects on its last input line (which is displayed below by the
|
||||||
|
# last `echo $?' statement), and would thus die reporting an internal
|
||||||
|
# error.
|
||||||
|
# For more information, see the Autoconf manual and the threads:
|
||||||
|
# <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
|
||||||
|
# <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
|
||||||
|
trap : 1 3 2 13 15
|
||||||
|
if test $merge -gt 0; then
|
||||||
|
exec 2>&1
|
||||||
|
else
|
||||||
|
exec 2>&3
|
||||||
|
fi
|
||||||
|
"$@"
|
||||||
|
echo $?
|
||||||
|
) | LC_ALL=C ${AM_TAP_AWK-awk} \
|
||||||
|
-v me="$me" \
|
||||||
|
-v test_script_name="$test_name" \
|
||||||
|
-v log_file="$log_file" \
|
||||||
|
-v trs_file="$trs_file" \
|
||||||
|
-v expect_failure="$expect_failure" \
|
||||||
|
-v merge="$merge" \
|
||||||
|
-v ignore_exit="$ignore_exit" \
|
||||||
|
-v comments="$comments" \
|
||||||
|
-v diag_string="$diag_string" \
|
||||||
|
'
|
||||||
|
# FIXME: the usages of "cat >&3" below could be optimized when using
|
||||||
|
# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
|
||||||
|
|
||||||
|
# Implementation note: in what follows, `result_obj` will be an
|
||||||
|
# associative array that (partly) simulates a TAP result object
|
||||||
|
# from the `TAP::Parser` perl module.
|
||||||
|
|
||||||
|
## ----------- ##
|
||||||
|
## FUNCTIONS ##
|
||||||
|
## ----------- ##
|
||||||
|
|
||||||
|
function fatal(msg)
|
||||||
|
{
|
||||||
|
print me ": " msg | "cat >&2"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function abort(where)
|
||||||
|
{
|
||||||
|
fatal("internal error " where)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Convert a boolean to a "yes"/"no" string.
|
||||||
|
function yn(bool)
|
||||||
|
{
|
||||||
|
return bool ? "yes" : "no";
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_test_result(result)
|
||||||
|
{
|
||||||
|
if (!test_results_index)
|
||||||
|
test_results_index = 0
|
||||||
|
test_results_list[test_results_index] = result
|
||||||
|
test_results_index += 1
|
||||||
|
test_results_seen[result] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Whether the test script should be re-run by "make recheck".
|
||||||
|
function must_recheck()
|
||||||
|
{
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "XFAIL" && k != "PASS" && k != "SKIP")
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Whether the content of the log file associated to this test should
|
||||||
|
# be copied into the "global" test-suite.log.
|
||||||
|
function copy_in_global_log()
|
||||||
|
{
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "PASS")
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: this can certainly be improved ...
|
||||||
|
function get_global_test_result()
|
||||||
|
{
|
||||||
|
if ("ERROR" in test_results_seen)
|
||||||
|
return "ERROR"
|
||||||
|
if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
|
||||||
|
return "FAIL"
|
||||||
|
all_skipped = 1
|
||||||
|
for (k in test_results_seen)
|
||||||
|
if (k != "SKIP")
|
||||||
|
all_skipped = 0
|
||||||
|
if (all_skipped)
|
||||||
|
return "SKIP"
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
|
||||||
|
function stringify_result_obj(result_obj)
|
||||||
|
{
|
||||||
|
if (result_obj["is_unplanned"] || result_obj["number"] != testno)
|
||||||
|
return "ERROR"
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
return "ERROR"
|
||||||
|
|
||||||
|
if (result_obj["directive"] == "TODO")
|
||||||
|
return result_obj["is_ok"] ? "XPASS" : "XFAIL"
|
||||||
|
|
||||||
|
if (result_obj["directive"] == "SKIP")
|
||||||
|
return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
|
||||||
|
|
||||||
|
if (length(result_obj["directive"]))
|
||||||
|
abort("in function stringify_result_obj()")
|
||||||
|
|
||||||
|
return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
|
||||||
|
}
|
||||||
|
|
||||||
|
function decorate_result(result)
|
||||||
|
{
|
||||||
|
color_name = color_for_result[result]
|
||||||
|
if (color_name)
|
||||||
|
return color_map[color_name] "" result "" color_map["std"]
|
||||||
|
# If we are not using colorized output, or if we do not know how
|
||||||
|
# to colorize the given result, we should return it unchanged.
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function report(result, details)
|
||||||
|
{
|
||||||
|
if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
|
||||||
|
{
|
||||||
|
msg = ": " test_script_name
|
||||||
|
add_test_result(result)
|
||||||
|
}
|
||||||
|
else if (result == "#")
|
||||||
|
{
|
||||||
|
msg = " " test_script_name ":"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
abort("in function report()")
|
||||||
|
}
|
||||||
|
if (length(details))
|
||||||
|
msg = msg " " details
|
||||||
|
# Output on console might be colorized.
|
||||||
|
print decorate_result(result) msg
|
||||||
|
# Log the result in the log file too, to help debugging (this is
|
||||||
|
# especially true when said result is a TAP error or "Bail out!").
|
||||||
|
print result msg | "cat >&3";
|
||||||
|
}
|
||||||
|
|
||||||
|
function testsuite_error(error_message)
|
||||||
|
{
|
||||||
|
report("ERROR", "- " error_message)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle_tap_result()
|
||||||
|
{
|
||||||
|
details = result_obj["number"];
|
||||||
|
if (length(result_obj["description"]))
|
||||||
|
details = details " " result_obj["description"]
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
{
|
||||||
|
details = details " # AFTER LATE PLAN";
|
||||||
|
}
|
||||||
|
else if (result_obj["is_unplanned"])
|
||||||
|
{
|
||||||
|
details = details " # UNPLANNED";
|
||||||
|
}
|
||||||
|
else if (result_obj["number"] != testno)
|
||||||
|
{
|
||||||
|
details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
|
||||||
|
details, testno);
|
||||||
|
}
|
||||||
|
else if (result_obj["directive"])
|
||||||
|
{
|
||||||
|
details = details " # " result_obj["directive"];
|
||||||
|
if (length(result_obj["explanation"]))
|
||||||
|
details = details " " result_obj["explanation"]
|
||||||
|
}
|
||||||
|
|
||||||
|
report(stringify_result_obj(result_obj), details)
|
||||||
|
}
|
||||||
|
|
||||||
|
# `skip_reason` should be empty whenever planned > 0.
|
||||||
|
function handle_tap_plan(planned, skip_reason)
|
||||||
|
{
|
||||||
|
planned += 0 # Avoid getting confused if, say, `planned` is "00"
|
||||||
|
if (length(skip_reason) && planned > 0)
|
||||||
|
abort("in function handle_tap_plan()")
|
||||||
|
if (plan_seen)
|
||||||
|
{
|
||||||
|
# Error, only one plan per stream is acceptable.
|
||||||
|
testsuite_error("multiple test plans")
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
planned_tests = planned
|
||||||
|
# The TAP plan can come before or after *all* the TAP results; we speak
|
||||||
|
# respectively of an "early" or a "late" plan. If we see the plan line
|
||||||
|
# after at least one TAP result has been seen, assume we have a late
|
||||||
|
# plan; in this case, any further test result seen after the plan will
|
||||||
|
# be flagged as an error.
|
||||||
|
plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
|
||||||
|
# If testno > 0, we have an error ("too many tests run") that will be
|
||||||
|
# automatically dealt with later, so do not worry about it here. If
|
||||||
|
# $plan_seen is true, we have an error due to a repeated plan, and that
|
||||||
|
# has already been dealt with above. Otherwise, we have a valid "plan
|
||||||
|
# with SKIP" specification, and should report it as a particular kind
|
||||||
|
# of SKIP result.
|
||||||
|
if (planned == 0 && testno == 0)
|
||||||
|
{
|
||||||
|
if (length(skip_reason))
|
||||||
|
skip_reason = "- " skip_reason;
|
||||||
|
report("SKIP", skip_reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function extract_tap_comment(line)
|
||||||
|
{
|
||||||
|
if (index(line, diag_string) == 1)
|
||||||
|
{
|
||||||
|
# Strip leading `diag_string` from `line`.
|
||||||
|
line = substr(line, length(diag_string) + 1)
|
||||||
|
# And strip any leading and trailing whitespace left.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
# Return what is left (if any).
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
# When this function is called, we know that line is a TAP result line,
|
||||||
|
# so that it matches the (perl) RE "^(not )?ok\b".
|
||||||
|
function setup_result_obj(line)
|
||||||
|
{
|
||||||
|
# Get the result, and remove it from the line.
|
||||||
|
result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
|
||||||
|
sub("^(not )?ok[ \t]*", "", line)
|
||||||
|
|
||||||
|
# If the result has an explicit number, get it and strip it; otherwise,
|
||||||
|
# automatically assing the next progresive number to it.
|
||||||
|
if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
|
||||||
|
{
|
||||||
|
match(line, "^[0-9]+")
|
||||||
|
# The final `+ 0` is to normalize numbers with leading zeros.
|
||||||
|
result_obj["number"] = substr(line, 1, RLENGTH) + 0
|
||||||
|
line = substr(line, RLENGTH + 1)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result_obj["number"] = testno
|
||||||
|
}
|
||||||
|
|
||||||
|
if (plan_seen == LATE_PLAN)
|
||||||
|
# No further test results are acceptable after a "late" TAP plan
|
||||||
|
# has been seen.
|
||||||
|
result_obj["is_unplanned"] = 1
|
||||||
|
else if (plan_seen && testno > planned_tests)
|
||||||
|
result_obj["is_unplanned"] = 1
|
||||||
|
else
|
||||||
|
result_obj["is_unplanned"] = 0
|
||||||
|
|
||||||
|
# Strip trailing and leading whitespace.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
|
||||||
|
# This will have to be corrected if we have a "TODO"/"SKIP" directive.
|
||||||
|
result_obj["description"] = line
|
||||||
|
result_obj["directive"] = ""
|
||||||
|
result_obj["explanation"] = ""
|
||||||
|
|
||||||
|
if (index(line, "#") == 0)
|
||||||
|
return # No possible directive, nothing more to do.
|
||||||
|
|
||||||
|
# Directives are case-insensitive.
|
||||||
|
rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
|
||||||
|
|
||||||
|
# See whether we have the directive, and if yes, where.
|
||||||
|
pos = match(line, rx "$")
|
||||||
|
if (!pos)
|
||||||
|
pos = match(line, rx "[^a-zA-Z0-9_]")
|
||||||
|
|
||||||
|
# If there was no TAP directive, we have nothing more to do.
|
||||||
|
if (!pos)
|
||||||
|
return
|
||||||
|
|
||||||
|
# Let`s now see if the TAP directive has been escaped. For example:
|
||||||
|
# escaped: ok \# SKIP
|
||||||
|
# not escaped: ok \\# SKIP
|
||||||
|
# escaped: ok \\\\\# SKIP
|
||||||
|
# not escaped: ok \ # SKIP
|
||||||
|
if (substr(line, pos, 1) == "#")
|
||||||
|
{
|
||||||
|
bslash_count = 0
|
||||||
|
for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
|
||||||
|
bslash_count += 1
|
||||||
|
if (bslash_count % 2)
|
||||||
|
return # Directive was escaped.
|
||||||
|
}
|
||||||
|
|
||||||
|
# Strip the directive and its explanation (if any) from the test
|
||||||
|
# description.
|
||||||
|
result_obj["description"] = substr(line, 1, pos - 1)
|
||||||
|
# Now remove the test description from the line, that has been dealt
|
||||||
|
# with already.
|
||||||
|
line = substr(line, pos)
|
||||||
|
# Strip the directive, and save its value (normalized to upper case).
|
||||||
|
sub("^[ \t]*#[ \t]*", "", line)
|
||||||
|
result_obj["directive"] = toupper(substr(line, 1, 4))
|
||||||
|
line = substr(line, 5)
|
||||||
|
# Now get the explanation for the directive (if any), with leading
|
||||||
|
# and trailing whitespace removed.
|
||||||
|
sub("^[ \t]*", "", line)
|
||||||
|
sub("[ \t]*$", "", line)
|
||||||
|
result_obj["explanation"] = line
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_test_exit_message(status)
|
||||||
|
{
|
||||||
|
if (status == 0)
|
||||||
|
return ""
|
||||||
|
if (status !~ /^[1-9][0-9]*$/)
|
||||||
|
abort("getting exit status")
|
||||||
|
if (status < 127)
|
||||||
|
exit_details = ""
|
||||||
|
else if (status == 127)
|
||||||
|
exit_details = " (command not found?)"
|
||||||
|
else if (status >= 128 && status <= 255)
|
||||||
|
exit_details = sprintf(" (terminated by signal %d?)", status - 128)
|
||||||
|
else if (status > 256 && status <= 384)
|
||||||
|
# We used to report an "abnormal termination" here, but some Korn
|
||||||
|
# shells, when a child process die due to signal number n, can leave
|
||||||
|
# in $? an exit status of 256+n instead of the more standard 128+n.
|
||||||
|
# Apparently, both behaviours are allowed by POSIX (2008), so be
|
||||||
|
# prepared to handle them both. See also Austing Group report ID
|
||||||
|
# 0000051 <http://www.austingroupbugs.net/view.php?id=51>
|
||||||
|
exit_details = sprintf(" (terminated by signal %d?)", status - 256)
|
||||||
|
else
|
||||||
|
# Never seen in practice.
|
||||||
|
exit_details = " (abnormal termination)"
|
||||||
|
return sprintf("exited with status %d%s", status, exit_details)
|
||||||
|
}
|
||||||
|
|
||||||
|
function write_test_results()
|
||||||
|
{
|
||||||
|
print ":global-test-result: " get_global_test_result() > trs_file
|
||||||
|
print ":recheck: " yn(must_recheck()) > trs_file
|
||||||
|
print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
|
||||||
|
for (i = 0; i < test_results_index; i += 1)
|
||||||
|
print ":test-result: " test_results_list[i] > trs_file
|
||||||
|
close(trs_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN {
|
||||||
|
|
||||||
|
## ------- ##
|
||||||
|
## SETUP ##
|
||||||
|
## ------- ##
|
||||||
|
|
||||||
|
'"$init_colors"'
|
||||||
|
|
||||||
|
# Properly initialized once the TAP plan is seen.
|
||||||
|
planned_tests = 0
|
||||||
|
|
||||||
|
COOKED_PASS = expect_failure ? "XPASS": "PASS";
|
||||||
|
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
|
||||||
|
|
||||||
|
# Enumeration-like constants to remember which kind of plan (if any)
|
||||||
|
# has been seen. It is important that NO_PLAN evaluates "false" as
|
||||||
|
# a boolean.
|
||||||
|
NO_PLAN = 0
|
||||||
|
EARLY_PLAN = 1
|
||||||
|
LATE_PLAN = 2
|
||||||
|
|
||||||
|
testno = 0 # Number of test results seen so far.
|
||||||
|
bailed_out = 0 # Whether a "Bail out!" directive has been seen.
|
||||||
|
|
||||||
|
# Whether the TAP plan has been seen or not, and if yes, which kind
|
||||||
|
# it is ("early" is seen before any test result, "late" otherwise).
|
||||||
|
plan_seen = NO_PLAN
|
||||||
|
|
||||||
|
## --------- ##
|
||||||
|
## PARSING ##
|
||||||
|
## --------- ##
|
||||||
|
|
||||||
|
is_first_read = 1
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
# Involutions required so that we are able to read the exit status
|
||||||
|
# from the last input line.
|
||||||
|
st = getline
|
||||||
|
if (st < 0) # I/O error.
|
||||||
|
fatal("I/O error while reading from input stream")
|
||||||
|
else if (st == 0) # End-of-input
|
||||||
|
{
|
||||||
|
if (is_first_read)
|
||||||
|
abort("in input loop: only one input line")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (is_first_read)
|
||||||
|
{
|
||||||
|
is_first_read = 0
|
||||||
|
nextline = $0
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
curline = nextline
|
||||||
|
nextline = $0
|
||||||
|
$0 = curline
|
||||||
|
}
|
||||||
|
# Copy any input line verbatim into the log file.
|
||||||
|
print | "cat >&3"
|
||||||
|
# Parsing of TAP input should stop after a "Bail out!" directive.
|
||||||
|
if (bailed_out)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# TAP test result.
|
||||||
|
if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
|
||||||
|
{
|
||||||
|
testno += 1
|
||||||
|
setup_result_obj($0)
|
||||||
|
handle_tap_result()
|
||||||
|
}
|
||||||
|
# TAP plan (normal or "SKIP" without explanation).
|
||||||
|
else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
|
||||||
|
{
|
||||||
|
# The next two lines will put the number of planned tests in $0.
|
||||||
|
sub("^1\\.\\.", "")
|
||||||
|
sub("[^0-9]*$", "")
|
||||||
|
handle_tap_plan($0, "")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
# TAP "SKIP" plan, with an explanation.
|
||||||
|
else if ($0 ~ /^1\.\.0+[ \t]*#/)
|
||||||
|
{
|
||||||
|
# The next lines will put the skip explanation in $0, stripping
|
||||||
|
# any leading and trailing whitespace. This is a little more
|
||||||
|
# tricky in truth, since we want to also strip a potential leading
|
||||||
|
# "SKIP" string from the message.
|
||||||
|
sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
|
||||||
|
sub("[ \t]*$", "");
|
||||||
|
handle_tap_plan(0, $0)
|
||||||
|
}
|
||||||
|
# "Bail out!" magic.
|
||||||
|
# Older versions of prove and TAP::Harness (e.g., 3.17) did not
|
||||||
|
# recognize a "Bail out!" directive when preceded by leading
|
||||||
|
# whitespace, but more modern versions (e.g., 3.23) do. So we
|
||||||
|
# emulate the latter, "more modern" behaviour.
|
||||||
|
else if ($0 ~ /^[ \t]*Bail out!/)
|
||||||
|
{
|
||||||
|
bailed_out = 1
|
||||||
|
# Get the bailout message (if any), with leading and trailing
|
||||||
|
# whitespace stripped. The message remains stored in `$0`.
|
||||||
|
sub("^[ \t]*Bail out![ \t]*", "");
|
||||||
|
sub("[ \t]*$", "");
|
||||||
|
# Format the error message for the
|
||||||
|
bailout_message = "Bail out!"
|
||||||
|
if (length($0))
|
||||||
|
bailout_message = bailout_message " " $0
|
||||||
|
testsuite_error(bailout_message)
|
||||||
|
}
|
||||||
|
# Maybe we have too look for dianogtic comments too.
|
||||||
|
else if (comments != 0)
|
||||||
|
{
|
||||||
|
comment = extract_tap_comment($0);
|
||||||
|
if (length(comment))
|
||||||
|
report("#", comment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## -------- ##
|
||||||
|
## FINISH ##
|
||||||
|
## -------- ##
|
||||||
|
|
||||||
|
# A "Bail out!" directive should cause us to ignore any following TAP
|
||||||
|
# error, as well as a non-zero exit status from the TAP producer.
|
||||||
|
if (!bailed_out)
|
||||||
|
{
|
||||||
|
if (!plan_seen)
|
||||||
|
{
|
||||||
|
testsuite_error("missing test plan")
|
||||||
|
}
|
||||||
|
else if (planned_tests != testno)
|
||||||
|
{
|
||||||
|
bad_amount = testno > planned_tests ? "many" : "few"
|
||||||
|
testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
|
||||||
|
bad_amount, planned_tests, testno))
|
||||||
|
}
|
||||||
|
if (!ignore_exit)
|
||||||
|
{
|
||||||
|
# Fetch exit status from the last line.
|
||||||
|
exit_message = get_test_exit_message(nextline)
|
||||||
|
if (exit_message)
|
||||||
|
testsuite_error(exit_message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
write_test_results()
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
} # End of "BEGIN" block.
|
||||||
|
'
|
||||||
|
|
||||||
|
# TODO: document that we consume the file descriptor 3 :-(
|
||||||
|
} 3>"$log_file"
|
||||||
|
|
||||||
|
test $? -eq 0 || fatal "I/O or internal error"
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
# run a GTest in tap mode. The test binary is passed as $1
|
||||||
|
|
||||||
|
srcd=$(cd $(dirname $1) && pwd)
|
||||||
|
bn=$(basename $1)
|
||||||
|
tempdir=$(mktemp -d)
|
||||||
|
function cleanup () {
|
||||||
|
rm "${tempdir}" -rf
|
||||||
|
}
|
||||||
|
trap cleanup EXIT
|
||||||
|
cd ${tempdir}
|
||||||
|
${srcd}/${bn} -k --tap
|
||||||
2
cfg.mk
2
cfg.mk
|
|
@ -1,4 +1,4 @@
|
||||||
export VC_LIST_EXCEPT_DEFAULT=^(lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog)$$
|
export VC_LIST_EXCEPT_DEFAULT=^(lib/.*|m4/.*|md5/.*|build-aux/.*|src/gettext\.h|.*ChangeLog|buildutil/.*)$$
|
||||||
|
|
||||||
local-checks-to-skip = \
|
local-checks-to-skip = \
|
||||||
sc_const_long_option \
|
sc_const_long_option \
|
||||||
|
|
|
||||||
10
configure.ac
10
configure.ac
|
|
@ -1,11 +1,11 @@
|
||||||
AC_PREREQ([2.63])
|
AC_PREREQ([2.63])
|
||||||
AC_INIT([ostree], [2016.3], [walters@verbum.org])
|
AC_INIT([ostree], [2016.3], [walters@verbum.org])
|
||||||
AC_CONFIG_HEADER([config.h])
|
AC_CONFIG_HEADER([config.h])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([buildutil])
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.13 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz
|
AM_INIT_AUTOMAKE([1.13 -Wno-portability foreign no-define tar-ustar no-dist-gzip dist-xz
|
||||||
color-tests parallel-tests subdir-objects])
|
color-tests subdir-objects])
|
||||||
AM_MAINTAINER_MODE([enable])
|
AM_MAINTAINER_MODE([enable])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
AC_USE_SYSTEM_EXTENSIONS
|
AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
@ -34,11 +34,7 @@ LT_INIT([disable-static])
|
||||||
OSTREE_FEATURES=""
|
OSTREE_FEATURES=""
|
||||||
AC_SUBST([OSTREE_FEATURES])
|
AC_SUBST([OSTREE_FEATURES])
|
||||||
|
|
||||||
AC_ARG_ENABLE(installed_tests,
|
GLIB_TESTS
|
||||||
AS_HELP_STRING([--enable-installed-tests],
|
|
||||||
[Install test programs (default: no)]),,
|
|
||||||
[enable_installed_tests=no])
|
|
||||||
AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
|
|
||||||
|
|
||||||
AC_CHECK_HEADER([sys/xattr.h],,[AC_MSG_ERROR([You must have sys/xattr.h from glibc])])
|
AC_CHECK_HEADER([sys/xattr.h],,[AC_MSG_ERROR([You must have sys/xattr.h from glibc])])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "1..10"
|
echo "1..16"
|
||||||
|
|
||||||
function validate_bootloader() {
|
function validate_bootloader() {
|
||||||
(cd ${test_tmpdir};
|
(cd ${test_tmpdir};
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "1..48"
|
echo "1..49"
|
||||||
|
|
||||||
$OSTREE checkout test2 checkout-test2
|
$OSTREE checkout test2 checkout-test2
|
||||||
echo "ok checkout"
|
echo "ok checkout"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
trusted/pubring.gpg
|
||||||
|
|
@ -18,10 +18,35 @@
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
SRCDIR=$(dirname $0)
|
SRCDIR=$(dirname $0)
|
||||||
|
_cleanup_tmpdir () {
|
||||||
|
if test -n "${LIBTEST_SKIP_CLEANUP:-}"; then
|
||||||
|
echo "Skipping cleanup of ${test_tmpdir}"
|
||||||
|
else if test -f ${test_tmpdir}/.test; then
|
||||||
|
rm ${test_tmpdir} -rf
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# If we're running as a local test (i.e. through `make check`), then
|
||||||
|
# UNINSTALLEDTESTS=1. Otherwise (i.e. as an installed test), it's undefined, in
|
||||||
|
# which case we're already in a tmpdir.
|
||||||
|
if test -n "${UNINSTALLEDTESTS:-}"; then
|
||||||
|
test_tmpdir=$(mktemp -d /var/tmp/test.XXXXXX)
|
||||||
|
touch ${test_tmpdir}/.test
|
||||||
|
trap _cleanup_tmpdir EXIT
|
||||||
|
cd ${test_tmpdir}
|
||||||
|
export PATH=${G_TEST_BUILDDIR}:${PATH}
|
||||||
|
fi
|
||||||
|
|
||||||
test_tmpdir=$(pwd)
|
test_tmpdir=$(pwd)
|
||||||
|
|
||||||
export G_DEBUG=fatal-warnings
|
export G_DEBUG=fatal-warnings
|
||||||
|
|
||||||
|
# Also, unbreak `tar` inside `make check`...Automake will inject
|
||||||
|
# TAR_OPTIONS: --owner=0 --group=0 --numeric-owner presumably so that
|
||||||
|
# tarballs are predictable, except we don't want this in our tests.
|
||||||
|
unset TAR_OPTIONS
|
||||||
|
|
||||||
# Don't flag deployments as immutable so that test harnesses can
|
# Don't flag deployments as immutable so that test harnesses can
|
||||||
# easily clean up.
|
# easily clean up.
|
||||||
export OSTREE_SYSROOT_DEBUG=mutable-deployments
|
export OSTREE_SYSROOT_DEBUG=mutable-deployments
|
||||||
|
|
@ -33,6 +58,7 @@ export TEST_GPG_KEYID_3="DF444D67"
|
||||||
# GPG when creating signatures demands a writable
|
# GPG when creating signatures demands a writable
|
||||||
# homedir in order to create lockfiles. Work around
|
# homedir in order to create lockfiles. Work around
|
||||||
# this by copying locally.
|
# this by copying locally.
|
||||||
|
echo "Copying gpghome to ${test_tmpdir}"
|
||||||
cp -a ${SRCDIR}/gpghome ${test_tmpdir}
|
cp -a ${SRCDIR}/gpghome ${test_tmpdir}
|
||||||
export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome
|
export TEST_GPG_KEYHOME=${test_tmpdir}/gpghome
|
||||||
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted
|
export OSTREE_GPG_HOME=${test_tmpdir}/gpghome/trusted
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ function verify_initial_contents() {
|
||||||
assert_file_has_content baz/cow '^moo$'
|
assert_file_has_content baz/cow '^moo$'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "1..11"
|
||||||
|
|
||||||
# Try both syntaxes
|
# Try both syntaxes
|
||||||
repo_init
|
repo_init
|
||||||
${CMD_PREFIX} ostree --repo=repo pull origin main
|
${CMD_PREFIX} ostree --repo=repo pull origin main
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,10 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
echo "1..3"
|
||||||
|
|
||||||
echo "1..2"
|
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,9 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
echo "1..2"
|
echo "1..2"
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,10 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
echo "1..3"
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||||
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
rev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos/buildmaster/x86_64-runtime)
|
||||||
|
|
|
||||||
|
|
@ -21,14 +21,10 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
echo "1..4"
|
||||||
|
|
||||||
echo "1..3"
|
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo remote add --set=gpg-verify=false testos file://$(pwd)/testos-repo
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull testos testos/buildmaster/x86_64-runtime
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,7 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
. $(dirname $0)/admin-test.sh
|
. $(dirname $0)/admin-test.sh
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,7 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "uboot"
|
setup_os_repository "archive-z2" "uboot"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
. $(dirname $0)/admin-test.sh
|
. $(dirname $0)/admin-test.sh
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,9 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
echo "1..5"
|
echo "1..5"
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,14 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
# If parallel is not installed, skip the test
|
||||||
|
if ! parallel --help >/dev/null 2>&1; then
|
||||||
|
echo "1..0 # SKIP no /usr/bin/parallel"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
echo "1..1"
|
echo "1..1"
|
||||||
|
|
||||||
|
|
@ -40,9 +42,6 @@ echo "rev=${rev}"
|
||||||
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree admin deploy --karg=root=LABEL=MOO --karg=quiet --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||||
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
assert_has_dir sysroot/boot/ostree/testos-${bootcsum}
|
||||||
|
|
||||||
# If parallel is not installed, skip the test
|
|
||||||
parallel --help >/dev/null 2>&1 || exit 77
|
|
||||||
|
|
||||||
parallel_cmd=parallel
|
parallel_cmd=parallel
|
||||||
if parallel --help | grep -q -e --no-notice; then
|
if parallel --help | grep -q -e --no-notice; then
|
||||||
parallel_cmd="${parallel_cmd} --no-notice"
|
parallel_cmd="${parallel_cmd} --no-notice"
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,9 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
echo "1..2"
|
echo "1..2"
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,9 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
echo "1..2"
|
echo "1..2"
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ set -euo pipefail
|
||||||
echo '1..11'
|
echo '1..11'
|
||||||
|
|
||||||
setup_test_repository "archive-z2"
|
setup_test_repository "archive-z2"
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
. ${SRCDIR}/archive-test.sh
|
. ${SRCDIR}/archive-test.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "1..1"
|
echo "1..4"
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,8 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "1..1"
|
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
setup_test_repository "bare"
|
setup_test_repository "bare"
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
. $(dirname $0)/basic-test.sh
|
. $(dirname $0)/basic-test.sh
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,14 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if ! ostree --version | grep -q -e '\+gpgme'; then
|
if ! ostree --version | grep -q -e '\+gpgme'; then
|
||||||
exit 77
|
echo "1..0 #SKIP no gpg support compiled in"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
echo "1..1"
|
||||||
|
|
||||||
keyid="472CDAFA"
|
keyid="472CDAFA"
|
||||||
oldpwd=`pwd`
|
oldpwd=`pwd`
|
||||||
mkdir ostree-srv
|
mkdir ostree-srv
|
||||||
|
|
@ -122,10 +125,12 @@ assert_file_has_content show 'Found 1 signature'
|
||||||
|
|
||||||
# Delete the signature from the commit so the detached metadata is empty,
|
# Delete the signature from the commit so the detached metadata is empty,
|
||||||
# then pull and verify the signature is also deleted on the client side.
|
# then pull and verify the signature is also deleted on the client side.
|
||||||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo gpg-sign --gpg-homedir=${SRCDIR}/gpghome --delete main $keyid
|
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo gpg-sign --gpg-homedir=${test_tmpdir}/gpghome --delete main $keyid
|
||||||
${CMD_PREFIX} ostree --repo=repo pull origin main
|
${CMD_PREFIX} ostree --repo=repo pull origin main
|
||||||
if ${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature'; then
|
if ${CMD_PREFIX} ostree --repo=repo show main | grep -o 'Found [[:digit:]] signature'; then
|
||||||
assert_not_reached
|
assert_not_reached
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf repo gnomerepo-files
|
rm -rf repo gnomerepo-files
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ set -euo pipefail
|
||||||
bindatafiles="bash true ostree"
|
bindatafiles="bash true ostree"
|
||||||
morebindatafiles="false ls"
|
morebindatafiles="false ls"
|
||||||
|
|
||||||
echo '1..3'
|
echo '1..7'
|
||||||
|
|
||||||
mkdir repo
|
mkdir repo
|
||||||
${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2
|
${CMD_PREFIX} ostree --repo=repo init --mode=archive-z2
|
||||||
|
|
|
||||||
|
|
@ -21,11 +21,14 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if ! ostree --version | grep -q -e '\+gpgme'; then
|
if ! ostree --version | grep -q -e '\+gpgme'; then
|
||||||
exit 77
|
echo "1..0 #SKIP no gpgme support compiled in"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
echo "1..1"
|
||||||
|
|
||||||
setup_test_repository "archive-z2"
|
setup_test_repository "archive-z2"
|
||||||
|
|
||||||
export OSTREE_GPG_SIGN="${OSTREE} gpg-sign --gpg-homedir=${TEST_GPG_KEYHOME}"
|
export OSTREE_GPG_SIGN="${OSTREE} gpg-sign --gpg-homedir=${TEST_GPG_KEYHOME}"
|
||||||
|
|
@ -74,3 +77,5 @@ assert_file_has_content test2-delete 'Signatures deleted: 2'
|
||||||
if ${OSTREE} show test2 | grep -o 'Found [[:digit:]] signature'; then
|
if ${OSTREE} show test2 | grep -o 'Found [[:digit:]] signature'; then
|
||||||
assert_not_reached
|
assert_not_reached
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ test_fixture_setup (TestFixture *fixture,
|
||||||
* taken into account, which contains additional data like revocation
|
* taken into account, which contains additional data like revocation
|
||||||
* certificates for certain test cases. */
|
* certificates for certain test cases. */
|
||||||
|
|
||||||
homedir = g_test_build_filename (G_TEST_DIST, "gpg-verify-data", NULL);
|
homedir = g_test_build_filename (G_TEST_DIST, "tests/gpg-verify-data", NULL);
|
||||||
g_setenv ("GNUPGHOME", homedir, TRUE);
|
g_setenv ("GNUPGHOME", homedir, TRUE);
|
||||||
|
|
||||||
result = g_initable_new (OSTREE_TYPE_GPG_VERIFY_RESULT,
|
result = g_initable_new (OSTREE_TYPE_GPG_VERIFY_RESULT,
|
||||||
|
|
|
||||||
|
|
@ -20,13 +20,14 @@
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if ! ostree --version | grep -q -e '\+libarchive'; then
|
if ! ostree --version | grep -q -e '\+libarchive'; then
|
||||||
exit 77
|
echo "1..0 #SKIP no libarchive support compiled in"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "1..7"
|
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
echo "1..7"
|
||||||
|
|
||||||
setup_test_repository "bare"
|
setup_test_repository "bare"
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
mkdir foo
|
mkdir foo
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,5 @@ ${CMD_PREFIX} ostree --repo=repo pull origin main --subpath /baz
|
||||||
${CMD_PREFIX} ostree fsck --repo=repo >fsck.out
|
${CMD_PREFIX} ostree fsck --repo=repo >fsck.out
|
||||||
assert_file_has_content fsck.out 'Verifying content integrity of 0 commit objects'
|
assert_file_has_content fsck.out 'Verifying content integrity of 0 commit objects'
|
||||||
assert_file_has_content fsck.out '1 partial commits not verified'
|
assert_file_has_content fsck.out '1 partial commits not verified'
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,4 @@ set -euo pipefail
|
||||||
|
|
||||||
setup_fake_remote_repo1 "archive-z2"
|
setup_fake_remote_repo1 "archive-z2"
|
||||||
|
|
||||||
echo '1..2'
|
|
||||||
|
|
||||||
. ${SRCDIR}/pull-test.sh
|
. ${SRCDIR}/pull-test.sh
|
||||||
|
|
|
||||||
|
|
@ -39,3 +39,5 @@ if ${CMD_PREFIX} ostree --repo=repo pull origin main 2>pulllog.txt 1>&2; then
|
||||||
assert_not_reached "pull unexpectedly succeeded!"
|
assert_not_reached "pull unexpectedly succeeded!"
|
||||||
fi
|
fi
|
||||||
assert_file_has_content pulllog.txt "exceeded maximum"
|
assert_file_has_content pulllog.txt "exceeded maximum"
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ set -euo pipefail
|
||||||
|
|
||||||
setup_fake_remote_repo1 "archive-z2"
|
setup_fake_remote_repo1 "archive-z2"
|
||||||
|
|
||||||
|
echo '1..9'
|
||||||
|
|
||||||
# And another web server acting as the metalink server
|
# And another web server acting as the metalink server
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
mkdir metalink-data
|
mkdir metalink-data
|
||||||
|
|
@ -37,7 +39,6 @@ summary_path=${test_tmpdir}/ostree-srv/gnomerepo/summary
|
||||||
|
|
||||||
echo -n broken > ${summary_path}.bad
|
echo -n broken > ${summary_path}.bad
|
||||||
|
|
||||||
echo '1..1'
|
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
|
|
||||||
cat > metalink-valid-summary.xml <<EOF
|
cat > metalink-valid-summary.xml <<EOF
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
echo "1..5"
|
||||||
|
|
||||||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
||||||
setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}"
|
setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ setup_fake_remote_repo1 "archive-z2"
|
||||||
|
|
||||||
echo '1..1'
|
echo '1..1'
|
||||||
|
|
||||||
echo "SUBDIR TEST"
|
|
||||||
|
|
||||||
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
||||||
cp -a ${repopath} ${repopath}.orig
|
cp -a ${repopath} ${repopath}.orig
|
||||||
|
|
||||||
|
|
@ -49,3 +47,5 @@ assert_has_file repo/state/${rev}.commitpartial
|
||||||
${CMD_PREFIX} ostree --repo=repo pull origin main
|
${CMD_PREFIX} ostree --repo=repo pull origin main
|
||||||
assert_not_has_file repo/state/${rev}.commitpartial
|
assert_not_has_file repo/state/${rev}.commitpartial
|
||||||
${CMD_PREFIX} ostree --repo=repo fsck
|
${CMD_PREFIX} ostree --repo=repo fsck
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
|
echo "1..5"
|
||||||
|
|
||||||
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}"
|
||||||
setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}"
|
setup_fake_remote_repo1 "archive-z2" "${COMMIT_SIGN}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ set -euo pipefail
|
||||||
|
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
echo '1..3'
|
echo '1..13'
|
||||||
|
|
||||||
setup_test_repository "bare"
|
setup_test_repository "bare"
|
||||||
$OSTREE remote add origin http://example.com/ostree/gnome
|
$OSTREE remote add origin http://example.com/ostree/gnome
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ unset OSTREE_GPG_HOME
|
||||||
|
|
||||||
setup_fake_remote_repo1 "archive-z2"
|
setup_fake_remote_repo1 "archive-z2"
|
||||||
|
|
||||||
|
echo "1..1"
|
||||||
|
|
||||||
cd ${test_tmpdir}
|
cd ${test_tmpdir}
|
||||||
mkdir repo
|
mkdir repo
|
||||||
${OSTREE} init
|
${OSTREE} init
|
||||||
|
|
@ -140,3 +142,5 @@ if ${OSTREE} pull R2:main >/dev/null 2>&1; then
|
||||||
assert_not_reached "(key3/R2) GPG verification unexpectedly succeeded"
|
assert_not_reached "(key3/R2) GPG verification unexpectedly succeeded"
|
||||||
fi
|
fi
|
||||||
${OSTREE} pull R3:main >/dev/null
|
${OSTREE} pull R3:main >/dev/null
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,13 @@ set -euo pipefail
|
||||||
. $(dirname $0)/libtest.sh
|
. $(dirname $0)/libtest.sh
|
||||||
|
|
||||||
setup_test_repository "bare"
|
setup_test_repository "bare"
|
||||||
echo "ok setup"
|
|
||||||
|
|
||||||
echo '1..2'
|
echo '1..1'
|
||||||
|
|
||||||
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
repopath=${test_tmpdir}/ostree-srv/gnomerepo
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/ test2 checkedout
|
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/ test2 checkedout
|
||||||
|
|
||||||
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/firstfile test2 checkedout2
|
${CMD_PREFIX} ostree --repo=repo checkout -U --subpath=/firstfile test2 checkedout2
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,5 @@ chmod a+x test2-checkout/abinary
|
||||||
rm -rf test2-checkout
|
rm -rf test2-checkout
|
||||||
$OSTREE checkout test2 test2-checkout
|
$OSTREE checkout test2 test2-checkout
|
||||||
test -u test2-checkout/abinary
|
test -u test2-checkout/abinary
|
||||||
|
|
||||||
|
echo "ok"
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ function assertNotEquals(a, b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function libtestExec(shellCode) {
|
function libtestExec(shellCode) {
|
||||||
let testdatadir = GLib.getenv("TESTDATADIR");
|
let testdatadir = GLib.getenv("G_TEST_SRCDIR");
|
||||||
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
|
let libtestPath = GLib.build_filenamev([testdatadir, 'libtest.sh'])
|
||||||
let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c',
|
let proc = GSystem.Subprocess.new_simple_argv(['bash', '-c',
|
||||||
'. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
|
'. ' + GLib.shell_quote(libtestPath) + '; ' + shellCode],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue