Blame tests/test-builder.sh

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