[SCM] QCA2 library packaging branch, experimental, updated. debian/2.0.3-6-35-gd59a34e

Felix Geyer fgeyer at moszumanska.debian.org
Tue May 26 14:11:13 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-req/qca2.git;a=commitdiff;h=9423e63

The following commit has been merged in the experimental branch:
commit 9423e631a285aab5ef01a05014a7a509e8697065
Author: Felix Geyer <fgeyer at debian.org>
Date:   Mon May 25 18:28:04 2015 +0200

    Add autopkgtests: ciphertest-qt4 and ciphertest-qt5.
---
 debian/changelog                       |  1 +
 debian/tests/ciphertest-qt4            |  5 +++
 debian/tests/ciphertest-qt5            |  5 +++
 debian/tests/ciphertest/CMakeLists.txt | 21 ++++++++++
 debian/tests/ciphertest/ciphertest.cpp | 70 ++++++++++++++++++++++++++++++++++
 debian/tests/ciphertest/run-test       | 25 ++++++++++++
 debian/tests/control                   |  6 +++
 7 files changed, 133 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 0299225..6ff7ff5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ qca2 (2.1.0.3-2) UNRELEASED; urgency=medium
     - Add transitional packages for the existing libqca2-plugin-*
   * Make libqca2 recommend the plugins.
   * Install cmake modules to libqca2-dev.
+  * Add autopkgtests: ciphertest-qt4 and ciphertest-qt5.
 
  -- Felix Geyer <fgeyer at debian.org>  Mon, 25 May 2015 12:49:12 +0200
 
diff --git a/debian/tests/ciphertest-qt4 b/debian/tests/ciphertest-qt4
new file mode 100755
index 0000000..cb16daa
--- /dev/null
+++ b/debian/tests/ciphertest-qt4
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+debian/tests/ciphertest/run-test --qt4
diff --git a/debian/tests/ciphertest-qt5 b/debian/tests/ciphertest-qt5
new file mode 100755
index 0000000..f588bd2
--- /dev/null
+++ b/debian/tests/ciphertest-qt5
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+set -e
+
+debian/tests/ciphertest/run-test --qt5
diff --git a/debian/tests/ciphertest/CMakeLists.txt b/debian/tests/ciphertest/CMakeLists.txt
new file mode 100644
index 0000000..90e6028
--- /dev/null
+++ b/debian/tests/ciphertest/CMakeLists.txt
@@ -0,0 +1,21 @@
+project(ciphertest)
+
+cmake_minimum_required(VERSION 2.8.12)
+
+option(USE_QT5 "Build for Qt5" OFF)
+
+if(USE_QT5)
+  find_package(Qt5Core REQUIRED)
+  find_package(Qca-qt5 REQUIRED)
+else()
+  find_package(Qt4 REQUIRED)
+  find_package(Qca REQUIRED)
+endif()
+
+add_executable(ciphertest ciphertest.cpp)
+
+if(USE_QT5)
+  target_link_libraries(ciphertest Qt5::Core qca-qt5)
+else()
+  target_link_libraries(ciphertest ${QT_QTCORE_LIBRARY} qca)
+endif()
diff --git a/debian/tests/ciphertest/ciphertest.cpp b/debian/tests/ciphertest/ciphertest.cpp
new file mode 100644
index 0000000..9d7170d
--- /dev/null
+++ b/debian/tests/ciphertest/ciphertest.cpp
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2003 Justin Karneges <justin at affinix.com>
+ Copyright (C) 2005-2006 Brad Hards <bradh at frogmouth.net>
+ Copyright (C) 2015 Felix Geyer <fgeyer at debian.org>
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#include <QCoreApplication>
+#include <QtCrypto>
+
+int main(int argc, char **argv)
+{
+    QCA::Initializer init;
+
+    QCoreApplication app(argc, argv);
+
+    QCA::SecureArray plainText(QByteArray::fromHex("6bc1bee22e409f96e93d7e117393172a"));
+
+    if (!QCA::isSupported("aes128-cbc-pkcs7")) {
+        qWarning("AES128-CBC not supported");
+        return 1;
+    }
+
+    QCA::SymmetricKey key(QByteArray::fromHex("2b7e151628aed2a6abf7158809cf4f3c"));
+
+    QCA::InitializationVector iv(QByteArray::fromHex("000102030405060708090A0B0C0D0E0F"));;
+
+    QCA::Cipher cipher(QString("aes128"), QCA::Cipher::CBC,
+                       QCA::Cipher::DefaultPadding,
+                       QCA::Encode,
+                       key, iv);
+
+    QCA::SecureArray cipherText = cipher.update(plainText);
+    QString cipherTextHex = QCA::arrayToHex(cipherText.toByteArray());
+    QString expectedHex("7649abac8119b246cee98e9b12e9197d");
+
+    if (!cipher.ok()) {
+        qWarning("update() failed");
+        return 1;
+    }
+
+    cipher.final();
+    if (!cipher.ok()) {
+        qWarning("final() failed");
+    }
+
+    if (cipherTextHex != expectedHex) {
+        qWarning("Error: result: %s, expected: %s", qPrintable(cipherTextHex),
+                 qPrintable(expectedHex));
+        return 1;
+    }
+
+    return 0;
+}
diff --git a/debian/tests/ciphertest/run-test b/debian/tests/ciphertest/run-test
new file mode 100755
index 0000000..a7a8948
--- /dev/null
+++ b/debian/tests/ciphertest/run-test
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+TESTDIR=`pwd`/debian/tests/ciphertest
+
+if [ "$1" = "--qt4" ]; then
+  CONF_FLAGS=""
+elif [ "$1" = "--qt5" ]; then
+  CONF_FLAGS="-DUSE_QT5=ON"
+else
+  echo "Usage $1 <--qt4,--qt5>"
+  exit 1
+fi
+
+cd "$ADTTMP"
+
+echo Building test
+cmake $CONF_FLAGS $TESTDIR
+make
+echo OK
+
+echo Running test
+./ciphertest
+echo OK
diff --git a/debian/tests/control b/debian/tests/control
index d9b40f1..d5c21b8 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -4,3 +4,9 @@
 
 Tests: acc
 Depends: @, dh-acc, exuberant-ctags
+
+Tests: ciphertest-qt4
+Depends: build-essential, cmake, libqca2-dev, libqca2-plugins
+
+Tests: ciphertest-qt5
+Depends: build-essential, cmake, libqca-qt5-2-dev, libqca-qt5-2-plugins

-- 
QCA2 library packaging



More information about the pkg-kde-commits mailing list