Commit Graph

94 Commits

Author SHA1 Message Date
Simon McVittie
07aa8e1c76 Load g-i bindings from builddir during build-time testing
Previously, the build-time tests would only pass if the g-i bindings to
OSTree were already installed, with a reasonably similar version.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #232
Approved by: cgwalters
2016-03-31 14:22:06 +00:00
Simon McVittie
f8bef792cb Symlink libreaddir-rand.so into tests directory
This means it can be LD_PRELOADed during build-time testing.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #232
Approved by: cgwalters
2016-03-31 14:22:06 +00:00
Alexander Larsson
456f515522 Add --untrusted option to pull and pull-local
https://bugzilla.gnome.org/show_bug.cgi?id=764125

Closes: #221
Approved by: cgwalters
2016-03-25 12:56:55 +00:00
Colin Walters
f84c198006 tests: Add a test-abi
This would have caught a potential ABI regression in
https://bugzilla.gnome.org/show_bug.cgi?id=764056
(If we ran this test while building `--without-libarchive`)

Pull request: #218
Approved by: jlebon
2016-03-24 16:23:12 +00:00
Simon McVittie
3f6f2e2a2f test-libarchive: fix underlinking
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-03-21 13:03:06 -04:00
Colin Walters
f51d651b10 docs: Add a section on writing buildsystems
And add a test that is a demo buildsystem.
2016-03-16 17:15:58 -04:00
Colin Walters
6cc7238c4d build: Don't install test data without --enable-installed-tests
Otherwise $(installed_testdir) is empty so we try to put content in
`/`, which I noticed when trying to build an RPM (it works works fine
`sudo make install`).
2016-03-08 14:48:10 -05:00
Colin Walters
fea786cb2d lib: Add ostree_sysroot_load_if_changed() API
This will allow daemons like rpm-ostree to detect if there are any new
deployments efficiently, in combination with using inotify.  If there
are any changes, rpm-ostree wants publish them on DBus.

While we're here, add some changes to start doing unit C testing of
the sysroot API.
2016-03-03 21:56:23 -05:00
Colin Walters
ebd0370976 tests: Unify some tmpdir code, add ability for C to use libtest.sh
I want to be able to easily test the C API on actual data in an OSTree
repo.  The shell `libtest.sh` has code to generate it.  Bridge the two
worlds by introducing a little `libostreetest` library which has a C
API which spawns a shell that runs things in `libtest.sh`.

Yes, this is about as beautiful as it sounds, which is to say, it's
not.  But it works!

Note while we were here, I realized we were actually now creating
*two* tmpdirs per test in `make check` because the tap driver was
already doing that.  Unify it so we know the C code can rely on it.
2016-03-03 18:03:32 -05:00
Colin Walters
d25212f04a 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.
2016-03-03 08:50:19 -05:00
Giuseppe Scrivano
c9b02ae1f3 refs: add tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2016-03-02 14:52:02 -05:00
Colin Walters
7fdf072710 deltas: Heuristically detect endianness for older deltas
If the average object size is greater than 4GiB, let's assume we're
dealing with opposite endianness.  I'm fairly confident no one is
going to be shipping peta- or exa- byte size ostree deltas, period.
Past the gigabyte scale you really want bittorrent or something.
2016-02-26 08:19:01 -05:00
Colin Walters
3a555114bc repo: Add ostree_repo_import_archive_to_mtree
This is a more flexible version of the previous
ostree_repo_write_archive_to_mtree() which took a file reference.
This has an extensible options structure, and in particular
now supports `ignore_unsupported_content`.

I plan to use this for importing Docker images which contain device
nodes.  (There's no reason for container images to have those, so
we'll just ignore them).

Also here, just like the export variant, the caller is responsible for
setting up libarchive.
2016-02-19 08:54:04 -05:00
Colin Walters
355f8438ef Add an export builtin, and API to write to libarchive
At the moment I'm looking at using rpm-ostree to manage RPM inputs
which can then be converted into Docker images.  It's most convenient
if we can stream directly out of libostree rather than doing a
checkout + tar combination.

There are also backup/debugging etc. reasons to implement `export` as
well.
2016-02-14 09:53:01 -05:00
Colin Walters
e9ccdd2d00 Import rofiles-fuse
While it's not strictly tied to OSTree, let's move
https://github.com/cgwalters/rofiles-fuse in here because:

 - It's *very* useful in concert with OSTree
 - It's tiny
 - We can reuse OSTree's test, documentation, etc. infrastructure

One thing to consider also is that at some point we could experiment
with writing a FUSE filesystem for OSTree.  This could internalize a
better equivalent of `--link-checkout-speedup`, but on the other hand,
the cost of walking filesystem trees for these types of operations is
really quite small.

But if we did decide to do more FUSE things in OSTree, this is a step
towards that too.
2016-02-10 13:11:25 +01:00
Giuseppe Scrivano
438e21e858 tests: add tests for prune and tombstones commits
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-11-03 09:53:38 +01:00
Colin Walters
b6e2eaf212 tests: Add a test for pull+deploy of specific "bare" commit
This is the "pull an older version" that's now supported since
36d65b3cfc

https://github.com/GNOME/ostree/pull/145
2015-10-07 15:20:38 -04:00
Colin Walters
bab6503b69 sysroot: Cleanup refs and prune even on last undeployment
I was working on a different test, and ended up being very confused at
the behavior where removing the last deployment didn't remove the last
`ostree/X/X/X` ref pointing to its commit.

There's no reason to special case the last undeployment AFAIK, and the
existing code handles this.
2015-09-24 12:25:23 -04:00
Dan Nicholson
4f57aa5b15 tests: Build test-lzma with LZMA flags
test-lzma builds a copy of the compressor and decompressor directly, so
the compiler needs access to the LZMA headers and the linker needs to
link the program with liblzma.
2015-08-26 15:20:42 -04:00
Giuseppe Scrivano
863f5d8598 tests: Add tests for rollsum 2015-08-25 09:27:56 -04:00
Giuseppe Scrivano
9b9f4b04b4 tests: rename test-rollsum to test-rollsum-cli
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-08-24 11:07:36 +02:00
Giuseppe Scrivano
3861b79efd tests: add tests for LZMA compressor and decompressor
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-08-12 07:55:50 +02:00
Giuseppe Scrivano
11ba9056ea pull: new option --commit-metadata-only
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-07-24 12:43:35 -04:00
Dan Nicholson
5af7e8e8c2 pull-local: Support --depth option
Like pull, allow pull-local to mirror another another repository by
specifying how many parents to traverse.

https://bugzilla.gnome.org/show_bug.cgi?id=750581
2015-06-14 08:49:35 -04:00
Dan Nicholson
7aa23d53cd tests: Link test-gpg-verify-result with gpgme
This test uses gpgme directly to verify the signatures, so it needs to
find the gpgme headers and link with gpgme to ensure the linker can
resolve the symbols.
2015-06-04 18:16:00 -04:00
Colin Walters
92deafec46 tests: Run all tests through a randomized readdir()
Having undefined (but in practice rarely changing) ordering for
`readdir()` ended up screwing us over for bootloader config
generation; see https://bugzilla.redhat.com/show_bug.cgi?id=1226520

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.
2015-06-02 12:02:59 -04:00
Colin Walters
5ec148ec4d Revert "tests: Run all tests through a randomized readdir()"
Unintentionally pushed.

This reverts commit ce49264157.
2015-06-02 12:02:28 -04:00
Colin Walters
ee9b98e9d7 tests: Add a test-pull-summary-sigs
This is intended to cover non-mirroring usage of GPG + summary +
deltas.
2015-06-02 09:07:28 -04:00
Colin Walters
ce49264157 tests: Run all tests through a randomized readdir()
Having undefined ordering (but in practice rarely changing)
ordering for `readdir()` ended up screwing us over with respect
to bootloader config file read ordering.

Let's make things significantly more likely to fail more quickly in
the future if similar bugs are introduced.  We accomplish this by
introducing a little `LD_PRELOAD` library that randomizes the results
of `readdir()`.
2015-06-01 22:34:14 -04:00
Colin Walters
20bf7692a9 tests: Add a crosscheck for syslinux bootloader config generation
And actually wire this one up in admin-test.sh.
2015-05-28 14:21:30 -04:00
Matthew Barnes
06818ceddc tests: Add test-remote-gpg-import.sh 2015-05-13 13:08:49 -04:00
Giuseppe Scrivano
ae672c3c9f core: new function _ostree_parse_delta_name
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-07 21:58:04 +02:00
Colin Walters
5becd5ccad Teach fsck about partial commits
An OSTree user noticed that `ostree fsck` would produce `missing
object` errors in the case of interrupted pulls.

It's possible to do e.g. `ostree pull --subpath=/usr/share/rpm ...`,
which gets you just that portion of the commit.  The use case for this
was being able to see what changes would appear in an update before
actually downloading all of it.

(I think this would be better covered by static deltas, but those
 aren't final yet, and `--subpath` predates it)

Further, `.commitpartial` is used as a successor to the `transaction`
symlink for more precise knowledge in the case where a pull was
interrupted that we needed to resume scanning.

So it makes sense for `ostree fsck` to be aware of it.
2015-05-06 08:07:20 -04:00
Colin Walters
9ef98fd05a sysroot: Add an API to lock
If a system administrator happens to type `ostree admin upgrade`
multiple times, currently that will lead to a potentially corrupted
system.

I originally attempted to do locking *internally* in `libostree`, but
that didn't work out because currently a number of the commands
perform multi-step operations that all need to be serialized.  All of
the current code in `ostree admin deploy` is an example.

Therefore, allow callers to perform locking, as most of the higher
level logic is presently implemented there.

At some point, we can revisit having internal locking, but it will be
difficult.  A more likely approach would be similar to Java's approach
with concurrency on iterators - a "fail fast" method.
2015-05-05 08:52:44 -04:00
Matthew Barnes
97379ec38c libotutil: Add ot_gpgme_ctx_tmp_home_dir()
Currently used for signature verification, will also be used for
importing GPG keys.
2015-05-01 10:21:40 -04:00
Colin Walters
ab15eafe56 reset: Don't enforce parent commits
First, git doesn't do this, and whatever Linus thinks is right or
something.

Second specifically to OSTree, it's quite common to not have
intermediate commits.  If one wants to reset a ref in order to prune
data after a deployment, the parentage check will fail.

Closes: https://github.com/GNOME/ostree/pull/87
2015-04-15 07:12:20 -04:00
Giuseppe Scrivano
9e6ac6d822 config: add new parameter "commit-update-summary" to core section
When set to true, the summary file is automatically updated after
a commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-14 17:46:53 +02:00
Daniel Svensson
f01fceb5d7 tests: Missing linker flags for test-rollsum
Reproducable on Debian; Fedora lets it slide.
2015-04-06 10:29:07 -04:00
Matthew Barnes
4a2733f9e7 gpg: Add OstreeGpgVerifyResult
Wrappers a referenced gpgme_verify_result_t so detailed verify results
can be examined independently of executing a verify operation.

_ostree_gpg_verifier_check_signature() now returns this object instead
of a single valid/invalid boolean, but the idea is for OstreeRepo to also
return this object for commit signature verification so it can be utilized
at the CLI layer (and possibly by other programs).
2015-03-18 11:52:22 -04:00
Giuseppe Scrivano
3f3096a65c tests: Add tests for test-ot-tool-util
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
c1c34c601a tests: add test for test-ot-opt-utils.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:38 +01:00
Giuseppe Scrivano
50c69c3392 keyfile-utils: add tests
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 18:45:37 +01:00
Giuseppe Scrivano
d414ee5852 tests: add tests for mutable tree.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-04 17:52:17 -05:00
Giuseppe Scrivano
aeafdfff05 tests: Remove some duplications from Makefile-tests.am
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-03 18:32:24 -05:00
Giuseppe Scrivano
6029f4d820 tests: add test for bsdiff
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-03 12:16:17 -05:00
Giuseppe Scrivano
ef53e0100b tests: do not run tests/test-rollsum as part of make check
it is not really a unit test.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Conflicts:
	Makefile-tests.am
2015-02-21 17:19:20 -05:00
Colin Walters
c2d439f115 tests: Restore accidentally deleted Makefile bit
Not sure how this got deleted...
2015-02-16 10:29:14 -05:00
Colin Walters
9aa7e30b38 deltas: Implement rollsums
This does an rsync-style prepared delta basically.  On my test data,
it shaves ~6MB of uncompressed data.  Not a huge amount, but I expect
this to be more useful for things like binaries which embed data, etc.
2015-02-16 10:10:35 -05:00
Giuseppe Scrivano
cfc344fbb0 tests: Add tests for ot-unix-utils
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:42:41 +01:00
Giuseppe Scrivano
53122dd2f9 tests: Move test-varint and test-rollsum under "make check"
"make check" tests are always enabled and they do not require to be
installed.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-02 17:14:52 +01:00