From dbad2a4c166a162a703d368bc8d946d2fc9e32ac Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Sun, 28 Oct 2012 03:26:14 +0800 Subject: Add simple autopkgtest to the package --- debian/control | 2 +- debian/tests/build | 41 +++++++++++++++++++++++++++++++++++++++++ debian/tests/control | 2 ++ debian/tests/python | 22 ++++++++++++++++++++++ 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 debian/tests/build create mode 100644 debian/tests/control create mode 100644 debian/tests/python 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 + +set -e + +WORKDIR=$(mktemp -d) +trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM +cd $WORKDIR +cat < xmltest.c +#include + +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 < + + + +]> + +""") +elem = doc.getRootElement() +attr = elem.hasNsProp('attr', 'http://abc.org') +if attr == None or attr.serialize()[:-1] != """""": + print("Failed to find defaulted attribute abc:attr") + sys.exit(1) +doc.freeDoc() +EOF -- cgit v1.2.3