[DRE-commits] [trocla] 03/04: Add autopkgtest tests

Michael Weiser michaelweiser-guest at moszumanska.debian.org
Tue Feb 17 09:49:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

michaelweiser-guest pushed a commit to branch master
in repository trocla.

commit 3653cc3acaacc8707fc4f0d4d93409a877311b9c
Author: Michael Weiser <michael.weiser at gmx.de>
Date:   Tue Feb 17 10:37:14 2015 +0100

    Add autopkgtest tests
---
 debian/patches/0001-testsuite.patch | 32 +++++++++++++++++++++++++++++++-
 debian/tests/control                |  4 ++++
 debian/tests/control.ex             | 13 -------------
 debian/tests/trocla                 | 26 ++++++++++++++++++++++++++
 4 files changed, 61 insertions(+), 14 deletions(-)

diff --git a/debian/patches/0001-testsuite.patch b/debian/patches/0001-testsuite.patch
index bcc1b32..92d4996 100644
--- a/debian/patches/0001-testsuite.patch
+++ b/debian/patches/0001-testsuite.patch
@@ -1,4 +1,7 @@
-Fix the testsuite.
+Fix the testsuite. Also, temporarily, provide a default_config.yaml at the root
+of the source directory and make the testsuite use it so it can succeed with
+autopkgtest because gem2deb-test-runner moves away lib where the default config
+normally is.
 
 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
 index 461a858..cd04768 100644
@@ -33,3 +36,30 @@ index 61d9921..71bb41b 100644
        Trocla::VERSION::STRING.should_not be_empty
      end
    end
+diff --git a/default_config.yaml b/default_config.yaml
+new file mode 100644
+index 0000000..d4037fd
+--- /dev/null
++++ b/default_config.yaml
+@@ -0,0 +1,8 @@
++---
++options:
++    random: true
++    length: 12
++    charset: default
++adapter: :YAML
++adapter_options:
++    :file: '/tmp/trocla.yaml'
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index 461a858..2e3c6fa 100644
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -13,7 +13,7 @@ RSpec.configure do |config|
+ end
+ 
+ def default_config
+-  @default_config ||= YAML.load(File.read(File.expand_path(base_dir+'/lib/trocla/default_config.yaml')))
++  @default_config ||= YAML.load(File.read(File.expand_path(base_dir+'/default_config.yaml')))
+ end
+ 
+ def test_config
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..7a07706
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,4 @@
+Test-Command: gem2deb-test-runner --autopkgtest 2>&1
+Depends: @, @builddeps@, gem2deb-test-runner
+
+Tests: trocla
diff --git a/debian/tests/control.ex b/debian/tests/control.ex
deleted file mode 100644
index 429a392..0000000
--- a/debian/tests/control.ex
+++ /dev/null
@@ -1,13 +0,0 @@
-# AUTOGENERATED FILE
-#
-# As of autopkgtest 3.5, Ruby packages that use gem2deb are automatically
-# detected, and if debian/tests/control does not exist the contents below will
-# be assumed (with the exception of gem2deb being filtered out from
-# @builddeps@):
-
-Test-Command: gem2deb-test-runner --autopkgtest 2>&1
-Depends: @, @builddeps@, gem2deb-test-runner
-
-# if you would need to change something to the above, to that and rename this
-# file to `control`. Otherwise, you should probably delete this file
-# (recommended).
diff --git a/debian/tests/trocla b/debian/tests/trocla
new file mode 100644
index 0000000..840e8ed
--- /dev/null
+++ b/debian/tests/trocla
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+cd $ADTTMP
+
+# generate some passwords
+if ! trocla create test plain >/tmp/password || \
+	! trocla create test plain >/tmp/password.same || \
+	! trocla create test2 plain >/tmp/password.diff ; then
+	echo "Running trocla failed. abort."
+	exit 1
+fi
+
+echo "Those should be the same:"
+cat /tmp/password ; echo
+cat /tmp/password.same ; echo
+echo "And this one should differ:"
+cat /tmp/password.diff ; echo
+
+# we should now have two files with identical content and one that differs
+if ! cmp /tmp/password /tmp/password.same 2>&1 || \
+	cmp /tmp/password /tmp/password.diff 2>&1 ; then
+        echo "trocla itself failed. abort."
+        exit 1
+fi
+echo "Got passwords as expected."
+exit 0

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/trocla.git



More information about the Pkg-ruby-extras-commits mailing list