Package: libxml2
Version: 2.8.0+dfsg1-5
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu quantal ubuntu-patch

Dear Maintainer,

in Ubuntu we started using autopkgtest with Jenkins to make it easier
for us to track changes and make sure they still work whenever a new
version is uploaded.

The following test does the following:
 - check that code can still be built against libxml2
 - test some very basic functionality of the package

I'm aware that Debian does not have this infrastructure set up, but you
can very easily confirm that the test works by running the following
command in the source package tree:

  sudo adt-run --no-built-binaries --built-tree=. --- adt-virt-null

*** /tmp/tmph4QnML/bug_body

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/tests/build, debian/tests/control: add test to check
    that code can be easily built against libxml2, test some core
    functionality too.
  * debian/control: enable autopkgtest.


Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers quantal-updates
  APT policy: (500, 'quantal-updates'), (500, 'quantal-security'), (500, 
'quantal-proposed'), (500, 'quantal'), (100, 'quantal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.5.0-17-generic (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
diff -Nru libxml2-2.8.0+dfsg1/debian/changelog libxml2-2.8.0+dfsg1/debian/changelog
diff -Nru libxml2-2.8.0+dfsg1/debian/control libxml2-2.8.0+dfsg1/debian/control
--- libxml2-2.8.0+dfsg1/debian/control	2012-07-22 14:50:34.000000000 +0200
+++ libxml2-2.8.0+dfsg1/debian/control	2012-10-09 15:28:14.000000000 +0200
@@ -10,6 +10,7 @@
 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
diff -Nru libxml2-2.8.0+dfsg1/debian/tests/build libxml2-2.8.0+dfsg1/debian/tests/build
--- libxml2-2.8.0+dfsg1/debian/tests/build	1970-01-01 01:00:00.000000000 +0100
+++ libxml2-2.8.0+dfsg1/debian/tests/build	2012-10-09 13:47:35.000000000 +0200
@@ -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.holb...@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 -Nru libxml2-2.8.0+dfsg1/debian/tests/control libxml2-2.8.0+dfsg1/debian/tests/control
--- libxml2-2.8.0+dfsg1/debian/tests/control	1970-01-01 01:00:00.000000000 +0100
+++ libxml2-2.8.0+dfsg1/debian/tests/control	2012-10-09 13:40:49.000000000 +0200
@@ -0,0 +1,2 @@
+Tests: build
+Depends: libxml2-dev, build-essential

Reply via email to