1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
#!/bin/sh
# autopkgtest check: Build and run a simple dummy program using the AppStream lib,
# to verify that the headers and pkg-config file are installed correctly
# (c) 2014 Matthias Klumpp <mak@debian.org>
set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > asbuildtest.c
#include <appstream.h>
int main()
{
AsComponent *cpt;
gchar *str;
gchar **strv;
cpt = as_component_new ();
as_component_set_kind (cpt, AS_COMPONENT_KIND_DESKTOP_APP);
as_component_set_name (cpt, "Test");
as_component_set_summary (cpt, "It does things");
strv = g_new0 (gchar*, 1 + 2);
strv[0] = g_strdup ("fedex");
strv[1] = NULL;
as_component_set_pkgnames (cpt, strv);
g_strfreev (strv);
str = as_component_to_xml (cpt);
g_debug ("%s", str);
g_assert (g_strcmp0 (str, "<?xml version=\"1.0\"?>\n<component type=\"desktop\"><name>Test</name><summary>It does things</summary><pkgname>fedex</pkgname></component>\n") == 0);
g_free (str);
return 0;
}
EOF
export G_MESSAGES_DEBUG=all
gcc -o asbuildtest asbuildtest.c `pkg-config --cflags --libs appstream`
echo "build: OK"
[ -x asbuildtest ]
./asbuildtest
echo "run: OK"
|