[packages/syslog-ng] - added tests-fixes patch (fixes test_python_ack_tracker test); new 4 tests failing (due to tzdata 2

qboosh qboosh at pld-linux.org
Sun Oct 25 18:42:03 CET 2020


commit 2571715fc93df9e82c9e7a06eb9c225e4196b713
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Oct 25 18:41:54 2020 +0100

    - added tests-fixes patch (fixes test_python_ack_tracker test); new 4 tests failing (due to tzdata 2020d or todays DST change?)

 syslog-ng-tests-fixes.patch | 114 ++++++++++++++++++++++++++++++++++++++++++++
 syslog-ng.spec              |   4 ++
 2 files changed, 118 insertions(+)
---
diff --git a/syslog-ng.spec b/syslog-ng.spec
index dd2dd85..1a7b820 100644
--- a/syslog-ng.spec
+++ b/syslog-ng.spec
@@ -59,6 +59,9 @@ Source6:	https://github.com/buytenh/ivykis/archive/v%{libivykis_version}/ivykis-
 %endif
 Source7:	syslog-ng.service
 Patch0:		%{name}-datadir.patch
+# https://github.com/syslog-ng/syslog-ng/commit/1d90d844a39eb25ac3423f663b0409f61a064330.patch
+# https://github.com/syslog-ng/syslog-ng/commit/46fa90bdd3adee5bcbb2687cf00c08925c504c07.patch
+Patch1:		%{name}-tests-fixes.patch
 Patch2:		%{name}-nolibs.patch
 Patch3:		%{name}-systemd.patch
 Patch4:		man-paths.patch
@@ -366,6 +369,7 @@ rmdir lib/ivykis
 %endif
 
 %patch0 -p1
+%patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
diff --git a/syslog-ng-tests-fixes.patch b/syslog-ng-tests-fixes.patch
new file mode 100644
index 0000000..7fc8c05
--- /dev/null
+++ b/syslog-ng-tests-fixes.patch
@@ -0,0 +1,114 @@
+From 1d90d844a39eb25ac3423f663b0409f61a064330 Mon Sep 17 00:00:00 2001
+From: Kokan <kokaipeter at gmail.com>
+Date: Thu, 27 Aug 2020 23:44:30 +0200
+Subject: [PATCH] python/ack_tracker/test: remove dead code
+
+Signed-off-by: Kokan <kokaipeter at gmail.com>
+---
+ modules/python/tests/test_python_ack_tracker.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/modules/python/tests/test_python_ack_tracker.c b/modules/python/tests/test_python_ack_tracker.c
+index a9ac43f687..2e42e75f3f 100644
+--- a/modules/python/tests/test_python_ack_tracker.c
++++ b/modules/python/tests/test_python_ack_tracker.c
+@@ -121,7 +121,6 @@ ParameterizedTest(struct AckTrackerFactoryTestParams *param, python_ack_tracker,
+   PyGILState_STATE gstate = PyGILState_Ensure();
+ 
+   PyObject *factory_args = Py_BuildValue("(N)", PyCFunction_New(&test_ack_callback, NULL));
+-  log_msg_new_empty();
+   PyObject *py_ack_tracker_factory_obj = PyObject_CallObject((PyObject *) param->ack_tracker_factory_type,
+                                                              factory_args);
+   Py_XDECREF(factory_args);
+From 46fa90bdd3adee5bcbb2687cf00c08925c504c07 Mon Sep 17 00:00:00 2001
+From: Kokan <kokaipeter at gmail.com>
+Date: Thu, 27 Aug 2020 23:44:30 +0200
+Subject: [PATCH] python/ack_tracker/test: split parameterized test
+
+Parameterized tests are the worst in Criterion. Specially with pointers and ASLR.
+
+Causes test to fail when executed with ASAN:
+```
+==3181004==ERROR: AddressSanitizer: SEGV on unknown address 0x7faeee7938a8 (pc 0x7f0f053880e7 bp 0x7faeee7938a0 sp 0x7ffe7fe59510 T0)
+==3181004==The signal is caused by a READ memory access.
+    #0 0x7f0f053880e7 in PyObject_Call (/usr/lib/libpython3.8.so.1.0+0x1420e7)
+    #1 0x4f7f7c in python_ack_tracker_test_ack_tracker_factory_impl /home/kokan/src/syslog-ng/build/../modules/python/tests/test_python_ack_tracker.c:124:42
+    #2 0x7f0f05225e3e in criterion_internal_test_main (/usr/lib/libcriterion.so.3+0x8e3e)
+    #3 0x4f7e34 in python_ack_tracker_test_ack_tracker_factory_jmp /home/kokan/src/syslog-ng/build/../modules/python/tests/test_python_ack_tracker.c:119:1
+    #4 0x7f0f05225308  (/usr/lib/libcriterion.so.3+0x8308)
+    #5 0x7f0f05236b4c  (/usr/lib/libcriterion.so.3+0x19b4c)
+    #6 0x7f0f04626151 in __libc_start_main (/usr/lib/libc.so.6+0x28151)
+    #7 0x41f43d in _start (/home/kokan/src/syslog-ng/build/modules/python/tests/Debug/test_python_ack_tracker+0x41f43d)
+```
+
+Signed-off-by: Kokan <kokaipeter at gmail.com>
+---
+ .../python/tests/test_python_ack_tracker.c    | 39 +++++++++++--------
+ 1 file changed, 22 insertions(+), 17 deletions(-)
+
+diff --git a/modules/python/tests/test_python_ack_tracker.c b/modules/python/tests/test_python_ack_tracker.c
+index 2e42e75f3f..b573dc0249 100644
+--- a/modules/python/tests/test_python_ack_tracker.c
++++ b/modules/python/tests/test_python_ack_tracker.c
+@@ -97,31 +97,36 @@ struct AckTrackerFactoryTestParams
+   AckTrackerType expected_ack_tracker_type;
+ };
+ 
+-ParameterizedTestParameters(python_ack_tracker, test_ack_tracker_factory)
++Test(python_ack_tracker, test_instant_ack_tracker_factory)
+ {
+-  static struct AckTrackerFactoryTestParams params[2];
++  PyGILState_STATE gstate = PyGILState_Ensure();
+ 
+-  /* PyAckTrackerFactory types and AckTrackerFactoryTestParams are all globals.
+-   * Static initialization order is undefined.
+-   */
+-  params[0] = (struct AckTrackerFactoryTestParams)
+-  {
+-    &py_instant_ack_tracker_factory_type, ACK_INSTANT
+-  };
+-  params[1] = (struct AckTrackerFactoryTestParams)
+-  {
+-    &py_consecutive_ack_tracker_factory_type, ACK_CONSECUTIVE
+-  };
++  PyObject *factory_args = Py_BuildValue("(N)", PyCFunction_New(&test_ack_callback, NULL));
++
++  PyObject *py_ack_tracker_factory_obj = PyObject_CallObject((PyObject *) &py_instant_ack_tracker_factory_type,
++                                                             factory_args);
++  Py_XDECREF(factory_args);
++
++  cr_assert_not_null(py_ack_tracker_factory_obj);
++  cr_assert(py_is_ack_tracker_factory(py_ack_tracker_factory_obj));
++
++  PyAckTrackerFactory *py_ack_tracker_factory = (PyAckTrackerFactory *) py_ack_tracker_factory_obj;
++  cr_assert_not_null(py_ack_tracker_factory->ack_tracker_factory);
++  cr_assert_eq(ack_tracker_factory_get_type(py_ack_tracker_factory->ack_tracker_factory),
++               ACK_INSTANT);
+ 
+-  return cr_make_param_array(struct AckTrackerFactoryTestParams, params, G_N_ELEMENTS(params));
++  Py_XDECREF(py_ack_tracker_factory);
++  PyGILState_Release(gstate);
+ }
+ 
+-ParameterizedTest(struct AckTrackerFactoryTestParams *param, python_ack_tracker, test_ack_tracker_factory)
++
++Test(python_ack_tracker, test_consecutive_ack_tracker_factory)
+ {
+   PyGILState_STATE gstate = PyGILState_Ensure();
+ 
+   PyObject *factory_args = Py_BuildValue("(N)", PyCFunction_New(&test_ack_callback, NULL));
+-  PyObject *py_ack_tracker_factory_obj = PyObject_CallObject((PyObject *) param->ack_tracker_factory_type,
++
++  PyObject *py_ack_tracker_factory_obj = PyObject_CallObject((PyObject *) &py_consecutive_ack_tracker_factory_type,
+                                                              factory_args);
+   Py_XDECREF(factory_args);
+ 
+@@ -131,7 +136,7 @@ ParameterizedTest(struct AckTrackerFactoryTestParams *param, python_ack_tracker,
+   PyAckTrackerFactory *py_ack_tracker_factory = (PyAckTrackerFactory *) py_ack_tracker_factory_obj;
+   cr_assert_not_null(py_ack_tracker_factory->ack_tracker_factory);
+   cr_assert_eq(ack_tracker_factory_get_type(py_ack_tracker_factory->ack_tracker_factory),
+-               param->expected_ack_tracker_type);
++               ACK_CONSECUTIVE);
+ 
+   Py_XDECREF(py_ack_tracker_factory);
+   PyGILState_Release(gstate);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/syslog-ng.git/commitdiff/2571715fc93df9e82c9e7a06eb9c225e4196b713



More information about the pld-cvs-commit mailing list