Commit Graph

26 Commits

Author SHA1 Message Date
Alexander Larsson
c15c1946ff test: Add test for update-portal monitoring
We add socat to the test runtime, and then we use that to run a
test app outside the sandbox as if it was inside.

The testcase connects creates a monitor and ensure we properly get signals
for updates.
2019-10-02 14:57:11 +02:00
Alexander Larsson
8832e7c7d1 Make test output a bit less noicy
This gets rid of some unnecessary spew that happens in every
test run and just makes the logs harder to read.
2019-10-02 14:57:11 +02:00
Matthew Leeds
803fa15b06 tests: Consistently use a bash shebang
There's not much point in using /bin/bash for all but three scripts and
using /bin/sh for those, so use bash for everything.

Closes: #2705
Approved by: alexlarsson
2019-05-09 09:12:26 +00:00
Matthew Leeds
3d74d4b37f tests: Add ability to test a branch other than master
This commit makes it so that a unit test can create the test app and
runtime using a branch other than master, and changes test-run.sh to use
the branch "stable". This will allow the run command to be tested better
in the following commit.

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Simon McVittie
2184205801 make-test-*: Don't sandbox the icon validator
During build-time tests, bwrap doesn't necessarily work. In particular,
official Debian autobuilders can't enter namespaces.

We continue to leave the sandbox enabled in the build-export calls in
tests/test-extensions.sh, tests/test-unsigned-summaries.sh
and tests/test-update-remote-configuration.sh, which are already
skipped if bwrap isn't available. This means we exercise both the
normal and --disable-sandbox code paths.

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

Closes: #2661
Approved by: alexlarsson
2019-01-31 14:02:24 +00:00
Alexander Larsson
6af4d7d3fe tests: Move basic binary list into make-test-runtime.sh
Rather than specify this in multiple places we now list the most
core binaries needed for the tests inside the script.

Closes: #2188
Approved by: alexlarsson
2018-10-05 11:43:12 +00:00
Alexander Larsson
df93c9b563 tests: Make make-test-{app,runtime}.sh take repo, not repo name
Later we want to use these outside the test suite, and then we
might not use the same repo naming.

Closes: #2188
Approved by: alexlarsson
2018-10-05 11:43:12 +00:00
Simon McVittie
bf31305618 tests: Remove vestigial support for putting Python 2 in a runtime
This is only used in the flatpak-builder tests now, not the main
flatpak tests.

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

Closes: #1990
Approved by: alexlarsson
2018-08-27 10:36:28 +00:00
Alexander Larsson
9757e4883e tests: Hacks to handle coreutils-single
In the Fedora 28 base container, `coreutils-single` is used and so
`/usr/bin/ls` is actually a "script":

```
$ file /usr/bin/ls
/usr/bin/ls: a /usr/bin/coreutils --coreutils-prog-shebang=ls script, ASCII text executable
```

We handle this by detecting shebangs in dependencies and recursively adding them.

Closes: #1741
Approved by: alexlarsson
2018-05-31 14:34:49 +00:00
Simon McVittie
cce2a8dd78 make-test-runtime: Look in /{usr/,}sbin for ldconfig
Under normal circumstances ldconfig isn't required to be in ordinary
users' PATHs, but running this script is not a normal circumstance.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1630
Approved by: alexlarsson
2018-05-02 12:25:54 +00:00
Alexander Larsson
e7e1331653 Make tests work on debian
The regular ldconfig is some bash wrapper over /sbin/ldconfig.real
2017-10-09 15:45:25 +02:00
Valentin David
845a0b3bf7 Use ld.so.cache instead of LD_LIBRARY_PATH (when not building)
Instead of setting LD_LIBRARY_PATH to make the app load the right
libraries we run ldconfig to generate a ld.so.cache that we feed
to the sandbox as /etc/ld.so.cache. The cache itself is generated
by running ldconfig at run time, but for apps we cache the
result in $HOME/.var/app/$APPID/.ld.so/cache based on the
current app/runtime/extensions commit ids.

We also unset LD_LIBRARY_PATH, to ensure any host-side value
does not mess with the sandbox.

The default ld.so.conf we set (if the runtime has none, or an empty
one) is:

 include /run/flatpak/ld.so.conf.d/*.conf
 include /app/etc/ld.so.conf
 /app/lib

Additionally all the extension points that have add_ld_path set gets a
ld.so.conf snippet in /run/flatpak/ld.so.conf.d.

This allows applications and extensions to install their own paths if
needed, and if the runtime wants more location they can install a
custom ld.so.conf that includes the above.

In the flatpak build case we still use LD_LIBRARY_PATH like before,
because there is no good key (like the commit ids) for keeping the
cache up-to-date. Also, the behaviour is different when building an
app for instance. If /app/lib is not in LD_LIBRARY_PATH then the
sandbox-wide /etc/ld.so.cache must be updated for a newly installed
library to work, but the sandbox is not allowed to update
/etc/ld.so.cache.

This code was originally written by Valentin David <valentin.david@gmail.com>
with changes by Alexander Larsson <alexl@redhat.com>.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
Philip Withnall
9989188a1e tests: Add support for collection IDs to test-repo.sh
This adds variable support for collection IDs: they can either be
enabled on the server, on the server and client, or not at all. If
enabled on the server, apps and runtimes are built with collection IDs
and the repository has one set. If enabled on the client, the remote
config is added to the local repository with a collection ID and GPG
verification enabled. They are controlled with
USE_COLLECTIONS_IN_{SERVER,CLIENT}={yes,no}.

These variables are used in the new wrapper tests,
test-repo-collections.sh and test-repo-collections-server-only.sh.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Alexander Larsson
99a6200cab tests: Make it possible to create multiple test repos 2017-05-10 11:54:27 +02:00
Alexander Larsson
b8c3b5aa44 Fix tests now that build-init requires the runtime to be installed 2017-01-27 13:56:04 +01:00
Alexander Larsson
0fb2f362a8 tests: Move the test repo to a subdirectory (repos/test)
This makes the ostree trivial-httpd --autoexit feature work better,
because it seems to exit whenever the root directory changes (i.e. not
only when its deleted).

This means the root dir can't be the repo (because then we can't
update the repo), or the base testdir (because we create files there
too), so instead we make the repo $testdir/repos/test and
$testdir/repos as the httpd root.
2017-01-12 00:04:36 +01:00
Simon McVittie
9f52d50448 make-test-runtime: cope with Debian's Python 2.7 configuration
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-07 17:02:53 +01:00
Alexander Larsson
42fae1c5d1 tests: Fix python2 use 2016-08-22 14:43:16 +02:00
Alexander Larsson
9c57a5751e Add test for python .pyc/.pyo rewriting
This catches regressions in the fix in the previous commit, where old
stale .py[oc] files can wrongly become "unstale" when we change the
.py file mtime to 1.
2016-08-10 16:24:18 +02:00
Alexander Larsson
f36a57b3b1 tests: Use gpg signatures during test 2016-05-17 13:04:44 +02:00
Alexander Larsson
605b3f4e09 tests: Add an en_US locale to the test runtime 2016-05-09 13:10:13 +02:00
Alexander Larsson
8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson
dcfb950c31 make-test-runtime.sh: Make this a bit more generic
We pass the id and contents on the commandline
2016-05-02 14:15:32 +02:00
Alexander Larsson
e5fad0714e tests: Add namespace and overrides tests 2016-05-02 11:41:32 +02:00
Alexander Larsson
327f432219 tests: Add a basic test that just runs an app 2016-04-27 21:23:42 +02:00
Alexander Larsson
0e595519c1 Add test scripts that create trivial a runtime and app 2016-02-25 15:14:57 +01:00