aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/kpmcore-remove-broken-test.patch
blob: d02cca788308318e6d24281a8b1443c1f476c7fb (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
From c9a08a593bac8b8610a647db118fea6f2958156d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= <andrius@stikonas.eu>
Date: Thu, 7 Nov 2019 22:12:00 +0000
Subject: [PATCH] Remove broken smart unit test.

BUG: 413853
---
 test/CMakeLists.txt |   9 ----
 test/testsmart.cpp  | 102 --------------------------------------------
 2 files changed, 111 deletions(-)
 delete mode 100644 test/testsmart.cpp

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 67f63a2..6a300d3 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -53,12 +53,3 @@ find_package (Threads)
 # Execute external commands as root
 kpm_test(testexternalcommand testexternalcommand.cpp)
 add_test(NAME testexternalcommand COMMAND testexternalcommand ${BACKEND})
-
-# Including SMART files reference
-set(SMARTPARSER ${CMAKE_SOURCE_DIR}/src/core/smartdiskinformation.cpp
-                ${CMAKE_SOURCE_DIR}/src/core/smartattributeparseddata.cpp
-                ${CMAKE_SOURCE_DIR}/src/core/smartparser.cpp)
-
-# Test SMART support
-kpm_test(testsmart testsmart.cpp ${SMARTPARSER})
-add_test(NAME testsmart COMMAND testsmart ${BACKEND})
diff --git a/test/testsmart.cpp b/test/testsmart.cpp
deleted file mode 100644
index 2236af7..0000000
--- a/test/testsmart.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-#include "helpers.h"
-
-#include "util/externalcommand.h"
-#include "backend/corebackend.h"
-#include "backend/corebackendmanager.h"
-#include "core/smartstatus.h"
-#include "core/smartparser.h"
-
-#include <QCoreApplication>
-#include <QDebug>
-
-static QString getDefaultDevicePath();
-static bool testSmartStatus();
-static bool testSmartParser();
-
-int main(int argc, char **argv)
-{
-    QCoreApplication app(argc, argv);
-
-    KPMCoreInitializer i;
-
-    if (argc == 2)
-        i = KPMCoreInitializer(argv[1]);
-
-    if (!i.isValid())
-        return 1;
-
-    CoreBackend *backend = CoreBackendManager::self()->backend();
-
-    if (!backend)
-    {
-        qWarning() << "Couldn't get backend.";
-        return 1;
-    }
-
-    if (!testSmartStatus() || !testSmartParser())
-        return 1;
-
-    return app.exec();
-}
-
-static QString getDefaultDevicePath()
-{
-    // Getting default home partition using 'df -P /home | awk 'END{print $1}'' command
-    ExternalCommand command(QStringLiteral("df"), { QStringLiteral("-P"), QStringLiteral("/home"), QStringLiteral("|"),
-                                                    QStringLiteral("awk"), QStringLiteral("\'END{print $1}\'") });
-
-    if (command.run() && command.exitCode() == 0) {
-        QString output = command.output();
-        return output;
-    }
-
-    return QString();
-}
-
-static bool testSmartStatus()
-{
-    QString devicePath = getDefaultDevicePath();
-
-    SmartStatus smart(devicePath);
-
-    if (smart.devicePath() != devicePath)
-        return false;
-
-    if (!smart.status())
-        return false;
-
-    if (smart.modelName() == QString())
-        return false;
-
-    if (smart.firmware() == QString())
-        return false;
-
-    if (smart.serial() == QString())
-        return false;
-
-    if (smart.selfTestStatus() != SmartStatus::SelfTestStatus::Success)
-        return false;
-
-    if (!smart.isValid())
-        return false;
-
-    return true;
-}
-
-static bool testSmartParser()
-{
-    QString devicePath = getDefaultDevicePath();
-
-    SmartParser parser(devicePath);
-
-    if (!parser.init())
-        return false;
-
-    if (parser.devicePath() != devicePath)
-        return false;
-
-    if (!parser.diskInformation())
-        return false;
-
-    return true;
-}
-- 
2.17.1