summaryrefslogtreecommitdiff
path: root/net-irc/znc/files/znc-1.9.0-skip-modperl-modpython-tests-cleaner.patch
blob: fae99b5d65830ff97ef596eb55718b50be8b934e (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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
https://github.com/znc/znc/commit/f8552fc814ebe662a9fc16d6cafa1c0314498971

From f8552fc814ebe662a9fc16d6cafa1c0314498971 Mon Sep 17 00:00:00 2001
From: Alexey Sokolov <alexey+znc@asokolov.org>
Date: Sun, 25 Feb 2024 14:12:53 +0000
Subject: [PATCH] Skip modperl/modpython tests cleaner

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -411,6 +411,8 @@ else()
 endif()
 
 configure_file("include/znc/zncconfig.h.cmake.in" "include/znc/zncconfig.h")
+configure_file("test/integration/znctestconfig.h.cmake.in"
+	"test/integration/znctestconfig.h")
 add_subdirectory(include)
 add_subdirectory(src)
 add_subdirectory(modules)
--- a/test/integration/CMakeLists.txt
+++ b/test/integration/CMakeLists.txt
@@ -45,6 +45,7 @@ add_executable(inttest
 target_link_libraries(inttest Qt5::Network Threads::Threads)
 target_include_directories(inttest PUBLIC
 	"${PROJECT_SOURCE_DIR}/framework"
+	"${PROJECT_BINARY_DIR}"
 	"${GTEST_ROOT}" "${GTEST_ROOT}/include"
 	"${GMOCK_ROOT}" "${GMOCK_ROOT}/include")
 target_compile_definitions(inttest PRIVATE
--- a/test/integration/tests/core.cpp
+++ b/test/integration/tests/core.cpp
@@ -14,9 +14,11 @@
  * limitations under the License.
  */
 
+#include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
 #include "znctest.h"
+#include "znctestconfig.h"
 
 using testing::HasSubstr;
 using testing::ContainsRegex;
@@ -584,10 +586,9 @@ TEST_P(AllLanguages, ServerDependentCapInModule) {
             )");
             break;
         case 2:
-            if (QProcessEnvironment::systemEnvironment().value(
-                    "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-                return;
-            }
+#ifndef WANT_PYTHON
+            GTEST_SKIP() << "Modpython is disabled";
+#endif
             znc->CanLeak();
             InstallModule("testmod.py", R"(
                 import znc
@@ -603,10 +604,9 @@ TEST_P(AllLanguages, ServerDependentCapInModule) {
             client.Write("znc loadmod modpython");
             break;
         case 3:
-            if (QProcessEnvironment::systemEnvironment().value(
-                    "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-                return;
-            }
+#ifndef WANT_PERL
+            GTEST_SKIP() << "Modperl is disabled";
+#endif
             znc->CanLeak();
             InstallModule("testmod.pm", R"(
                 package testmod;
--- a/test/integration/tests/scripting.cpp
+++ b/test/integration/tests/scripting.cpp
@@ -15,15 +15,15 @@
  */
 
 #include "znctest.h"
+#include "znctestconfig.h"
 
 namespace znc_inttest {
 namespace {
 
 TEST_F(ZNCTest, Modperl) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PERL
+    GTEST_SKIP() << "Modperl is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
     auto ircd = ConnectIRCd();
@@ -37,10 +37,9 @@ TEST_F(ZNCTest, Modperl) {
 }
 
 TEST_F(ZNCTest, Modpython) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
     auto ircd = ConnectIRCd();
@@ -65,10 +64,9 @@ TEST_F(ZNCTest, Modpython) {
 }
 
 TEST_F(ZNCTest, ModpythonSocket) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -107,10 +105,9 @@ TEST_F(ZNCTest, ModpythonSocket) {
 }
 
 TEST_F(ZNCTest, ModperlSocket) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PERL
+    GTEST_SKIP() << "Modperl is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -160,10 +157,9 @@ TEST_F(ZNCTest, ModperlSocket) {
 }
 
 TEST_F(ZNCTest, ModpythonVCString) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -185,10 +181,9 @@ TEST_F(ZNCTest, ModpythonVCString) {
 }
 
 TEST_F(ZNCTest, ModperlVCString) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PERL
+    GTEST_SKIP() << "Modperl is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -214,10 +209,9 @@ TEST_F(ZNCTest, ModperlVCString) {
 }
 
 TEST_F(ZNCTest, ModperlNV) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PERL
+    GTEST_SKIP() << "Modperl is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -244,10 +238,9 @@ TEST_F(ZNCTest, ModperlNV) {
 }
 
 TEST_F(ZNCTest, ModpythonPackage) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -285,10 +278,12 @@ TEST_F(ZNCTest, ModpythonPackage) {
 }
 
 TEST_F(ZNCTest, ModpythonModperl) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
+#ifndef WANT_PERL
+    GTEST_SKIP() << "Modperl is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
@@ -302,11 +297,9 @@ TEST_F(ZNCTest, ModpythonModperl) {
 }
 
 TEST_F(ZNCTest, ModpythonCommand) {
-    if (QProcessEnvironment::systemEnvironment().value(
-            "DISABLED_ZNC_PERL_PYTHON_TEST") == "1") {
-        return;
-    }
-
+#ifndef WANT_PYTHON
+    GTEST_SKIP() << "Modpython is disabled";
+#endif
     auto znc = Run();
     znc->CanLeak();
 
--- /dev/null
+++ b/test/integration/znctestconfig.h.cmake.in
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2004-2024 ZNC, see the NOTICE file for details.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ZNCTESTCONFIG_H
+#define ZNCTESTCONFIG_H
+
+#cmakedefine WANT_PYTHON 1
+#cmakedefine WANT_PERL 1
+
+#endif /* ZNCTESTCONFIG_H */