blob: 714befa05b9c9ea59f9cc358d9558b0050fbf4f6 (
plain)
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
|
#!/bin/sh
# autopkgtest check: Build and run a program against libxml2, to verify that the
# headers and pkg-config file are installed correctly
# (C) 2012 Canonical Ltd.
# Author: Daniel Holbach <daniel.holbach@ubuntu.com>
set -e
WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > xmltest.c
#include <libxml/parser.h>
int
main(void)
{
xmlNodePtr n;
xmlDocPtr doc;
xmlNodePtr cur;
doc = xmlNewDoc(BAD_CAST "1.0");
n = xmlNewNode(NULL, BAD_CAST "root");
xmlNodeSetContent(n, BAD_CAST "content");
xmlDocSetRootElement(doc, n);
cur = xmlDocGetRootElement(doc);
if (xmlStrcmp(cur->name, (const xmlChar *) "root"))
return (1);
xmlFreeDoc(doc);
return (0);
}
EOF
gcc -o xmltest xmltest.c `pkg-config --cflags --libs libxml-2.0`
echo "build: OK"
[ -x xmltest ]
./xmltest
echo "run: OK"
|