summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Čihař <michal@cihar.com>2017-11-08 13:51:08 +0100
committerMichal Čihař <michal@cihar.com>2017-11-08 14:32:29 +0100
commita45ef621c988cfc1320379cc81941773050d8ca6 (patch)
treef76d6d40505f75e844be84c4ec268221cae51d0b
parent4cf1b48e21de15168bbe90898e019f21ff5745d6 (diff)
Fix tests exection
Signed-off-by: Michal Čihař <michal@cihar.com>
-rw-r--r--debian/changelog1
-rw-r--r--debian/control1
-rw-r--r--debian/patches/Fix-test-execution-on-Debian.patch36
-rw-r--r--debian/patches/series1
-rwxr-xr-xdebian/rules4
5 files changed, 41 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
index f9da74e..1ffbf26 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ sdcv (0.5.2-1) UNRELEASED; urgency=medium
* Move packaging to Git, adjust Vcs urls.
* Update upstream homepage.
* Bump standards to 4.1.1.
+ * Run full testsuite, add jq to build depends for that.
-- Michal Čihař <nijel@debian.org> Wed, 08 Nov 2017 13:49:23 +0100
diff --git a/debian/control b/debian/control
index ce95e2c..370793f 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Build-Depends: debhelper (>= 9),
dpkg-dev (>= 1.16.1~),
g++ (>=4:4.8),
cmake,
+ jq,
gettext,
zlib1g-dev,
pkg-config,
diff --git a/debian/patches/Fix-test-execution-on-Debian.patch b/debian/patches/Fix-test-execution-on-Debian.patch
new file mode 100644
index 0000000..68fddf3
--- /dev/null
+++ b/debian/patches/Fix-test-execution-on-Debian.patch
@@ -0,0 +1,36 @@
+From 1db51cb69360dcce6e70b34e7549ec02b93f282f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= <michal@cihar.com>
+Date: Wed, 8 Nov 2017 14:27:59 +0100
+Subject: [PATCH 1/1] Fix test execution on Debian
+
+The default /bin/sh is probably more picky than bash.
+---
+ tests/t_json | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tests/t_json b/tests/t_json
+index 65b580b..74cd2af 100755
+--- a/tests/t_json
++++ b/tests/t_json
+@@ -12,14 +12,14 @@ test_json() {
+ PARAMS="$1"
+ EXPECTED=$(echo "$2" | jq 'sort')
+ RESULT=$($SDCV $PARAMS | jq 'sort')
+- if [ "$EXPECTED" != "$RESULT"]; then
++ if [ "$EXPECTED" != "$RESULT" ]; then
+ echo "expected $EXPECTED but got $RESULT"
+ exit 1
+ fi
+ }
+
+-test_json "-x -j -l -n --data-dir \"$TEST_DIR\"" "[{\"name\": \"Test synonyms\", \"wordcount\": \"1\"},{\"name\": \"Sample 1 test dictionary\", \"wordcount\": \"1\"},{\"name\": \"test_dict\", \"wordcount\": \"1\"}]"
+-test_json "-x -j -n --data-dir \"$TEST_DIR\" foo" "[{\"dict\": \"Test synonyms\",\"word\":\"test\",\"definition\":\"\nresult of test\"}]"
+-test_json "-x -j -n --data-dir \"$TEST_DIR\" foobarbaaz" "[]"
++test_json "-x -j -l -n --data-dir $TEST_DIR" "[{\"name\": \"Test synonyms\", \"wordcount\": \"2\"},{\"name\": \"Sample 1 test dictionary\", \"wordcount\": \"1\"},{\"name\": \"test_dict\", \"wordcount\": \"1\"}]"
++test_json "-x -j -n --data-dir $TEST_DIR foo" "[{\"dict\": \"Test synonyms\",\"word\":\"test\",\"definition\":\"\\\nresult of test\"}]"
++test_json "-x -j -n --data-dir $TEST_DIR foobarbaaz" "[]"
+
+ exit 0
+--
+2.15.0
+
diff --git a/debian/patches/series b/debian/patches/series
index e69de29..710e72d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -0,0 +1 @@
+Fix-test-execution-on-Debian.patch
diff --git a/debian/rules b/debian/rules
index 90d1046..6605f18 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,8 +13,8 @@ override_dh_auto_build:
override_dh_auto_test:
mkdir -p tmphome/.stardict/dic
- # Exclude test which requires particullar dictionary
- export HOME=`pwd`/tmphome/; dh_auto_test -- ARGS+="-V -E t_utf8input"
+ # Exclude json test as it's broken in both bash and dash
+ export HOME=`pwd`/tmphome/; dh_auto_test -- ARGS+="--output-on-failure"
%:
dh $@