Blame tests/test-builder.sh

rpm-build c487f7
#!/bin/bash
rpm-build c487f7
#
rpm-build c487f7
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
rpm-build c487f7
#
rpm-build c487f7
# This library is free software; you can redistribute it and/or
rpm-build c487f7
# modify it under the terms of the GNU Lesser General Public
rpm-build c487f7
# License as published by the Free Software Foundation; either
rpm-build c487f7
# version 2 of the License, or (at your option) any later version.
rpm-build c487f7
#
rpm-build c487f7
# This library is distributed in the hope that it will be useful,
rpm-build c487f7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
rpm-build c487f7
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
rpm-build c487f7
# Lesser General Public License for more details.
rpm-build c487f7
#
rpm-build c487f7
# You should have received a copy of the GNU Lesser General Public
rpm-build c487f7
# License along with this library; if not, write to the
rpm-build c487f7
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
rpm-build c487f7
# Boston, MA 02111-1307, USA.
rpm-build c487f7
rpm-build c487f7
set -euo pipefail
rpm-build c487f7
rpm-build c487f7
. $(dirname $0)/libtest.sh
rpm-build c487f7
rpm-build c487f7
skip_without_fuse
rpm-build c487f7
rpm-build c487f7
echo "1..4"
rpm-build c487f7
rpm-build c487f7
setup_repo
rpm-build c487f7
install_repo
rpm-build c487f7
setup_sdk_repo
rpm-build c487f7
install_sdk_repo
rpm-build c487f7
rpm-build c487f7
# Need /var/tmp cwd for xattrs
rpm-build c487f7
REPO=`pwd`/repos/test
rpm-build c487f7
cd $TEST_DATA_DIR/
rpm-build c487f7
rpm-build c487f7
cp -a $(dirname $0)/test-configure .
rpm-build c487f7
echo "version1" > app-data
rpm-build c487f7
cp $(dirname $0)/test.json .
rpm-build c487f7
cp $(dirname $0)/test.yaml .
rpm-build c487f7
cp $(dirname $0)/test-runtime.json .
rpm-build c487f7
cp $(dirname $0)/0001-Add-test-logo.patch .
rpm-build c487f7
mkdir include1
rpm-build c487f7
cp $(dirname $0)/module1.json include1/
rpm-build c487f7
cp $(dirname $0)/module1.yaml include1/
rpm-build c487f7
cp $(dirname $0)/data1 include1/
rpm-build c487f7
cp $(dirname $0)/data1.patch include1/
rpm-build c487f7
mkdir include1/include2
rpm-build c487f7
cp $(dirname $0)/module2.json include1/include2/
rpm-build c487f7
cp $(dirname $0)/module2.yaml include1/include2/
rpm-build c487f7
cp $(dirname $0)/data2 include1/include2/
rpm-build c487f7
cp $(dirname $0)/data2.patch include1/include2/
rpm-build c487f7
${FLATPAK_BUILDER} --repo=$REPO $FL_GPGARGS --force-clean appdir test.json
rpm-build c487f7
${FLATPAK_BUILDER} --repo=$REPO $FL_GPGARGS --force-clean appdir test.yaml
rpm-build c487f7
rpm-build c487f7
assert_file_has_content appdir/files/share/app-data version1
rpm-build c487f7
assert_file_has_content appdir/metadata shared=network;
rpm-build c487f7
assert_file_has_content appdir/metadata tags=test;
rpm-build c487f7
assert_file_has_content appdir/files/ran_module1 module1
rpm-build c487f7
assert_file_has_content appdir/files/ran_module2 module2
rpm-build c487f7
rpm-build c487f7
assert_not_has_file appdir/files/cleanup/a_filee
rpm-build c487f7
assert_not_has_file appdir/files/bin/file.cleanup
rpm-build c487f7
rpm-build c487f7
assert_has_file appdir/files/cleaned_up > out
rpm-build c487f7
assert_has_file appdir/files/share/icons/org.test.Hello.png
rpm-build c487f7
rpm-build c487f7
assert_file_has_content appdir/files/out '^foo$'
rpm-build c487f7
assert_file_has_content appdir/files/out2 '^foo2$'
rpm-build c487f7
rpm-build c487f7
${FLATPAK} build appdir /app/bin/hello2.sh > hello_out2
rpm-build c487f7
assert_file_has_content hello_out2 '^Hello world2, from a sandbox$'
rpm-build c487f7
rpm-build c487f7
echo "ok build"
rpm-build c487f7
rpm-build c487f7
${FLATPAK} ${U} install -y test-repo org.test.Hello2 master
rpm-build c487f7
run org.test.Hello2 > hello_out3
rpm-build c487f7
assert_file_has_content hello_out3 '^Hello world2, from a sandbox$'
rpm-build c487f7
rpm-build c487f7
run --command=cat org.test.Hello2 /app/share/app-data > app_data_1
rpm-build c487f7
assert_file_has_content app_data_1 version1
rpm-build c487f7
rpm-build c487f7
echo "ok install+run"
rpm-build c487f7
rpm-build c487f7
echo "version2" > app-data
rpm-build c487f7
${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean appdir test.json
rpm-build c487f7
assert_file_has_content appdir/files/share/app-data version2
rpm-build c487f7
${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean appdir test.yaml
rpm-build c487f7
assert_file_has_content appdir/files/share/app-data version2
rpm-build c487f7
rpm-build c487f7
${FLATPAK} ${U} update -y org.test.Hello2 master
rpm-build c487f7
rpm-build c487f7
run --command=cat org.test.Hello2 /app/share/app-data > app_data_2
rpm-build c487f7
assert_file_has_content app_data_2 version2
rpm-build c487f7
rpm-build c487f7
echo "ok update"
rpm-build c487f7
rpm-build c487f7
# The build-args of --help should prevent the faulty cleanup and
rpm-build c487f7
# platform-cleanup commands from executing
rpm-build c487f7
${FLATPAK_BUILDER} $FL_GPGARGS --repo=$REPO --force-clean runtimedir \
rpm-build c487f7
    test-runtime.json
rpm-build c487f7
rpm-build c487f7
echo "ok runtime build cleanup with build-args"