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
This commit is contained in:
Matthew Leeds
2019-03-26 17:02:36 -07:00
committed by Atomic Bot
parent 1ce532dad7
commit 3d74d4b37f
10 changed files with 109 additions and 98 deletions

View File

@@ -143,7 +143,7 @@ tests/test-%.wrap:
tests/runtime-repo: tests/make-test-runtime.sh flatpak
rm -rf tests/runtime-repo
PATH=$(abs_top_builddir):$${PATH} $(top_srcdir)/tests/make-test-runtime.sh tests/runtime-repo org.test.Platform ""
PATH=$(abs_top_builddir):$${PATH} $(top_srcdir)/tests/make-test-runtime.sh tests/runtime-repo org.test.Platform master ""
check_DATA += tests/runtime-repo

View File

@@ -198,16 +198,18 @@ export FL_GPG_BASE642="mQENBFkSyx4BCACq/8XFcF+NTpJKfoo8F6YyR8RQXww6kCV47zN78Dt7a
make_runtime () {
REPONAME="$1"
COLLECTION_ID="$2"
GPGARGS="$3"
BRANCH="$3"
GPGARGS="$4"
if [ -d ${test_builddir}/runtime-repo ]; then
RUNTIME_REF="runtime/org.test.Platform/$(flatpak --default-arch)/${BRANCH}"
if [ -f ${test_builddir}/runtime-repo/${RUNTIME_REF} ]; then
RUNTIME_REPO=${test_builddir}/runtime-repo
else
RUNTIME_REPO=${TEST_DATA_DIR}/runtime-repo
(
flock -s 200
if [ ! -d ${RUNTIME_REPO} ]; then
$(dirname $0)/make-test-runtime.sh ${RUNTIME_REPO} org.test.Platform "" > /dev/null
$(dirname $0)/make-test-runtime.sh ${RUNTIME_REPO} org.test.Platform ${BRANCH} "" > /dev/null
fi
) 200>${TEST_DATA_DIR}/runtime-repo-lock
fi
@@ -222,7 +224,7 @@ make_runtime () {
ostree --repo=repos/${REPONAME} init --mode=archive-z2 ${collection_args}
fi
flatpak build-commit-from --disable-fsync --src-repo=${RUNTIME_REPO} --force ${GPGARGS} repos/${REPONAME} runtime/org.test.Platform/$(flatpak --default-arch)/master
flatpak build-commit-from --disable-fsync --src-repo=${RUNTIME_REPO} --force ${GPGARGS} repos/${REPONAME} ${RUNTIME_REF}
}
setup_repo_no_add () {
@@ -232,9 +234,10 @@ setup_repo_no_add () {
else
COLLECTION_ID=
fi
BRANCH=${3:-master}
make_runtime "${REPONAME}" "${COLLECTION_ID}" "${GPGARGS:-${FL_GPGARGS}}"
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh repos/${REPONAME} "" "${COLLECTION_ID}" > /dev/null
make_runtime "${REPONAME}" "${COLLECTION_ID}" "${BRANCH}" "${GPGARGS:-${FL_GPGARGS}}"
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh repos/${REPONAME} "" "${BRANCH}" "${COLLECTION_ID}" > /dev/null
update_repo $REPONAME "${COLLECTION_ID}"
if [ $REPONAME == "test" ]; then
$(dirname $0)/test-webserver.sh repos
@@ -284,8 +287,9 @@ make_updated_app () {
else
COLLECTION_ID=""
fi
BRANCH=${3:-master}
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh repos/${REPONAME} "" "${COLLECTION_ID}" ${3:-UPDATED} > /dev/null
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-app.sh repos/${REPONAME} "" "${BRANCH}" "${COLLECTION_ID}" ${4:-UPDATED} > /dev/null
update_repo $REPONAME "${COLLECTION_ID}"
}
@@ -296,20 +300,23 @@ setup_sdk_repo () {
else
COLLECTION_ID=""
fi
BRANCH=${3:-master}
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh repos/${REPONAME} org.test.Sdk "${COLLECTION_ID}" make mkdir cp touch > /dev/null
GPGARGS="${GPGARGS:-${FL_GPGARGS}}" . $(dirname $0)/make-test-runtime.sh repos/${REPONAME} org.test.Sdk "${BRANCH}" "${COLLECTION_ID}" make mkdir cp touch > /dev/null
update_repo $REPONAME "${COLLECTION_ID}"
}
install_repo () {
REPONAME=${1:-test}
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Platform master
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Hello master
BRANCH=${2:-master}
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Platform ${BRANCH}
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Hello ${BRANCH}
}
install_sdk_repo () {
REPONAME=${1:-test}
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Sdk master
BRANCH=${2:-master}
${FLATPAK} ${U} install -y ${REPONAME}-repo org.test.Sdk ${BRANCH}
}
run () {

View File

@@ -40,7 +40,7 @@ for i in {1..3}; do
APP_ID=org.test.Hello${i}
COLLECTION_ID=${COLLECTION_ID_PREFIX}${i}
$(dirname $0)/make-test-app.sh repos/${APP_REPO} ${APP_ID} ${COLLECTION_ID}
$(dirname $0)/make-test-app.sh repos/${APP_REPO} ${APP_ID} master ${COLLECTION_ID}
ref=$(ostree --repo=${APP_REPO_DIR} refs | grep ${APP_ID})
ostree --repo=${REPO_DIR} remote add --no-gpg-verify --collection-id=${COLLECTION_ID} ${APP_REPO} file://${APP_REPO_DIR}

View File

@@ -8,6 +8,8 @@ REPO=$1
shift
APP_ID=$1
shift
BRANCH=$1
shift
COLLECTION_ID=$1
shift
@@ -23,8 +25,8 @@ ARCH=`flatpak --default-arch`
cat > ${DIR}/metadata <<EOF
[Application]
name=$APP_ID
runtime=org.test.Platform/$ARCH/master
sdk=org.test.Platform/$ARCH/master
runtime=org.test.Platform/$ARCH/$BRANCH
sdk=org.test.Platform/$ARCH/$BRANCH
[Extension org.test.Hello.Locale]
directory=share/runtime/locale
@@ -96,7 +98,7 @@ ln -s -t ${DIR}/files/share/locale ../../share/runtime/locale/fr/share/fr
flatpak build-finish --command=hello.sh ${DIR}
mkdir -p repos
flatpak build-export --disable-sandbox ${collection_args} ${GPGARGS-} ${EXPORT_ARGS-} ${REPO} ${DIR}
flatpak build-export --disable-sandbox ${collection_args} ${GPGARGS-} ${EXPORT_ARGS-} ${REPO} ${DIR} ${BRANCH}
rm -rf ${DIR}
# build a locale extension
@@ -109,7 +111,7 @@ cat > ${DIR}/metadata <<EOF
name=${APP_ID}.Locale
[ExtensionOf]
ref=app/$APP_ID/$ARCH/master
ref=app/$APP_ID/$ARCH/$BRANCH
EOF
cat > de.po <<EOF
@@ -127,7 +129,7 @@ msgfmt --output-file ${DIR}/files/fr/share/fr/LC_MESSAGES/helloworld.mo fr.po
flatpak build-finish ${DIR}
mkdir -p repos
flatpak build-export --runtime ${collection_args} ${GPGARGS-} ${EXPORT_ARGS-} ${REPO} ${DIR}
flatpak build-export --runtime ${collection_args} ${GPGARGS-} ${EXPORT_ARGS-} ${REPO} ${DIR} ${BRANCH}
rm -rf ${DIR}

View File

@@ -11,6 +11,8 @@ REPO=$1
shift
ID=$1
shift
BRANCH=$1
shift
COLLECTION_ID=$1
shift
@@ -85,5 +87,5 @@ else
fi
mkdir -p repos
flatpak build-export ${collection_args} --disable-sandbox --runtime ${GPGARGS-} ${REPO} ${DIR}
flatpak build-export ${collection_args} --disable-sandbox --runtime ${GPGARGS-} ${REPO} ${DIR} ${BRANCH}
rm -rf ${DIR}

View File

@@ -147,7 +147,7 @@ assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
echo "ok update"
make_updated_app test org.test.Collection.test UPDATED2
make_updated_app test org.test.Collection.test master UPDATED2
${FLATPAK} build-bundle repos/test --repo-url=file://`pwd`/repos/test --gpg-keys=${FL_GPG_HOMEDIR}/pubring.gpg bundles/hello2.flatpak org.test.Hello
assert_has_file bundles/hello2.flatpak

View File

@@ -95,8 +95,8 @@ EOF
mkdir -p repos
ostree init --repo=repos/test --mode=archive-z2
. $(dirname $0)/make-test-runtime.sh repos/test org.test.Platform "" bash ls cat echo readlink > /dev/null
. $(dirname $0)/make-test-app.sh repos/test "" "" > /dev/null
. $(dirname $0)/make-test-runtime.sh repos/test org.test.Platform master "" bash ls cat echo readlink > /dev/null
. $(dirname $0)/make-test-app.sh repos/test "" master "" > /dev/null
# Modify platform metadata
ostree checkout -U --repo=repos/test runtime/org.test.Platform/${ARCH}/master platform

View File

@@ -274,7 +274,7 @@ ${FLATPAK} ${U} install -y test-repo org.test.Platform
port=$(cat httpd-port-main)
UPDATE_REPO_ARGS="--redirect-url=http://127.0.0.1:${port}/test-gpg3 --gpg-import=${FL_GPG_HOMEDIR2}/pubring.gpg" update_repo
GPGPUBKEY="${FL_GPG_HOMEDIR2}/pubring.gpg" GPGARGS="${FL_GPGARGS2}" setup_repo_no_add test-gpg3 org.test.Collection.test
GPGPUBKEY="${FL_GPG_HOMEDIR2}/pubring.gpg" GPGARGS="${FL_GPGARGS2}" setup_repo_no_add test-gpg3 org.test.Collection.test master
${FLATPAK} ${U} update -y org.test.Platform
# Ensure we have the new uri
@@ -282,7 +282,7 @@ ${FLATPAK} ${U} remotes -d | grep ^test-repo > repo-info
assert_file_has_content repo-info "/test-gpg3"
# Make sure we also get new installs from the new repo
GPGARGS="${FL_GPGARGS2}" make_updated_app test-gpg3 org.test.Collection.test
GPGARGS="${FL_GPGARGS2}" make_updated_app test-gpg3 org.test.Collection.test master
update_repo test-gpg3 org.test.Collection.test
${FLATPAK} ${U} install -y test-repo org.test.Hello

View File

@@ -25,24 +25,24 @@ skip_without_bwrap
echo "1..13"
setup_repo
install_repo
setup_repo "" "" stable
install_repo "" stable
# Verify that app is correctly installed
assert_has_dir $FL_DIR/app/org.test.Hello
assert_has_symlink $FL_DIR/app/org.test.Hello/current
assert_symlink_has_content $FL_DIR/app/org.test.Hello/current ^$ARCH/master$
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master
assert_has_symlink $FL_DIR/app/org.test.Hello/$ARCH/master/active
ID=`readlink $FL_DIR/app/org.test.Hello/$ARCH/master/active`
assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/deploy
assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/master/active/metadata
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export
assert_symlink_has_content $FL_DIR/app/org.test.Hello/current ^$ARCH/stable$
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable
assert_has_symlink $FL_DIR/app/org.test.Hello/$ARCH/stable/active
ID=`readlink $FL_DIR/app/org.test.Hello/$ARCH/stable/active`
assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/stable/active/deploy
assert_has_file $FL_DIR/app/org.test.Hello/$ARCH/stable/active/metadata
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable/active/files
assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable/active/export
assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop
# Ensure Exec key is rewritten
assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=master --arch=$ARCH --command=hello.sh org.test.Hello$"
assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=stable --arch=$ARCH --command=hello.sh org.test.Hello$"
assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png
assert_not_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/dont-export.png
assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png
@@ -185,14 +185,14 @@ OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
# TODO: For weird reasons this breaks in the system case. Needs debugging
if [ x${USE_SYSTEMDIR-} != xyes ] ; then
${FLATPAK} ${U} update -y -v org.test.Hello master
${FLATPAK} ${U} update -y -v org.test.Hello stable
ALSO_OLD_COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Hello`
assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
fi
echo "ok null update"
make_updated_app
make_updated_app "" "" stable
${FLATPAK} ${U} update -y org.test.Hello
@@ -205,7 +205,7 @@ assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
echo "ok update"
ostree --repo=repos/test reset app/org.test.Hello/$ARCH/master "$OLD_COMMIT"
ostree --repo=repos/test reset app/org.test.Hello/$ARCH/stable "$OLD_COMMIT"
update_repo
if ${FLATPAK} ${U} update -y org.test.Hello; then
@@ -219,7 +219,7 @@ assert_streq "$NEW_COMMIT" "$NEW_NEW_COMMIT"
echo "ok backwards update"
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.Split org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.Split org.test.Platform org.test.Platform stable
mkdir -p ${DIR}/files/a
echo "a" > ${DIR}/files/a/data
@@ -232,10 +232,10 @@ echo "d" > ${DIR}/files/d/data
echo "nope" > ${DIR}/files/nope
${FLATPAK} build-finish --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
update_repo
${FLATPAK} ${U} install -y test-repo org.test.Split --subpath=/a --subpath=/b --subpath=/nosuchdir master
${FLATPAK} ${U} install -y test-repo org.test.Split --subpath=/a --subpath=/b --subpath=/nosuchdir stable
COMMIT=`${FLATPAK} ${U} info --show-commit org.test.Split`
if [ x${USE_SYSTEMDIR-} != xyes ] ; then
@@ -243,12 +243,12 @@ if [ x${USE_SYSTEMDIR-} != xyes ] ; then
assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
fi
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nosuchdir
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/b/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/d
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/nope
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/nosuchdir
echo "aa" > ${DIR}/files/a/data2
rm ${DIR}/files/a/data
@@ -258,7 +258,7 @@ mkdir -p ${DIR}/files/f
echo "f" > ${DIR}/files/f/data
rm -rf ${DIR}/files/b
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
update_repo
${FLATPAK} ${U} update -y --subpath=/a --subpath=/b --subpath=/e --subpath=/nosuchdir org.test.Split
@@ -269,16 +269,16 @@ if [ x${USE_SYSTEMDIR-} != xyes ] ; then
assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
fi
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data2
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/e/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/f
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/a/data2
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/b
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/d
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/e/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/f
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/nope
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
update_repo
# Test reusing the old subpath list
@@ -290,49 +290,49 @@ if [ x${USE_SYSTEMDIR-} != xyes ] ; then
assert_has_file $FL_DIR/repo/state/${COMMIT}.commitpartial
fi
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/a/data2
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/b
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/d
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/e/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/f
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/master/active/files/nope
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/a/data
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/a/data2
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/b
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/c
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/d
assert_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/e/data
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/f
assert_not_has_file $FL_DIR/app/org.test.Split/$ARCH/stable/active/files/nope
echo "ok subpaths"
VERSION=`cat "$test_builddir/package_version.txt"`
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.CurrentVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.CurrentVersion org.test.Platform org.test.Platform stable
${FLATPAK} build-finish --require-version=${VERSION} --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform stable
${FLATPAK} build-finish --require-version=0.6.10 --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.NewVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.NewVersion org.test.Platform org.test.Platform stable
${FLATPAK} build-finish --require-version=1${VERSION} --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
update_repo
${FLATPAK} ${U} install -y test-repo org.test.OldVersion master
${FLATPAK} ${U} install -y test-repo org.test.CurrentVersion master
(! ${FLATPAK} ${U} install -y test-repo org.test.NewVersion master)
${FLATPAK} ${U} install -y test-repo org.test.OldVersion stable
${FLATPAK} ${U} install -y test-repo org.test.CurrentVersion stable
(! ${FLATPAK} ${U} install -y test-repo org.test.NewVersion stable)
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform stable
${FLATPAK} build-finish --require-version=99.0.0 --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
(! ${FLATPAK} ${U} update -y org.test.OldVersion)
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform stable
${FLATPAK} build-finish --require-version=0.1.1 --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
${FLATPAK} ${U} update -y org.test.OldVersion
@@ -341,49 +341,49 @@ ${FLATPAK} ${U} update -y org.test.OldVersion
# and should not block a successful install of OldVersion later
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.CurrentVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.CurrentVersion org.test.Platform org.test.Platform stable
touch ${DIR}/files/updated
${FLATPAK} build-finish --require-version=99.0.0 --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
DIR=`mktemp -d`
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform
${FLATPAK} build-init ${DIR} org.test.OldVersion org.test.Platform org.test.Platform stable
touch ${DIR}/files/updated
${FLATPAK} build-finish --require-version=${VERSION} --command=hello.sh ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR}
${FLATPAK} build-export ${FL_GPGARGS} repos/test ${DIR} stable
if ${FLATPAK} ${U} update -y &> err_version.txt; then
assert_not_reached "Should not have been able to update due to version"
fi
assert_file_has_content err_version.txt "needs a later flatpak version"
assert_not_has_file $FL_DIR/app/org.test.CurrentVersion/$ARCH/master/active/files/updated
assert_has_file $FL_DIR/app/org.test.OldVersion/$ARCH/master/active/files/updated
assert_not_has_file $FL_DIR/app/org.test.CurrentVersion/$ARCH/stable/active/files/updated
assert_has_file $FL_DIR/app/org.test.OldVersion/$ARCH/stable/active/files/updated
echo "ok version checks"
rm -rf app
flatpak build-init app org.test.Writable org.test.Platform org.test.Platform
flatpak build-init app org.test.Writable org.test.Platform org.test.Platform stable
mkdir -p app/files/a-dir
chmod a+rwx app/files/a-dir
flatpak build-finish --command=hello.sh app
# Note: not --canonical-permissions
ostree --repo=repos/test commit --owner-uid=0 --owner-gid=0 --no-xattrs ${FL_GPGARGS} --branch=app/org.test.Writable/$ARCH/master app
ostree --repo=repos/test commit --owner-uid=0 --owner-gid=0 --no-xattrs ${FL_GPGARGS} --branch=app/org.test.Writable/$ARCH/stable app
update_repo
${FLATPAK} ${U} install -y test-repo org.test.Writable
assert_file_has_mode $FL_DIR/app/org.test.Writable/$ARCH/master/active/files/a-dir 775
assert_file_has_mode $FL_DIR/app/org.test.Writable/$ARCH/stable/active/files/a-dir 775
echo "ok no world writable dir"
rm -rf app
flatpak build-init app org.test.Setuid org.test.Platform org.test.Platform
flatpak build-init app org.test.Setuid org.test.Platform org.test.Platform stable
mkdir -p app/files/
touch app/files/exe
chmod u+s app/files/exe
flatpak build-finish --command=hello.sh app
# Note: not --canonical-permissions
ostree --repo=repos/test commit --owner-uid=0 --owner-gid=0 --no-xattrs ${FL_GPGARGS} --branch=app/org.test.Setuid/$ARCH/master app
ostree --repo=repos/test commit --owner-uid=0 --owner-gid=0 --no-xattrs ${FL_GPGARGS} --branch=app/org.test.Setuid/$ARCH/stable app
update_repo
if ${FLATPAK} ${U} install -y test-repo org.test.Setuid &> err2.txt; then
@@ -394,16 +394,16 @@ assert_file_has_content err2.txt [Ii]nvalid
echo "ok no setuid"
rm -rf app
flatpak build-init app org.test.App org.test.Platform org.test.Platform
flatpak build-init app org.test.App org.test.Platform org.test.Platform stable
mkdir -p app/files/
touch app/files/exe
flatpak build-finish --command=hello.sh --sdk=org.test.Sdk app
${FLATPAK} build-export ${FL_GPGARGS} repos/test app
${FLATPAK} build-export ${FL_GPGARGS} repos/test app stable
update_repo
${FLATPAK} ${U} install -y test-repo org.test.App
${FLATPAK} ${U} info -m org.test.App > out
assert_file_has_content out "^sdk=org.test.Sdk/$(flatpak --default-arch)/master$"
assert_file_has_content out "^sdk=org.test.Sdk/$(flatpak --default-arch)/stable$"
echo "ok --sdk option"

View File

@@ -1289,14 +1289,14 @@ make_test_runtime (const char *runtime_repo_name)
g_autofree char *arg0 = NULL;
g_autofree char *arg1 = NULL;
char *argv[] = {
NULL, NULL, "org.test.Platform", "", NULL
NULL, NULL, "org.test.Platform", "master", "", NULL
};
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-runtime.sh", NULL);
arg1 = g_strdup_printf ("repos/%s", runtime_repo_name);
argv[0] = arg0;
argv[1] = arg1;
argv[3] = repo_collection_id;
argv[4] = repo_collection_id;
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}
@@ -1306,13 +1306,13 @@ make_test_app (const char *app_repo_name)
{
g_autofree char *arg0 = NULL;
g_autofree char *arg1 = NULL;
char *argv[] = { NULL, NULL, "", "", NULL };
char *argv[] = { NULL, NULL, "", "master", "", NULL };
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-app.sh", NULL);
arg1 = g_strdup_printf ("repos/%s", app_repo_name);
argv[0] = arg0;
argv[1] = arg1;
argv[3] = repo_collection_id;
argv[4] = repo_collection_id;
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}
@@ -1321,11 +1321,11 @@ static void
update_test_app (void)
{
g_autofree char *arg0 = NULL;
char *argv[] = { NULL, "repos/test", "", "", "SPIN", NULL };
char *argv[] = { NULL, "repos/test", "", "master", "", "SPIN", NULL };
arg0 = g_test_build_filename (G_TEST_DIST, "make-test-app.sh", NULL);
argv[0] = arg0;
argv[3] = repo_collection_id;
argv[4] = repo_collection_id;
run_test_subprocess (argv, RUN_TEST_SUBPROCESS_DEFAULT);
}