tests: Put --user in an env var

This means we can optionally skip it
tingping/wmclass
Alexander Larsson 2016-05-17 10:50:02 +02:00
parent c432c417c2
commit 6b4e5dd903
3 changed files with 22 additions and 20 deletions

View File

@ -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 () {

View File

@ -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

View File

@ -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"