summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2020-08-26 10:16:11 +0100
committerSimon McVittie <smcv@debian.org>2020-08-26 10:37:28 +0100
commit20c5c42de4450e23721ea2df0803bd9272433814 (patch)
treedfc59de1d3b36a7e5b8fdc880072cf4f3ad30146
parentb89dbd85e744f83b7035ac0cd5ed83e7c09fce67 (diff)
Add superficial smoke-tests for the library and GIR data
-rw-r--r--debian/copyright4
-rw-r--r--debian/tests/control7
-rwxr-xr-xdebian/tests/gir1.2-babl-0.114
-rwxr-xr-xdebian/tests/libbabl-dev37
4 files changed, 61 insertions, 1 deletions
diff --git a/debian/copyright b/debian/copyright
index 5e73e15..4c39118 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -29,7 +29,9 @@ License: GPL-3+ with GGGL exception
Files: debian/*
Copyright: 2007, Étienne Bersac <bersace03@laposte.net>
2012, Matteo F. Vescovi <mfv@debian.org>
-License: LGPL-3+
+ 2020 Collabora Ltd.
+ 2020 Simon McVittie
+License: LGPL-3+ and Expat
License: Expat
SPDX-License-Identifier: MIT
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..99b1574
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,7 @@
+Tests: libbabl-dev
+Depends: build-essential, pkg-config, libbabl-dev
+Restrictions: allow-stderr, superficial
+
+Tests: gir1.2-babl-0.1
+Depends: gir1.2-babl-0.1, python3-gi
+Restrictions: allow-stderr, superficial
diff --git a/debian/tests/gir1.2-babl-0.1 b/debian/tests/gir1.2-babl-0.1
new file mode 100755
index 0000000..c4ae698
--- /dev/null
+++ b/debian/tests/gir1.2-babl-0.1
@@ -0,0 +1,14 @@
+#!/usr/bin/python3
+# Copyright 2020 Simon McVittie
+# SPDX-License-Identifier: MIT
+
+import os
+
+import gi
+gi.require_version('Babl', '0.1')
+
+from gi.repository import Babl
+
+if __name__ == '__main__':
+ triple = Babl.get_version()
+ assert tuple(triple) >= (0, 1)
diff --git a/debian/tests/libbabl-dev b/debian/tests/libbabl-dev
new file mode 100755
index 0000000..13bb908
--- /dev/null
+++ b/debian/tests/libbabl-dev
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Copyright 2020 Collabora Ltd.
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
+ CROSS_COMPILE="$DEB_HOST_GNU_TYPE-"
+else
+ CROSS_COMPILE=
+fi
+
+cd "$AUTOPKGTEST_TMP"
+
+cat > trivial.c <<EOF
+#include <babl/babl.h>
+
+#undef NDEBUG
+#include <assert.h>
+
+int main(void)
+{
+ int x, y, z;
+
+ babl_get_version(&x, &y, &z);
+ assert(x >= 0);
+ assert(y >= 0);
+ assert(z >= 0);
+ assert((x * 1000) + y >= 1);
+ return 0;
+}
+EOF
+
+# Deliberately word-splitting pkg-config's output:
+# shellcheck disable=SC2046
+"${CROSS_COMPILE}gcc" -otrivial trivial.c $("${CROSS_COMPILE}pkg-config" --cflags --libs babl)
+./trivial