Added xdg-app-builder test

tingping/wmclass
Alexander Larsson 2016-05-02 15:49:18 +02:00
parent dcfb950c31
commit d680da8d59
4 changed files with 131 additions and 0 deletions

View File

@ -59,12 +59,14 @@ installed_test_SCRIPTS += \
installed_test_data = \
tests/org.test.Hello.png \
tests/configure.test \
tests/session.conf.in \
$(NULL)
test_scripts = \
tests/test-basic.sh \
tests/test-run.sh \
tests/test-builder.sh \
$(NULL)
test_programs = testdb test-doc-portal

View File

@ -149,11 +149,20 @@ setup_repo () {
xdg-app remote-add --user --no-gpg-verify test-repo repo
}
setup_sdk_repo () {
. $(dirname $0)/make-test-runtime.sh org.test.Sdk bash ls cat echo readlink make mkdir cp touch > /dev/null
}
install_repo () {
${XDG_APP} --user install test-repo org.test.Platform master
${XDG_APP} --user install test-repo org.test.Hello master
}
install_sdk_repo () {
${XDG_APP} --user install test-repo org.test.Sdk master
}
run () {
${CMD_PREFIX} xdg-app run "$@"

View File

@ -0,0 +1,67 @@
#!/bin/bash
#
# Copyright (C) 2011 Colin Walters <walters@verbum.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
set -euo pipefail
. $(dirname $0)/libtest.sh
echo "1..3"
setup_repo
install_repo
setup_sdk_repo
install_sdk_repo
cp -a $(dirname $0)/configure.test .
echo "version1" > app-data
xdg-app-builder --repo=repo --force-clean appdir $(dirname $0)/test.json
assert_file_has_content appdir/files/share/app-data version1
assert_file_has_content appdir/metadata shared=network;
assert_file_has_content appdir/metadata tags=test;
assert_not_has_file appdir/files/cleanup/a_filee
assert_not_has_file appdir/files/bin/file.cleanup
assert_has_file appdir/files/cleaned_up > out
${XDG_APP} build appdir /app/bin/hello2.sh > hello_out2
assert_file_has_content hello_out2 '^Hello world2, from a sandbox$'
echo "ok build"
${XDG_APP} --user install test-repo org.test.Hello2 master
run org.test.Hello2 > hello_out3
assert_file_has_content hello_out3 '^Hello world2, from a sandbox$'
run --command=cat org.test.Hello2 /app/share/app-data > app_data_1
assert_file_has_content app_data_1 version1
echo "ok install+run"
echo "version2" > app-data
xdg-app-builder --repo=repo --force-clean appdir $(dirname $0)/test.json
assert_file_has_content appdir/files/share/app-data version2
${XDG_APP} --user 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
echo "ok update"

53
tests/test.json 100644
View File

@ -0,0 +1,53 @@
{
"app-id": "org.test.Hello2",
"runtime": "org.test.Platform",
"sdk": "org.test.Sdk",
"command": "hello2.sh",
"tags": ["test"],
"finish-args": [
"--share=network"
],
"build-options" : {
"cflags": "-O2 -g",
"cxxflags": "-O2 -g",
"env": {
"FOO": "bar",
"V": "1"
}
},
"cleanup": ["/cleanup", "*.cleanup"],
"cleanup-commands": [ "touch /app/cleaned_up" ],
"modules": [
{
"name": "test",
"config-opts": ["--some-arg"],
"post-install": [ "touch /app/bin/file.cleanup" ],
"make-args": ["BAR=2" ],
"make-install-args": ["BAR=3" ],
"sources": [
{
"type": "file",
"path": "configure.test",
"dest-filename": "configure",
"sha256": "fb62c2826dbd2fda27e878490e3f1f9081b1b69a2211e125ae79cf552a7a2254"
},
{
"type": "file",
"path": "app-data"
},
{
"type": "script",
"dest-filename": "hello2.sh",
"commands": [ "echo \"Hello world2, from a sandbox\"" ]
},
{
"type": "shell",
"commands": [
"mkdir /app/cleanup/",
"touch /app/cleanup/a_file"
]
}
]
}
]
}