diff options
author | Daniel Holbach <daniel.holbach@ubuntu.com> | 2012-10-28 03:26:14 +0800 |
---|---|---|
committer | Aron Xu <aron@debian.org> | 2012-10-28 03:26:14 +0800 |
commit | dbad2a4c166a162a703d368bc8d946d2fc9e32ac (patch) | |
tree | 0cc61a17528b325b030adcb8061abfac978121fd /debian | |
parent | c0e3749185e5f464ea6905f63143622bcce78e7f (diff) | |
download | libxml2-dbad2a4c166a162a703d368bc8d946d2fc9e32ac.tar.gz |
Add simple autopkgtest to the package
Diffstat (limited to 'debian')
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | debian/tests/build | 41 | ||||
-rw-r--r-- | debian/tests/control | 2 | ||||
-rw-r--r-- | debian/tests/python | 22 |
4 files changed, 66 insertions, 1 deletions
diff --git a/debian/control b/debian/control index 52c8f19..0892d2a 100644 --- a/debian/control +++ b/debian/control @@ -10,6 +10,7 @@ Build-Depends: debhelper (>= 9), perl, dh-autoreconf, autotools-dev, Homepage: http://xmlsoft.org/ Vcs-Git: git://git.debian.org/debian-xml-sgml/libxml2.git Vcs-Browser: http://git.debian.org/?p=debian-xml-sgml/libxml2.git +XS-Testsuite: autopkgtest Package: libxml2 Priority: standard @@ -143,4 +144,3 @@ Description: Python bindings for the GNOME XML library (debug extension) . This package contains the files needed to use the GNOME XML library in Python programs for use with the Python debug interpreter. - diff --git a/debian/tests/build b/debian/tests/build new file mode 100644 index 0000000..714befa --- /dev/null +++ b/debian/tests/build @@ -0,0 +1,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" diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..92f5df1 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,2 @@ +Tests: build python +Depends: libxml2-dev, python-libxml2, build-essential, pkg-config diff --git a/debian/tests/python b/debian/tests/python new file mode 100644 index 0000000..5fa3338 --- /dev/null +++ b/debian/tests/python @@ -0,0 +1,22 @@ +#!/bin/sh + +python <<EOF +import libxml2 +import sys + +doc = libxml2.parseDoc( +"""<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE test [ +<!ELEMENT test (#PCDATA) > +<!ATTLIST test xmlns:abc CDATA #FIXED "http://abc.org" > +<!ATTLIST test abc:attr CDATA #FIXED "def" > +]> +<test /> +""") +elem = doc.getRootElement() +attr = elem.hasNsProp('attr', 'http://abc.org') +if attr == None or attr.serialize()[:-1] != """<!ATTLIST test abc:attr CDATA #FIXED "def">""": + print("Failed to find defaulted attribute abc:attr") + sys.exit(1) +doc.freeDoc() +EOF |