summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-05-17 10:50:02 +0200
committerAlexander Larsson <alexl@redhat.com>2016-05-17 10:50:02 +0200
commit6b4e5dd9039b3ff8a6ea880b67524d2df9eab096 (patch)
tree53c48fbdf2c5ffd42bde9516ff015439dfabb1d8
parentc432c417c241abc2f6ec45f3e504a37ec913f36a (diff)
downloadxdg-app-6b4e5dd9039b3ff8a6ea880b67524d2df9eab096.tar.gz
tests: Put --user in an env var
This means we can optionally skip it
-rw-r--r--tests/libtest.sh10
-rwxr-xr-xtests/test-builder.sh4
-rwxr-xr-xtests/test-run.sh28
3 files changed, 22 insertions, 20 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 74ef142..f699e07 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -30,6 +30,8 @@ else
test_builddir=$(dirname $0)
fi
+export U=${U-"--user"}
+
assert_not_reached () {
echo $@ 1>&2; exit 1
}
@@ -146,7 +148,7 @@ assert_file_empty() {
setup_repo () {
. $(dirname $0)/make-test-runtime.sh org.test.Platform bash ls cat echo readlink > /dev/null
. $(dirname $0)/make-test-app.sh > /dev/null
- flatpak remote-add --user --no-gpg-verify test-repo repo
+ flatpak remote-add ${U} --no-gpg-verify test-repo repo
}
make_updated_app () {
@@ -159,12 +161,12 @@ setup_sdk_repo () {
install_repo () {
- ${FLATPAK} --user install test-repo org.test.Platform master
- ${FLATPAK} --user install test-repo org.test.Hello master
+ ${FLATPAK} ${U} install test-repo org.test.Platform master
+ ${FLATPAK} ${U} install test-repo org.test.Hello master
}
install_sdk_repo () {
- ${FLATPAK} --user install test-repo org.test.Sdk master
+ ${FLATPAK} ${U} install test-repo org.test.Sdk master
}
run () {
diff --git a/tests/test-builder.sh b/tests/test-builder.sh
index dcbe586..01195b7 100755
--- a/tests/test-builder.sh
+++ b/tests/test-builder.sh
@@ -51,7 +51,7 @@ assert_file_has_content hello_out2 '^Hello world2, from a sandbox$'
echo "ok build"
-${FLATPAK} --user install test-repo org.test.Hello2 master
+${FLATPAK} ${U} install test-repo org.test.Hello2 master
run org.test.Hello2 > hello_out3
assert_file_has_content hello_out3 '^Hello world2, from a sandbox$'
@@ -64,7 +64,7 @@ echo "version2" > app-data
flatpak-builder --repo=$REPO --force-clean appdir test.json > /dev/null
assert_file_has_content appdir/files/share/app-data version2
-${FLATPAK} --user update org.test.Hello2 master
+${FLATPAK} ${U} update org.test.Hello2 master
run --command=cat org.test.Hello2 /app/share/app-data > app_data_2
assert_file_has_content app_data_2 version2
diff --git a/tests/test-run.sh b/tests/test-run.sh
index 6a62dd7..00a2769 100755
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -49,14 +49,14 @@ assert_file_has_content $USERDIR/exports/share/applications/mimeinfo.cache x-tes
assert_has_file $USERDIR/exports/share/icons/hicolor/icon-theme.cache
assert_has_file $USERDIR/exports/share/icons/hicolor/index.theme
-$FLATPAK list --user | grep org.test.Hello > /dev/null
-$FLATPAK list --user -d | grep org.test.Hello | grep test-repo > /dev/null
-$FLATPAK list --user -d | grep org.test.Hello | grep current > /dev/null
-$FLATPAK list --user -d | grep org.test.Hello | grep ${ID:0:12} > /dev/null
+$FLATPAK list ${U} | grep org.test.Hello > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep test-repo > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep current > /dev/null
+$FLATPAK list ${U} -d | grep org.test.Hello | grep ${ID:0:12} > /dev/null
-$FLATPAK info --user org.test.Hello > /dev/null
-$FLATPAK info --user org.test.Hello | grep test-repo > /dev/null
-$FLATPAK info --user org.test.Hello | grep $ID > /dev/null
+$FLATPAK info ${U} org.test.Hello > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep test-repo > /dev/null
+$FLATPAK info ${U} org.test.Hello | grep $ID > /dev/null
echo "ok install"
@@ -89,12 +89,12 @@ ARGS="--filesystem=host" run_sh cat $(dirname $0)/package_version.txt > /dev/nul
echo "ok namespaces"
-$FLATPAK override --user --filesystem=host org.test.Hello
+$FLATPAK override ${U} --filesystem=host org.test.Hello
run_sh cat $(dirname $0)/package_version.txt &> /dev/null
if ARGS="--nofilesystem=host" run_sh cat $(dirname $0)/package_version.txt &> /dev/null; then
assert_not_reached "Unexpectedly allowed to access --nofilesystem=host file"
fi
-$FLATPAK override --user --nofilesystem=host org.test.Hello
+$FLATPAK override ${U} --nofilesystem=host org.test.Hello
if run_sh cat $(dirname $0)/package_version.txt &> /dev/null; then
assert_not_reached "Unexpectedly allowed to access file"
@@ -103,17 +103,17 @@ fi
echo "ok overrides"
-OLD_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
-${FLATPAK} --user update org.test.Hello
-ALSO_OLD_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
+OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
+${FLATPAK} ${U} update org.test.Hello
+ALSO_OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
make_updated_app
-${FLATPAK} --user update org.test.Hello
+${FLATPAK} ${U} update org.test.Hello
-NEW_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
+NEW_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
assert_not_streq "$OLD_COMMIT" "$NEW_COMMIT"