[SCM] kstars packaging branch, master, updated. debian/4.11.3-3-3-g0b7ef84

Pino Toscano pino at moszumanska.debian.org
Sat Nov 30 15:52:09 UTC 2013


Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-sc/kstars.git;a=commitdiff;h=80ee5eb

The following commit has been merged in the master branch:
commit 80ee5eba42b223e5102b59eb65eb1477c18038df
Author: Pino Toscano <pino at debian.org>
Date:   Sat Nov 30 16:50:09 2013 +0100

    make tests use temporary files
    
    ... instead of relying on ~/.kde;
    backport upstream commits 3231f23c31896b1da601e7a0704443d1181a0604 and
    bf2cb5653908863eee0ee6c6c05f87ba38886fa3
---
 debian/changelog                                   |   6 +
 debian/patches/series                              |   2 +
 .../patches/upstream_tests-split-init-tearup.patch |  91 +++++++++++
 ...upstream_tests-use-proper-temporary-files.patch | 169 +++++++++++++++++++++
 4 files changed, 268 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index c721833..50b25a2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,11 @@
 kstars (4:4.11.3-4) UNRELEASED; urgency=low
 
+  [ Pino Toscano ]
+  * Backport upstream commits 3231f23c31896b1da601e7a0704443d1181a0604
+    (as upstream_tests-split-init-tearup.patch) and
+    bf2cb5653908863eee0ee6c6c05f87ba38886fa3 (as
+    upstream_tests-use-proper-temporary-files.patch) to make tests properly
+    use temporary files instead of relying on ~/.kde.
 
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 30 Nov 2013 16:44:00 +0100
 
diff --git a/debian/patches/series b/debian/patches/series
index 5dc4ed8..978922f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,4 @@
 eigen3.patch
 link_pthread.diff
+upstream_tests-split-init-tearup.patch
+upstream_tests-use-proper-temporary-files.patch
diff --git a/debian/patches/upstream_tests-split-init-tearup.patch b/debian/patches/upstream_tests-split-init-tearup.patch
new file mode 100644
index 0000000..f6d27c6
--- /dev/null
+++ b/debian/patches/upstream_tests-split-init-tearup.patch
@@ -0,0 +1,91 @@
+From 3231f23c31896b1da601e7a0704443d1181a0604 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino at kde.org>
+Date: Mon, 25 Nov 2013 23:26:57 +0100
+Subject: [PATCH] tests: split init/tearup
+
+use initTestCase and cleanupTestCase for setting up the tests;
+these will be useful later
+---
+ Tests/testcsvparser.cpp | 6 ++++++
+ Tests/testcsvparser.h   | 2 ++
+ Tests/testfwparser.cpp  | 6 ++++++
+ Tests/testfwparser.h    | 2 ++
+ 4 files changed, 16 insertions(+)
+
+diff --git a/Tests/testcsvparser.cpp b/Tests/testcsvparser.cpp
+index e6b7d23..3547326 100644
+--- a/Tests/testcsvparser.cpp
++++ b/Tests/testcsvparser.cpp
+@@ -26,6 +26,9 @@
+ #include "testcsvparser.h"
+ 
+ TestCSVParser::TestCSVParser(): QObject() {
++}
++
++void TestCSVParser::initTestCase() {
+   /*
+    * Justification for doing this instead of simply creating a file:
+    * To add/change tests, we'll need to modify 2 places. The file and this class.
+@@ -113,6 +116,9 @@ TestCSVParser::TestCSVParser(): QObject() {
+ 
+ TestCSVParser::~TestCSVParser()
+ {
++}
++
++void TestCSVParser::cleanupTestCase() {
+   delete test_parser_;
+ }
+ 
+diff --git a/Tests/testcsvparser.h b/Tests/testcsvparser.h
+index d8b594f..7cb33cf 100644
+--- a/Tests/testcsvparser.h
++++ b/Tests/testcsvparser.h
+@@ -30,6 +30,8 @@ class TestCSVParser: public QObject {
+   TestCSVParser();
+   ~TestCSVParser();
+  private slots:
++  void initTestCase();
++  void cleanupTestCase();
+   void CSVMixedInputs();
+   void CSVQuotesInQuotes();
+   void CSVEmptyRow();
+diff --git a/Tests/testfwparser.cpp b/Tests/testfwparser.cpp
+index a58dd6a..78efcb2 100644
+--- a/Tests/testfwparser.cpp
++++ b/Tests/testfwparser.cpp
+@@ -18,6 +18,9 @@
+ #include "testfwparser.h"
+ 
+ TestFWParser::TestFWParser(): QObject() {
++}
++
++void TestFWParser::initTestCase() {
+   test_cases_.append(
+     "this is an exam ple of 256 cases being tested -3.14       times
");
+   test_cases_.append(
+@@ -71,6 +74,9 @@ TestFWParser::TestFWParser(): QObject() {
+ 
+ TestFWParser::~TestFWParser()
+ {
++}
++
++void TestFWParser::cleanupTestCase() {
+   delete test_parser_;
+ }
+ 
+diff --git a/Tests/testfwparser.h b/Tests/testfwparser.h
+index 0a86697..280794b 100644
+--- a/Tests/testfwparser.h
++++ b/Tests/testfwparser.h
+@@ -29,6 +29,8 @@ class TestFWParser: public QObject {
+   TestFWParser();
+   ~TestFWParser();
+  private slots:
++   void initTestCase();
++   void cleanupTestCase();
+    void MixedInputs();
+    void OnlySpaceRow();
+    void NoRow();
+-- 
+1.8.4.2
+
diff --git a/debian/patches/upstream_tests-use-proper-temporary-files.patch b/debian/patches/upstream_tests-use-proper-temporary-files.patch
new file mode 100644
index 0000000..0b49f8a
--- /dev/null
+++ b/debian/patches/upstream_tests-use-proper-temporary-files.patch
@@ -0,0 +1,169 @@
+From bf2cb5653908863eee0ee6c6c05f87ba38886fa3 Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino at kde.org>
+Date: Tue, 26 Nov 2013 00:02:51 +0100
+Subject: [PATCH] tests: use proper temporary files
+
+instead of hardcoding temporary file names within the local KDEHOME,
+use proper temporary files for the data files used in the tests
+
+this makes the tests runnable even when there is no real HOME set
+---
+ Tests/testcsvparser.cpp | 26 ++++++++++++--------------
+ Tests/testcsvparser.h   |  2 +-
+ Tests/testfwparser.cpp  | 28 ++++++++++++----------------
+ Tests/testfwparser.h    |  2 +-
+ 4 files changed, 26 insertions(+), 32 deletions(-)
+
+diff --git a/Tests/testcsvparser.cpp b/Tests/testcsvparser.cpp
+index cdb05f0..e4b8bbc 100644
+--- a/Tests/testcsvparser.cpp
++++ b/Tests/testcsvparser.cpp
+@@ -25,6 +25,8 @@
+ 
+ #include "testcsvparser.h"
+ 
++#include <ktemporaryfile.h>
++
+ TestCSVParser::TestCSVParser(): QObject() {
+ }
+ 
+@@ -82,18 +84,15 @@ void TestCSVParser::initTestCase() {
+                          "either
"));
+   test_cases_.append(",,,,,,,,,,,
");
+   test_cases_.append("
");
+-  QString file_name("TestCSV.txt");
+-  file_name = KStandardDirs::locateLocal("appdata", file_name);
+-  if (!file_name.isNull()) {
+-        test_csv_file_.setFileName(file_name);
+-        if (!test_csv_file_.open(QIODevice::WriteOnly)) {
+-          kWarning() << QString("Couldn't open(%1)").arg(file_name);
+-        }
+-  }
+-  QTextStream out_stream(&test_csv_file_);
++  KTemporaryFile temp_file;
++  temp_file.setSuffix(".txt");
++  temp_file.setAutoRemove(false);
++  QVERIFY(temp_file.open());
++  test_file_name_ = temp_file.fileName();
++  QTextStream out_stream(&temp_file);
+   foreach(const QString &test_case, test_cases_)
+     out_stream << test_case;
+-  test_csv_file_.close();
++  temp_file.close();
+ 
+   //Building the sequence to be used. Includes all available types.
+   sequence_.clear();
+@@ -110,8 +109,7 @@ void TestCSVParser::initTestCase() {
+   sequence_.append(qMakePair(QString("field11"), KSParser::D_QSTRING));
+   sequence_.append(qMakePair(QString("field12"), KSParser::D_QSTRING));
+ 
+-  QString fname = KStandardDirs::locate( "appdata", file_name );
+-  test_parser_ = new KSParser(fname, '#', sequence_);
++  test_parser_ = new KSParser(test_file_name_, '#', sequence_);
+ }
+ 
+ TestCSVParser::~TestCSVParser()
+@@ -265,9 +263,9 @@ void TestCSVParser::CSVReadMissingFile() {
+   /*
+    * Test 6. Attempt to read a missing file repeatedly
+   */
+-  QFile::remove(KStandardDirs::locateLocal("appdata","TestCSV.txt"));
++  QFile::remove(test_file_name_);
+ 
+-  KSParser missing_parser(QString("TestCSV.txt"), '#', sequence_);
++  KSParser missing_parser(test_file_name_, '#', sequence_);
+   QHash<QString, QVariant> row_content = missing_parser.ReadNextRow();
+ 
+   for (int times = 0; times < 20; times++) {
+diff --git a/Tests/testcsvparser.h b/Tests/testcsvparser.h
+index 7cb33cf..1c01782 100644
+--- a/Tests/testcsvparser.h
++++ b/Tests/testcsvparser.h
+@@ -42,7 +42,7 @@ class TestCSVParser: public QObject {
+  private:
+   QStringList test_cases_;
+   QList< QPair<QString, KSParser::DataTypes> > sequence_;
+-  QFile test_csv_file_;
++  QString test_file_name_;
+   KSParser *test_parser_;
+ };
+ 
+diff --git a/Tests/testfwparser.cpp b/Tests/testfwparser.cpp
+index 0e39f70..37f5c48 100644
+--- a/Tests/testfwparser.cpp
++++ b/Tests/testfwparser.cpp
+@@ -17,6 +17,8 @@
+ 
+ #include "testfwparser.h"
+ 
++#include <ktemporaryfile.h>
++
+ TestFWParser::TestFWParser(): QObject() {
+ }
+ 
+@@ -27,20 +29,15 @@ void TestFWParser::initTestCase() {
+     "                                                               
");
+   test_cases_.append("this is an ex

");
+ 
+-  QString file_name("TestFW.txt");
+-  file_name = KStandardDirs::locateLocal("appdata", file_name);
+-
+-  if (!file_name.isNull()) {
+-        test_file_.setFileName(file_name);
+-        if (!test_file_.open(QIODevice::WriteOnly)) {
+-          kWarning() << QString("Couldn't open(%1)").arg(file_name);
+-        }
+-  }
+-
+-  QTextStream out_stream(&test_file_);
++  KTemporaryFile temp_file;
++  temp_file.setSuffix(".txt");
++  temp_file.setAutoRemove(false);
++  QVERIFY(temp_file.open());
++  test_file_name_ = temp_file.fileName();
++  QTextStream out_stream(&temp_file);
+   foreach(const QString &test_case, test_cases_)
+     out_stream << test_case;
+-  test_file_.close();
++  temp_file.close();
+ 
+   //Building the sequence to be used. Includes all available types.
+   sequence_.clear();
+@@ -68,8 +65,7 @@ void TestFWParser::initTestCase() {
+   widths_.append(6);
+   widths_.append(6);  //'repeatedly' doesn't need a width
+ 
+-  QString fname = KStandardDirs::locate( "appdata", file_name );
+-  test_parser_ = new KSParser(fname, '#', sequence_, widths_);
++  test_parser_ = new KSParser(test_file_name_, '#', sequence_, widths_);
+ }
+ 
+ TestFWParser::~TestFWParser()
+@@ -156,9 +152,9 @@ void TestFWParser::FWReadMissingFile()
+    * This tests how the parser reacts if there is no file with the
+    * given path.
+   */
+-  QFile::remove(KStandardDirs::locateLocal("appdata","TestFW.txt"));
++  QFile::remove(test_file_name_);
+ 
+-  KSParser missing_parser(QString("TestFW.txt"), '#', sequence_, widths_);
++  KSParser missing_parser(test_file_name_, '#', sequence_, widths_);
+   QHash<QString, QVariant> row_content = missing_parser.ReadNextRow();
+ 
+   for (int times = 0; times < 20; times++) {
+diff --git a/Tests/testfwparser.h b/Tests/testfwparser.h
+index 280794b..625076a 100644
+--- a/Tests/testfwparser.h
++++ b/Tests/testfwparser.h
+@@ -40,7 +40,7 @@ class TestFWParser: public QObject {
+   QStringList test_cases_;
+   QList<int> widths_;
+   QList< QPair<QString, KSParser::DataTypes> > sequence_;
+-  QFile test_file_;
++  QString test_file_name_;
+   KSParser *test_parser_;
+ };
+ 
+-- 
+1.8.4.2
+

-- 
kstars packaging



More information about the pkg-kde-commits mailing list