tests: Add test for update

tingping/wmclass
Alexander Larsson 2016-05-17 10:32:29 +02:00
parent 3b291090c7
commit c432c417c2
3 changed files with 28 additions and 2 deletions

View File

@ -149,6 +149,10 @@ setup_repo () {
flatpak remote-add --user --no-gpg-verify test-repo repo
}
make_updated_app () {
. $(dirname $0)/make-test-app.sh UPDATED > /dev/null
}
setup_sdk_repo () {
. $(dirname $0)/make-test-runtime.sh org.test.Sdk bash ls cat echo readlink make mkdir cp touch > /dev/null
}

View File

@ -4,13 +4,15 @@ set -e
DIR=`mktemp -d`
EXTRA="${1-}"
# Init dir
flatpak build-init ${DIR} org.test.Hello org.test.Platform org.test.Platform
mkdir -p ${DIR}/files/bin
cat > ${DIR}/files/bin/hello.sh <<EOF
#!/bin/sh
echo "Hello world, from a sandbox"
echo "Hello world, from a sandbox$EXTRA"
EOF
chmod a+x ${DIR}/files/bin/hello.sh

View File

@ -21,7 +21,7 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
echo "1..5"
echo "1..6"
setup_repo
install_repo
@ -101,3 +101,23 @@ if run_sh cat $(dirname $0)/package_version.txt &> /dev/null; then
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`
assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
make_updated_app
${FLATPAK} --user update org.test.Hello
NEW_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
assert_not_streq "$OLD_COMMIT" "$NEW_COMMIT"
run org.test.Hello > hello_out
assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
echo "ok update"