Bug#819378: Add packaging testsuite

2016-03-27 Thread Peter Spiess-Knafl
Hi Ghis!

Thank you also for this patch. It prevents many mistakes.

Greetings
Peter

On 03/27/2016 09:47 PM, Ghislain Vaillant wrote:
> Package: libjsoncpp
> Version: 1.6.5-4
> 
> Dear maintainer,
> 
> Whilst working on fixing the CMake install paths, I took this
> opportunity to provide a packaging testsuite (autopkgtest) for this
> source package to test my modifications.
> 
> Please consider applying this patch, so your package can benefit from
> our Debian CI in the future.
> 
> Here is a link to a fake non-maintainer build run I did on debomatic to
> illustrate its usefulness:
> 
> 
> http://debomatic-amd64.debian.net/distribution#unstable/libjsoncpp/1.6.5-4.1/autopkgtest
> 
> 
> Best regards,
> Ghis



Bug#819378: Add packaging testsuite

2016-03-27 Thread Ghislain Vaillant

Package: libjsoncpp
Version: 1.6.5-4

Dear maintainer,

Whilst working on fixing the CMake install paths, I took this
opportunity to provide a packaging testsuite (autopkgtest) for this
source package to test my modifications.

Please consider applying this patch, so your package can benefit from
our Debian CI in the future.

Here is a link to a fake non-maintainer build run I did on debomatic to
illustrate its usefulness:


http://debomatic-amd64.debian.net/distribution#unstable/libjsoncpp/1.6.5-4.1/autopkgtest

Best regards,
Ghis
>From ac8bb36a2fb6b704e527193031801c188cb95071 Mon Sep 17 00:00:00 2001
From: Ghislain Antony Vaillant 
Date: Sun, 27 Mar 2016 17:01:48 +0100
Subject: [PATCH 2/3] Add packaging testsuite.

---
 debian/control |  1 +
 debian/tests/control   |  5 +
 debian/tests/testsuite | 41 +
 3 files changed, 47 insertions(+)
 create mode 100644 debian/tests/control
 create mode 100755 debian/tests/testsuite

diff --git a/debian/control b/debian/control
index 66f8d52..7f95919 100644
--- a/debian/control
+++ b/debian/control
@@ -2,6 +2,7 @@ Source: libjsoncpp
 Priority: extra
 Maintainer: Peter Spiess-Knafl 
 Uploaders: Cleto Martín 
+Testsuite: autopkgtest
 Build-Depends: cmake, debhelper (>= 9), doxygen, python
 Standards-Version: 3.9.7
 Section: libs
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 000..ea6773b
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,5 @@
+Tests: testsuite
+Depends: build-essential,
+ cmake,
+ libjsoncpp-dev,
+ pkg-config
diff --git a/debian/tests/testsuite b/debian/tests/testsuite
new file mode 100755
index 000..b21e510
--- /dev/null
+++ b/debian/tests/testsuite
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright 2016 Ghislain Antony Vaillant 
+#
+# This file is part of the autopkgtest testsuite for the libjsoncpp
+# source package.
+
+set -e
+
+# Presence of $ADTTMP implies that someone will handle cleanup for us, so we
+# can avoid duplicating the effort (signal handling, etc.) here.
+if [ -z "$ADTTMP" ]
+then
+echo "Required envvar \"$ADTTMP\"is not set" >&2
+exit 1
+fi
+
+# Copy testsuite source code.
+cp -a ./src/test_lib_json/* "$ADTTMP"
+cd "$ADTTMP"
+
+cat < CMakeLists.txt
+cmake_minimum_required(VERSION 2.6.2)
+project(jsoncpp_test)
+
+find_package(jsoncpp REQUIRED)
+# Using pkg-config instead of cmake config-mode because the
+# packaged jsoncppConfig.cmake does not seem to work beyond detection.
+find_package(PkgConfig)
+pkg_check_modules(PC_jsoncpp QUIET jsoncpp)
+include_directories(\${PC_jsoncpp_INCLUDE_DIRS})
+link_libraries(\${PC_jsoncpp_LIBRARIES})
+
+add_executable(jsoncpp_test main.cpp jsontest.cpp jsontest.h)
+
+EOF
+
+# Configure, build and execute.
+mkdir build && cd build
+cmake ..
+make VERBOSE=1 -j$(nproc)
+./jsoncpp_test
-- 
2.8.0.rc3