2013-05-01 23:26:21 +04:00
# Makefile for tests code
#
# Copyright (C) 2013 Colin Walters <walters@verbum.org>
#
2018-01-30 22:26:26 +03:00
# SPDX-License-Identifier: LGPL-2.0+
#
2013-05-01 23:26:21 +04:00
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
2021-12-07 04:20:55 +03:00
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
2013-05-01 23:26:21 +04:00
2016-06-12 12:43:34 +03:00
EXTRA_DIST += \
buildutil/tap-driver.sh \
buildutil/tap-test \
2016-10-08 01:12:29 +03:00
tests/glib.supp \
tests/ostree.supp \
2016-06-12 12:43:34 +03:00
$(NULL)
2016-03-02 18:28:04 +03:00
# We should probably consider flipping the default for DEBUG. Also,
# include the builddir in $PATH so we find our just-built ostree
# binary.
2017-05-23 15:26:25 +03:00
AM_TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
2017-03-23 20:06:07 +03:00
OSTREE_UNINSTALLED_SRCDIR=$(abs_top_srcdir) \
2016-12-30 22:18:34 +03:00
OSTREE_UNINSTALLED=$(abs_top_builddir) \
2016-12-05 20:58:43 +03:00
G_DEBUG=fatal-warnings \
2016-11-30 13:01:05 +03:00
GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd)$${LD_LIBRARY_PATH:+:$${LD_LIBRARY_PATH}} \
2016-05-11 22:54:48 +03:00
PATH=$$(cd $(top_builddir)/tests && pwd):$${PATH} \
2017-05-01 12:59:33 +03:00
OSTREE_FEATURES="$(OSTREE_FEATURES)" \
2017-10-14 03:52:04 +03:00
PYTHONUNBUFFERED=1 \
2016-03-31 11:02:23 +03:00
$(NULL)
2016-12-08 05:59:40 +03:00
if BUILDOPT_ASAN
2017-05-23 15:26:25 +03:00
AM_TESTS_ENVIRONMENT += OT_SKIP_READDIR_RAND=1 G_SLICE=always-malloc
2016-12-08 05:59:40 +03:00
endif
2016-03-02 18:28:04 +03:00
2016-07-14 14:42:32 +03:00
uninstalled_test_data = tests/ostree-symlink-stamp tests/ostree-prepare-root-symlink-stamp \
2017-11-03 23:13:50 +03:00
tests/ostree-remount-symlink-stamp
2016-05-11 22:54:48 +03:00
2017-05-08 17:44:43 +03:00
dist_uninstalled_test_scripts = tests/test-symbols.sh tests/coccinelle.sh
# This logic implements ENABLE_INSTALLED_TESTS_EXCLUSIVE; see below.
# The goal here if installed tests are enabled, we explicitly make the
# tests *only* run installed, to avoid having to run them twice in CI.
# This overrides the glib-tap.mk emphasis on doing both, if we'd
# used e.g. `dist_test_scripts`.
dist_test_scripts = $(NULL)
Make P2P API public (no longer experimental)
Currently the API that allows P2P operations (e.g. pulling an ostree ref
from a LAN or USB source) is hidden behind the configure flag
--enable-experimental-api. This commit makes the API public and makes
that flag essentially a no-op (leaving it in place in case we want to
use it again in the future). The P2P API has been tested over the last
several months and proven to work.
This means that since we're no longer using the "experimental" feature
flag, P2P builds of Flatpak will fail when using versions of OSTree from
this commit onwards, until Flatpak is patched in the near future. If you
want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree
2018.6, you'll have to patch Flatpak. However, since Flatpak won't yet
have a hard dependency on OSTree 2018.6, it needs a new way to determine
if the P2P API in OSTree is available, so this commit adds a "p2p"
feature flag. This way the feature set is more semantically correct than
if we had continued to use the "experimental" feature flag.
In addition to making the P2P API public, this commit makes the P2P unit
tests run by default, removes the f27-experimental CI instance that's no
longer needed, changes a few man pages to reflect the changes, and
updates the bash completion script to accept the new commands and
options.
Closes: #1596
Approved by: cgwalters
2018-05-23 01:55:14 +03:00
test_programs = \
tests/test-bloom \
tests/test-repo-finder-config \
tests/test-repo-finder-mount \
$(NULL)
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_scripts = \
2016-03-02 18:28:04 +03:00
tests/test-basic.sh \
2022-03-02 19:45:00 +03:00
tests/test-basic-bare-split-xattrs.sh \
2017-01-19 14:21:58 +03:00
tests/test-basic-user.sh \
2017-03-26 12:03:47 +03:00
tests/test-basic-user-only.sh \
2017-04-18 19:41:40 +03:00
tests/test-basic-root.sh \
2021-12-20 13:00:02 +03:00
tests/test-cli-extensions.sh \
2016-03-02 18:28:04 +03:00
tests/test-pull-subpath.sh \
tests/test-archivez.sh \
tests/test-remote-add.sh \
2016-11-16 05:03:26 +03:00
tests/test-remote-headers.sh \
2016-03-02 18:28:04 +03:00
tests/test-commit-sign.sh \
2021-06-22 13:42:36 +03:00
tests/test-commit-timestamp.sh \
2016-03-02 18:28:04 +03:00
tests/test-export.sh \
tests/test-help.sh \
tests/test-libarchive.sh \
2016-04-01 11:20:34 +03:00
tests/test-parent.sh \
2017-07-10 04:46:23 +03:00
tests/test-pull-bare.sh \
tests/test-pull-bareuser.sh \
2017-10-14 01:14:17 +03:00
tests/test-pull-bareuseronly.sh \
2017-10-30 21:17:10 +03:00
tests/test-pull2-bareuseronly.sh \
2016-03-02 18:28:04 +03:00
tests/test-pull-commit-only.sh \
tests/test-pull-depth.sh \
tests/test-pull-mirror-summary.sh \
tests/test-pull-large-metadata.sh \
tests/test-pull-metalink.sh \
2020-10-09 20:34:55 +03:00
tests/test-pull-summary-caching.sh \
2016-03-02 18:28:04 +03:00
tests/test-pull-summary-sigs.sh \
tests/test-pull-resume.sh \
2017-09-27 05:02:25 +03:00
tests/test-pull-basicauth.sh \
2016-07-08 00:39:07 +03:00
tests/test-pull-repeated.sh \
2019-10-25 00:21:49 +03:00
tests/test-pull-sizes.sh \
2016-03-23 14:32:03 +03:00
tests/test-pull-untrusted.sh \
2016-04-22 15:41:04 +03:00
tests/test-pull-override-url.sh \
2017-06-29 05:19:15 +03:00
tests/test-pull-localcache.sh \
2016-04-04 15:43:33 +03:00
tests/test-local-pull.sh \
2016-03-02 18:28:04 +03:00
tests/test-local-pull-depth.sh \
tests/test-admin-upgrade-unconfigured.sh \
2017-05-15 21:13:38 +03:00
tests/test-admin-upgrade-endoflife.sh \
2015-07-25 19:51:14 +03:00
tests/test-admin-upgrade-systemd-update.sh \
2016-03-02 18:28:04 +03:00
tests/test-admin-deploy-syslinux.sh \
tests/test-admin-deploy-2.sh \
tests/test-admin-deploy-karg.sh \
tests/test-admin-deploy-switch.sh \
tests/test-admin-deploy-etcmerge-cornercases.sh \
tests/test-admin-deploy-uboot.sh \
2016-04-01 14:51:18 +03:00
tests/test-admin-deploy-grub2.sh \
2020-04-21 22:25:40 +03:00
tests/test-admin-deploy-nomerge.sh \
2019-02-15 00:18:01 +03:00
tests/test-admin-deploy-none.sh \
2016-01-13 19:33:54 +03:00
tests/test-admin-deploy-bootid-gc.sh \
2020-09-24 22:28:31 +03:00
tests/test-osupdate-dtb.sh \
2016-03-02 18:28:04 +03:00
tests/test-admin-instutil-set-kargs.sh \
tests/test-admin-upgrade-not-backwards.sh \
tests/test-admin-pull-deploy-commit.sh \
2017-01-05 19:29:41 +03:00
tests/test-admin-pull-deploy-split.sh \
2016-03-02 18:28:04 +03:00
tests/test-admin-locking.sh \
tests/test-admin-deploy-clean.sh \
tests/test-reset-nonlinear.sh \
tests/test-oldstyle-partial.sh \
tests/test-delta.sh \
2019-11-29 18:17:17 +03:00
tests/test-delta-sign.sh \
2019-12-03 13:15:51 +03:00
tests/test-delta-ed25519.sh \
2016-03-02 18:28:04 +03:00
tests/test-xattrs.sh \
tests/test-auto-summary.sh \
tests/test-prune.sh \
2017-10-14 03:50:28 +03:00
tests/test-concurrency.py \
2016-03-02 18:28:04 +03:00
tests/test-refs.sh \
2016-03-04 05:17:53 +03:00
tests/test-demo-buildsystem.sh \
2016-07-27 18:40:05 +03:00
tests/test-switchroot.sh \
2016-08-25 22:34:34 +03:00
tests/test-pull-contenturl.sh \
tests/test-pull-mirrorlist.sh \
2017-06-22 17:16:53 +03:00
tests/test-summary-update.sh \
2017-05-07 20:55:29 +03:00
tests/test-summary-view.sh \
2016-08-24 14:26:47 +03:00
tests/test-no-initramfs.sh \
2017-09-15 18:05:12 +03:00
tests/test-create-usb.sh \
2017-06-13 20:55:53 +03:00
tests/test-find-remotes.sh \
tests/test-fsck-collections.sh \
2019-07-10 21:42:27 +03:00
tests/test-fsck-delete.sh \
2017-06-13 20:55:53 +03:00
tests/test-init-collections.sh \
tests/test-prune-collections.sh \
tests/test-refs-collections.sh \
tests/test-remote-add-collections.sh \
2017-09-18 17:43:41 +03:00
tests/test-repo-finder-mount-integration.sh \
2017-06-13 20:55:53 +03:00
tests/test-summary-collections.sh \
2017-06-28 13:46:02 +03:00
tests/test-pull-collections.sh \
2018-08-17 18:55:56 +03:00
tests/test-config.sh \
2019-08-02 02:20:33 +03:00
tests/test-signed-commit.sh \
2019-08-26 22:11:32 +03:00
tests/test-signed-pull.sh \
2020-06-11 21:31:33 +03:00
tests/test-pre-signed-pull.sh \
2019-11-26 13:01:36 +03:00
tests/test-signed-pull-summary.sh \
2019-08-26 22:11:32 +03:00
$(NULL)
2019-05-21 01:23:14 +03:00
if USE_GPGME
_installed_or_uninstalled_test_scripts += \
tests/test-remote-gpg-import.sh \
2021-08-23 20:09:24 +03:00
tests/test-remote-gpg-list-keys.sh \
2019-05-21 01:23:14 +03:00
tests/test-gpg-signed-commit.sh \
tests/test-admin-gpg.sh \
$(NULL)
endif
2018-01-03 11:23:10 +03:00
test_extra_programs = \
tests/get-byte-order \
Make P2P API public (no longer experimental)
Currently the API that allows P2P operations (e.g. pulling an ostree ref
from a LAN or USB source) is hidden behind the configure flag
--enable-experimental-api. This commit makes the API public and makes
that flag essentially a no-op (leaving it in place in case we want to
use it again in the future). The P2P API has been tested over the last
several months and proven to work.
This means that since we're no longer using the "experimental" feature
flag, P2P builds of Flatpak will fail when using versions of OSTree from
this commit onwards, until Flatpak is patched in the near future. If you
want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree
2018.6, you'll have to patch Flatpak. However, since Flatpak won't yet
have a hard dependency on OSTree 2018.6, it needs a new way to determine
if the P2P API in OSTree is available, so this commit adds a "p2p"
feature flag. This way the feature set is more semantically correct than
if we had continued to use the "experimental" feature flag.
In addition to making the P2P API public, this commit makes the P2P unit
tests run by default, removes the f27-experimental CI instance that's no
longer needed, changes a few man pages to reflect the changes, and
updates the bash completion script to accept the new commands and
options.
Closes: #1596
Approved by: cgwalters
2018-05-23 01:55:14 +03:00
tests/repo-finder-mount \
2018-01-03 11:23:10 +03:00
$(NULL)
tests_get_byte_order_SOURCES = tests/get-byte-order.c
tests_get_byte_order_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS)
tests_get_byte_order_LDADD = $(GLIB_LIBS)
2017-09-15 18:05:12 +03:00
tests_repo_finder_mount_SOURCES = tests/repo-finder-mount.c
tests_repo_finder_mount_CFLAGS = $(common_tests_cflags)
tests_repo_finder_mount_LDADD = $(common_tests_ldadd) libostreetest.la
2017-07-12 17:04:34 +03:00
2016-02-10 14:42:54 +03:00
if BUILDOPT_FUSE
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_scripts += tests/test-rofiles-fuse.sh
2017-11-03 23:13:50 +03:00
uninstalled_test_data += tests/rofiles-fuse-symlink-stamp
2016-10-08 01:09:29 +03:00
else
EXTRA_DIST += tests/test-rofiles-fuse.sh
2016-02-10 14:42:54 +03:00
endif
2016-12-08 05:16:52 +03:00
if USE_LIBSOUP
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_scripts += tests/test-remote-cookies.sh
2016-12-08 05:16:52 +03:00
endif
2017-05-08 17:44:43 +03:00
# These call into gjs scripts
2016-12-08 05:59:40 +03:00
js_tests = tests/test-corruption.sh tests/test-pull-corruption.sh
2014-01-21 23:53:06 +04:00
if BUILDOPT_GJS
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_scripts += $(js_tests)
2016-10-08 01:09:29 +03:00
else
EXTRA_DIST += $(js_tests)
2014-01-21 23:53:06 +04:00
endif
2016-06-12 12:39:46 +03:00
dist_installed_test_data = tests/archive-test.sh \
2013-05-01 23:26:21 +04:00
tests/pull-test.sh \
2017-10-30 21:17:10 +03:00
tests/pull-test2.sh \
2014-01-15 18:48:04 +04:00
tests/admin-test.sh \
2014-12-05 16:28:16 +03:00
tests/basic-test.sh \
2016-02-25 01:04:04 +03:00
tests/pre-endian-deltas-repo-big.tar.xz \
tests/pre-endian-deltas-repo-little.tar.xz \
2017-10-30 21:17:10 +03:00
tests/fah-deltadata-old.tar.xz \
tests/fah-deltadata-new.tar.xz \
2018-01-12 17:01:52 +03:00
tests/ostree-path-traverse.tar.gz \
2020-06-11 21:31:33 +03:00
tests/pre-signed-pull-data.tar.gz \
2017-05-04 22:16:21 +03:00
tests/libtest-core.sh \
2022-04-12 12:53:54 +03:00
tests/bare-split-xattrs-basic.tar.xz \
2013-05-01 23:26:21 +04:00
$(NULL)
2017-05-04 22:16:21 +03:00
EXTRA_DIST += tests/libtest.sh
2016-12-08 20:50:20 +03:00
2017-01-19 14:34:57 +03:00
dist_test_extra_scripts = \
tests/bootloader-entries-crosscheck.py \
tests/corrupt-repo-ref.js \
tests/ostree-grub-generator \
$(NULL)
2015-05-28 03:08:44 +03:00
2019-05-21 01:23:14 +03:00
if USE_GPGME
2016-03-08 21:12:00 +03:00
# We can't use nobase_ as we need to strip off the tests/, can't
# use plain installed_ as we do need the gpghome/ prefix.
if ENABLE_INSTALLED_TESTS
2016-03-02 18:28:04 +03:00
gpginsttestdir = $(installed_testdir)/gpghome
2016-06-12 12:45:48 +03:00
dist_gpginsttest_DATA = tests/gpghome/secring.gpg \
2016-03-02 18:28:04 +03:00
tests/gpghome/pubring.gpg \
2015-05-07 20:42:19 +03:00
tests/gpghome/trustdb.gpg \
tests/gpghome/key1.asc \
tests/gpghome/key2.asc \
tests/gpghome/key3.asc
2016-03-02 18:28:04 +03:00
gpginsttest_trusteddir = $(installed_testdir)/gpghome/trusted
2016-06-12 12:45:48 +03:00
dist_gpginsttest_trusted_DATA = tests/gpghome/trusted/pubring.gpg
2019-06-21 14:27:33 +03:00
gpginsttest_revocdir = $(installed_testdir)/gpghome/revocations
dist_gpginsttest_revoc_DATA = \
tests/gpghome/revocations/key1.rev \
tests/gpghome/revocations/key2.rev \
tests/gpghome/revocations/key3.rev \
$(NULL)
2014-02-10 18:38:07 +04:00
2016-03-02 18:28:04 +03:00
gpgvinsttestdir = $(installed_testdir)/gpg-verify-data
2016-06-12 12:45:48 +03:00
dist_gpgvinsttest_DATA = $(addprefix tests/gpg-verify-data/, \
2019-06-20 00:31:18 +03:00
gpg.conf lgpl2 lgpl2.sig lgpl2.sig0 lgpl2.sig1 lgpl2.sig2 lgpl2.sig3 \
lgpl2.sig4 pubring.gpg secring.gpg trustdb.gpg)
2016-03-08 21:12:00 +03:00
endif
2019-05-21 01:23:14 +03:00
endif
2015-02-16 18:29:14 +03:00
2016-10-08 01:09:29 +03:00
js_installed_tests = \
tests/test-core.js \
2017-09-07 22:02:51 +03:00
tests/test-remotes-config-dir.js \
2013-10-09 06:44:39 +04:00
tests/test-sizes.js \
2014-03-19 17:15:29 +04:00
tests/test-sysroot.js \
2013-10-03 03:47:38 +04:00
$(NULL)
2016-10-08 01:09:29 +03:00
if BUILDOPT_GJS
2017-07-20 17:32:44 +03:00
_installed_or_uninstalled_test_scripts += $(js_installed_tests)
2016-10-08 01:09:29 +03:00
else
EXTRA_DIST += $(js_installed_tests)
2013-09-18 20:01:46 +04:00
endif
2016-03-02 18:28:04 +03:00
test_ltlibraries = libreaddir-rand.la
2015-06-02 05:34:14 +03:00
libreaddir_rand_la_SOURCES = tests/readdir-rand.c
2016-06-17 16:36:51 +03:00
libreaddir_rand_la_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS)
2016-06-12 17:25:21 +03:00
libreaddir_rand_la_LIBADD = \
-ldl \
$(OT_INTERNAL_GIO_UNIX_LIBS) \
$(NULL)
2016-06-17 16:36:51 +03:00
libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
2016-03-31 12:17:02 +03:00
if !ENABLE_INSTALLED_TESTS
libreaddir_rand_la_LDFLAGS += -rpath $(abs_builddir)
endif
2015-06-02 05:34:14 +03:00
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \
2015-03-04 20:44:47 +03:00
tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \
2019-05-21 01:23:14 +03:00
tests/test-checksum tests/test-lzma tests/test-rollsum \
2020-10-16 19:05:54 +03:00
tests/test-basic-c tests/test-sysroot-c tests/test-pull-c tests/test-repo tests/test-include-ostree-h tests/test-kargs \
tests/test-rfc2616-dates
2015-03-06 13:38:13 +03:00
2019-05-21 01:23:14 +03:00
if USE_GPGME
_installed_or_uninstalled_test_programs += \
tests/test-gpg-verify-result \
$(NULL)
endif
2017-04-19 02:13:28 +03:00
if USE_AVAHI
test_programs += tests/test-repo-finder-avahi
endif
2017-04-19 02:05:06 +03:00
2016-03-02 18:28:04 +03:00
# An interactive tool
noinst_PROGRAMS += tests/test-rollsum-cli
2016-02-19 00:49:30 +03:00
if USE_LIBARCHIVE
2017-05-08 17:44:43 +03:00
_installed_or_uninstalled_test_programs += tests/test-libarchive-import
2016-02-19 00:49:30 +03:00
endif
2016-03-02 18:05:08 +03:00
common_tests_cflags = $(ostree_bin_shared_cflags) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/libglnx
common_tests_ldadd = $(ostree_bin_shared_ldadd) $(OT_INTERNAL_GIO_UNIX_LIBS)
noinst_LTLIBRARIES += libostreetest.la
2017-04-19 02:07:51 +03:00
libostreetest_la_SOURCES = tests/libostreetest.c tests/test-mock-gio.c tests/test-mock-gio.h
2016-03-02 18:05:08 +03:00
libostreetest_la_CFLAGS = $(common_tests_cflags) -I $(srcdir)/tests
libostreetest_la_LIBADD = $(common_tests_ldadd)
TESTS_CFLAGS = $(common_tests_cflags)
TESTS_LDADD = $(common_tests_ldadd) libostreetest.la
2015-02-02 14:56:40 +03:00
2015-08-14 09:43:44 +03:00
tests_test_rollsum_cli_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum-cli.c
tests_test_rollsum_cli_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS)
oxidation: Add implementation of bupsplit in Rust
This is an initial drop of "oxidation", or adding implementation
of components in Rust. The bupsplit code is a good target - no
dependencies, just computation.
Translation into Rust had a few twists -
- The C code relies a lot on overflowing unsigned ints, and
also on the C promotion rules for e.g. `uint8_t -> int32_t`
- There were some odd loops that I introduced bugs in while
translating...in particular, the function always returns `len`,
but I mistakenly translated to `len+1`, resulting in an OOB
read on the C side, which was hard to debug.
On the plus side, an off-by-one array indexing in the Rust code paniced nicely.
In practice, we'll need a lot more build infrastructure to make this work, such
as using `cargo vendor` when producing build artifacts for example. Also, Cargo
is yet another thing we need to cache.
Where do we go with this? Well, I think we should merge this, it's not a lot of
code. We can just have it be an alternative CI target. Should we do a lot more
right now? Probably not immediately, but I find the medium/long term prospects
pretty exciting!
Closes: #656
Approved by: jlebon
2017-01-25 05:43:53 +03:00
tests_test_rollsum_cli_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS)
2015-02-02 14:56:40 +03:00
2015-08-25 16:27:56 +03:00
tests_test_rollsum_SOURCES = src/libostree/ostree-rollsum.c tests/test-rollsum.c
tests_test_rollsum_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_ZLIB_CFLAGS)
oxidation: Add implementation of bupsplit in Rust
This is an initial drop of "oxidation", or adding implementation
of components in Rust. The bupsplit code is a good target - no
dependencies, just computation.
Translation into Rust had a few twists -
- The C code relies a lot on overflowing unsigned ints, and
also on the C promotion rules for e.g. `uint8_t -> int32_t`
- There were some odd loops that I introduced bugs in while
translating...in particular, the function always returns `len`,
but I mistakenly translated to `len+1`, resulting in an OOB
read on the C side, which was hard to debug.
On the plus side, an off-by-one array indexing in the Rust code paniced nicely.
In practice, we'll need a lot more build infrastructure to make this work, such
as using `cargo vendor` when producing build artifacts for example. Also, Cargo
is yet another thing we need to cache.
Where do we go with this? Well, I think we should merge this, it's not a lot of
code. We can just have it be an alternative CI target. Should we do a lot more
right now? Probably not immediately, but I find the medium/long term prospects
pretty exciting!
Closes: #656
Approved by: jlebon
2017-01-25 05:43:53 +03:00
tests_test_rollsum_LDADD = $(bupsplitpath) $(TESTS_LDADD) $(OT_DEP_ZLIB_LIBS)
2015-08-25 16:27:56 +03:00
2017-04-19 02:11:28 +03:00
tests_test_bloom_SOURCES = src/libostree/ostree-bloom.c tests/test-bloom.c
tests_test_bloom_CFLAGS = $(TESTS_CFLAGS)
tests_test_bloom_LDADD = $(TESTS_LDADD)
2018-06-07 00:34:01 +03:00
tests_test_include_ostree_h_SOURCES = tests/test-include-ostree-h.c
# Don't use TESTS_CFLAGS so we test if the public header can be included by external programs
tests_test_include_ostree_h_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -I$(srcdir)/src/libostree -I$(builddir)/src/libostree
# Don't define OSTREE_COMPILATION so that we're compiling as if it's an external program
tests_test_include_ostree_h_CPPFLAGS = $(AM_CPPFLAGS) -UOSTREE_COMPILATION
tests_test_include_ostree_h_LDADD = $(TESTS_LDADD)
2017-04-19 02:13:28 +03:00
if USE_AVAHI
tests_test_repo_finder_avahi_SOURCES = src/libostree/ostree-repo-finder-avahi-parser.c tests/test-repo-finder-avahi.c
tests_test_repo_finder_avahi_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_finder_avahi_LDADD = $(TESTS_LDADD)
endif
2019-05-28 21:02:54 +03:00
tests_test_kargs_SOURCES = src/libostree/ostree-kernel-args.c tests/test-kargs.c
tests_test_kargs_CFLAGS = $(TESTS_CFLAGS)
tests_test_kargs_LDADD = $(TESTS_LDADD)
2017-04-19 02:05:06 +03:00
tests_test_repo_finder_config_SOURCES = tests/test-repo-finder-config.c
tests_test_repo_finder_config_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_finder_config_LDADD = $(TESTS_LDADD)
2017-04-19 02:07:51 +03:00
tests_test_repo_finder_mount_SOURCES = tests/test-repo-finder-mount.c
tests_test_repo_finder_mount_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_finder_mount_LDADD = $(TESTS_LDADD)
2015-03-04 16:14:18 +03:00
tests_test_mutable_tree_CFLAGS = $(TESTS_CFLAGS)
tests_test_mutable_tree_LDADD = $(TESTS_LDADD)
2016-03-02 18:05:08 +03:00
tests_test_basic_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_basic_c_LDADD = $(TESTS_LDADD)
2016-03-03 21:49:54 +03:00
tests_test_sysroot_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_sysroot_c_LDADD = $(TESTS_LDADD)
2016-06-06 21:49:11 +03:00
tests_test_pull_c_CFLAGS = $(TESTS_CFLAGS)
tests_test_pull_c_LDADD = $(TESTS_LDADD)
2017-09-21 22:22:09 +03:00
tests_test_repo_CFLAGS = $(TESTS_CFLAGS)
tests_test_repo_LDADD = $(TESTS_LDADD)
2015-03-03 16:21:40 +03:00
tests_test_ot_unix_utils_CFLAGS = $(TESTS_CFLAGS)
tests_test_ot_unix_utils_LDADD = $(TESTS_LDADD)
2015-02-02 14:56:40 +03:00
2015-03-03 16:21:40 +03:00
tests_test_varint_SOURCES = src/libostree/ostree-varint.c tests/test-varint.c
tests_test_varint_CFLAGS = $(TESTS_CFLAGS)
tests_test_varint_LDADD = $(TESTS_LDADD)
2015-02-23 12:05:19 +03:00
2015-03-03 16:21:40 +03:00
tests_test_bsdiff_CFLAGS = $(TESTS_CFLAGS)
tests_test_bsdiff_LDADD = libbsdiff.la $(TESTS_LDADD)
2015-03-05 17:40:52 +03:00
2020-01-21 05:54:00 +03:00
tests_test_checksum_SOURCES = \
src/libostree/ostree-core.c \
src/libostree/ostree-varint.c \
tests/test-checksum.c
2015-04-28 18:45:37 +03:00
tests_test_checksum_CFLAGS = $(TESTS_CFLAGS) $(libglnx_cflags)
tests_test_checksum_LDADD = $(TESTS_LDADD)
2016-02-19 00:49:30 +03:00
tests_test_libarchive_import_SOURCES = tests/test-libarchive-import.c
2016-03-11 11:46:27 +03:00
tests_test_libarchive_import_CFLAGS = $(TESTS_CFLAGS) $(libglnx_cflags) $(OT_DEP_LIBARCHIVE_CFLAGS)
tests_test_libarchive_import_LDADD = $(TESTS_LDADD) $(OT_DEP_LIBARCHIVE_LIBS)
2016-02-19 00:49:30 +03:00
2015-03-05 17:40:52 +03:00
tests_test_keyfile_utils_CFLAGS = $(TESTS_CFLAGS)
tests_test_keyfile_utils_LDADD = $(TESTS_LDADD)
2015-03-06 13:38:13 +03:00
tests_test_ot_opt_utils_CFLAGS = $(TESTS_CFLAGS)
tests_test_ot_opt_utils_LDADD = $(TESTS_LDADD)
2015-03-06 14:54:53 +03:00
tests_test_ot_tool_util_CFLAGS = $(TESTS_CFLAGS)
tests_test_ot_tool_util_LDADD = $(TESTS_LDADD)
2015-03-04 20:44:47 +03:00
2015-08-11 12:26:14 +03:00
tests_test_lzma_SOURCES = src/libostree/ostree-lzma-common.c src/libostree/ostree-lzma-compressor.c \
src/libostree/ostree-lzma-decompressor.c tests/test-lzma.c
2015-08-26 19:54:31 +03:00
tests_test_lzma_CFLAGS = $(TESTS_CFLAGS) $(OT_DEP_LZMA_CFLAGS)
tests_test_lzma_LDADD = $(TESTS_LDADD) $(OT_DEP_LZMA_LIBS)
2015-08-11 12:26:14 +03:00
2020-10-16 19:05:54 +03:00
tests_test_rfc2616_dates_SOURCES = \
src/libostree/ostree-date-utils.c \
tests/test-rfc2616-dates.c
tests_test_rfc2616_dates_CFLAGS = $(TESTS_CFLAGS)
tests_test_rfc2616_dates_LDADD = $(TESTS_LDADD)
2021-04-13 01:42:05 +03:00
noinst_PROGRAMS += tests/test-commit-sign-sh-ext
tests_test_commit_sign_sh_ext_CFLAGS = $(TESTS_CFLAGS)
tests_test_commit_sign_sh_ext_LDADD = $(TESTS_LDADD)
2019-05-21 01:23:14 +03:00
if USE_GPGME
2015-03-04 20:44:47 +03:00
tests_test_gpg_verify_result_SOURCES = \
src/libostree/ostree-gpg-verify-result-private.h \
tests/test-gpg-verify-result.c
2015-05-13 01:48:22 +03:00
tests_test_gpg_verify_result_CFLAGS = $(TESTS_CFLAGS) $(OT_INTERNAL_GPGME_CFLAGS)
tests_test_gpg_verify_result_LDADD = $(TESTS_LDADD) $(OT_INTERNAL_GPGME_LIBS)
2015-03-04 20:44:47 +03:00
2019-05-21 01:23:14 +03:00
EXTRA_DIST += \
tests/gpg-verify-data/README.md \
$(NULL)
endif
2015-03-04 20:44:47 +03:00
EXTRA_DIST += \
2016-04-07 10:53:54 +03:00
tests/libostreetest.h \
2016-06-12 12:45:48 +03:00
tests/libtest.sh \
2016-05-13 16:47:09 +03:00
$(NULL)
2016-03-02 18:28:04 +03:00
2016-04-07 04:26:38 +03:00
tests/libreaddir-rand.so: Makefile
2018-08-14 13:38:15 +03:00
mkdir -p tests/
$(AM_V_GEN) ln -fns ../.libs/libreaddir-rand.so tests/
2016-04-07 04:26:38 +03:00
ALL_LOCAL_RULES += tests/libreaddir-rand.so
2016-07-14 14:42:32 +03:00
CLEANFILES += tests/libreaddir-rand.so tests/ostree-symlink-stamp \
tests/ostree-prepare-root-symlink-stamp tests/ostree-remount-symlink-stamp \
tests/rofiles-fuse-symlink-stamp tests/ostree
2016-08-09 03:19:54 +03:00
CLEANFILES += tests/ostree-prepare-root tests/ostree-remount tests/rofiles-fuse
2016-05-11 22:54:48 +03:00
2016-07-15 18:17:43 +03:00
tests/%-symlink-stamp: % Makefile
$(AM_V_GEN) set -e; \
2016-07-14 14:42:32 +03:00
lt_bin=`cd $(top_builddir) && ./libtool --mode=execute echo $*`; \
if test "$${lt_bin}" = "$*"; then \
real_bin=$(abs_top_builddir)/$*; \
else \
real_bin="$${lt_bin}"; \
fi; \
ln -sf "$${real_bin}" tests/$*; \
2016-05-11 22:54:48 +03:00
touch $@
2016-03-28 15:46:23 +03:00
2017-05-08 17:44:43 +03:00
# See above comment on binding the tests to be either installed or not.
if ENABLE_INSTALLED_TESTS_EXCLUSIVE
dist_installed_test_scripts = $(_installed_or_uninstalled_test_scripts)
installed_test_programs = $(_installed_or_uninstalled_test_programs)
check-local:
2021-04-15 17:43:33 +03:00
echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed"
2017-05-08 17:44:43 +03:00
echo "NOTE: Exclusive installed tests are enabled; to run them, make install, then: gnome-desktop-testing-runner -p 0 libostree/"
else
2021-04-15 17:43:33 +03:00
check-local:
echo "NOTE: Run the Rust installed tests (uninstalled) with ./tests/run-installed"
2017-05-08 17:44:43 +03:00
dist_test_scripts += $(_installed_or_uninstalled_test_scripts)
test_programs += $(_installed_or_uninstalled_test_programs)
endif
2018-01-08 16:53:46 +03:00
if !USE_LIBSOUP
no-soup-for-you-warning:
@echo "WARNING: $(PACKAGE) was built without libsoup, which is currently" 1>&2
@echo "WARNING: required for many unit tests." 1>&2
sleep 10
check: no-soup-for-you-warning
endif
2016-03-02 18:28:04 +03:00
# 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.
2016-03-08 21:12:00 +03:00
if ENABLE_INSTALLED_TESTS
2016-12-08 05:26:43 +03:00
install-installed-tests-extra:
2016-03-02 18:28:04 +03:00
if test -L $(DESTDIR)$(installed_testdir)/tests; then \
rm $(DESTDIR)$(installed_testdir)/tests; \
fi
ln -s . $(DESTDIR)$(installed_testdir)/tests
2016-12-08 20:50:20 +03:00
if BUILDOPT_ASAN
sed -e 's,^BUILT_WITH_ASAN=.*,BUILT_WITH_ASAN=1,' < $(srcdir)/tests/libtest.sh > $(DESTDIR)$(installed_testdir)/tests/libtest.sh
else
install -m 0644 $(srcdir)/tests/libtest.sh $(DESTDIR)$(installed_testdir)/tests/libtest.sh
endif
2016-12-08 05:26:43 +03:00
INSTALL_DATA_HOOKS += install-installed-tests-extra
2016-03-08 21:12:00 +03:00
endif
2020-05-15 02:50:40 +03:00
# Just forward these
build-kola-tests:
$(MAKE) -C tests/kola
install-kola-tests:
$(MAKE) -C tests/kola install