Change in openvpn[master]: Move schedule test to a unit test
A message that is not in the archive (sent off-list or not yet received): gerrit.1785239387000.Ie33aea26026e07c860da7d79880cef6b27b7b0e8@gerrit.openvpn.net
plaisthos has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
9 files changed, 357 insertions(+), 326 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/1
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -0
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -378,6 +379,9 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +8 -0
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,13 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), +<<<<<<< HEADcmocka_unit_test (test_atoi_variants) +======= +cmocka_unit_test (test_atoi_variants), +cmocka_unit_test (test_sid_hash_list), +cmocka_unit_test (schedule_test), +>>>>>>> 905c36ce5 (Move schedule test to a unit test) };int
tests/unit_tests/openvpn/test_schedule.c new file +295 -0
295 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2026 OpenVPN Inc <[email protected]> +* Copyright (C) 2026 Arne Schwabe <[email protected]> +* +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 1:
(3 comments)
Patchset:
PS1:
why did you decide to include this test in test_misc instead of creating its own runner? You did create its own .c file after all.
File tests/unit_tests/openvpn/Makefile.am:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/4064001a_d4143870?usp=email :
PS1, Line 373: test_schedule.c test_schedule.h \
wrong whitespace
File tests/unit_tests/openvpn/test_schedule.h:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/585e31f0_f653f8b1?usp=email :
PS1, Line 23: * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. old style header, please use current one
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Tue, 28 Jul 2026 12:04:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 1: Code-Review-1
(1 comment)
File tests/unit_tests/openvpn/test_misc.c:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/bf184d19_1d7d5c8d?usp=email :
PS1, Line 493: <<<<<<< HEAD
conflict resolution damage
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Tue, 28 Jul 2026 12:01:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 397 insertions(+), 400 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/2
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -0
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -378,6 +379,9 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +8 -0
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,13 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), +<<<<<<< HEADcmocka_unit_test (test_atoi_variants) +======= +cmocka_unit_test (test_atoi_variants), +cmocka_unit_test (test_sid_hash_list), +cmocka_unit_test (schedule_test), +>>>>>>> 905c36ce5 (Move schedule test to a unit test) };int
tests/unit_tests/openvpn/test_schedule.c new file +335 -0
335 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2026 OpenVPN Inc <[email protected]> +* Copyright (C) 2026 Arne Schwabe <[email protected]> +* +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
to look at the new patch set (#3).
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 390 insertions(+), 400 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/3
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -0
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -378,6 +379,9 @@ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +8 -0
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,13 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), +<<<<<<< HEADcmocka_unit_test (test_atoi_variants) +======= +cmocka_unit_test (test_atoi_variants), +cmocka_unit_test (test_sid_hash_list), +cmocka_unit_test (schedule_test), +>>>>>>> 905c36ce5 (Move schedule test to a unit test) };int
tests/unit_tests/openvpn/test_schedule.c new file +332 -0
332 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 2:
(3 comments)
Patchset:
PS1:
Quoted 1 line
why did you decide to include this test in
test_miscinstead of creating its own runner? You did cre […]
I don't think we need more test runners. We already have a quite a lot. But I still wanted to have it in its own C file to seperate the code.
File tests/unit_tests/openvpn/Makefile.am:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/480750f8_e68355c4?usp=email :
PS1, Line 373: test_schedule.c test_schedule.h \
Quoted 1 line
wrong whitespace
Done
File tests/unit_tests/openvpn/test_schedule.h:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/c822d468_63f4382d?usp=email :
PS1, Line 23: * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Quoted 1 line
old style header, please use current one
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Tue, 28 Jul 2026 12:16:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
to look at the new patch set (#4).
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 386 insertions(+), 402 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/4
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +332 -0
332 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 4:
(1 comment)
File tests/unit_tests/openvpn/test_misc.c:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/e034f826_acc38827?usp=email :
PS1, Line 493: <<<<<<< HEAD
Quoted 1 line
conflict resolution damage
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Tue, 28 Jul 2026 12:36:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 4: Code-Review-1
(3 comments)
File tests/unit_tests/openvpn/test_schedule.c:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/6917016e_d4b4df7a?usp=email :
PS4, Line 91: ASSERT(e != e->lt);
We should change these to proper cmocka asserts, but not sure whether it is better to do that in a separate commit?
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/c1735282_e178d672?usp=email :
PS4, Line 168: #else /* if 1 */
Does this code still have value? If so, then we should integrate it into the test. If not, maybe just delete it?
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/3ce2fabc_9e5f4fc4?usp=email :
PS4, Line 173: struct gc_arena gc = gc_new();
gc seems to be unused?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Wed, 29 Jul 2026 12:01:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
to look at the new patch set (#5).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 364 insertions(+), 402 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/5
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +310 -0
310 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 4:
(3 comments)
File tests/unit_tests/openvpn/test_schedule.c:
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/f593a9d2_556a11ff?usp=email :
PS4, Line 91: ASSERT(e != e->lt);
Quoted 1 line
We should change these to proper cmocka asserts, but not sure whether it is better to do that in a s […]
Done. I think it is okay to in the same commit as this is a unit test rather than code that is run in production.
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/c52a43d2_a945fe3a?usp=email :
PS4, Line 168: #else /* if 1 */
Quoted 1 line
Does this code still have value? If so, then we should integrate it into the test. […]
Done
http://gerrit.openvpn.net/c/openvpn/+/1828/comment/8118172d_b4beb993?usp=email :
PS4, Line 173: struct gc_arena gc = gc_new();
Quoted 1 line
gc seems to be unused?
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]>
Gerrit-Comment-Date: Wed, 29 Jul 2026 18:41:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Patch Set 5: Code-Review+2
(1 comment)
Patchset:
PS1:
Quoted 1 line
I don't think we need more test runners. We already have a quite a lot. […]
Acknowledged
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
Gerrit-Comment-Date: Thu, 30 Jul 2026 10:12:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos <[email protected]>
Comment-In-Reply-To: flichtenheld <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH v5 1/1 Move schedule test to a unit test
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]>
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +310 -0
310 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH applied] Re: Move schedule test to a unit test
Nice cleanup :-) - and the test succeeds.
[ RUN ] schedule_test
[ OK ] schedule_test
Your patch has been applied to the master branch.
commit 4babf1873d905e8ddf0e388bb8d9ee4690738ed8
Author: Arne Schwabe Date: Thu Jul 30 12:16:16 2026 +0200
Move schedule test to a unit test
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38056.html
--
kind regards,
Gert Doering
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH v5 1/1 Move schedule test to a unit test
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]>
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
This mail reflects revision 5 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +310 -0
310 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
cron2 has uploaded a new patch set (#6) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38056.html
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 364 insertions(+), 402 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/28/1828/6
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +310 -0
310 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email )
Change subject: Move schedule test to a unit test
......................................................................
Move schedule test to a unit test
While this test might not be extremely useful this change removes the dead code from init.c and schedule.c and moves it to a unit test.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1828
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg38056.html
---
M CMakeLists.txt
M src/openvpn/init.c
M src/openvpn/otime.h
M src/openvpn/schedule.c
M src/openvpn/schedule.h
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h
M tests/unit_tests/openvpn/test_misc.c
A tests/unit_tests/openvpn/test_schedule.c
A tests/unit_tests/openvpn/test_schedule.h
10 files changed, 364 insertions(+), 402 deletions(-)
CMakeLists.txt +5 -1
@@ -828,10 +828,14 @@ target_sources(test_misc PRIVATE tests/unit_tests/openvpn/mock_get_random.c + tests/unit_tests/openvpn/test_schedule.c src/openvpn/options_util.c + src/openvpn/otime.c src/openvpn/ssl_util.c src/openvpn/list.c - ) + src/openvpn/session_id.c + src/openvpn/schedule.c + ) target_sources(test_ncp PRIVATE src/openvpn/crypto_epoch.c
src/openvpn/init.c +1 -5
@@ -53,6 +53,7 @@#include "mudp.h" #include "dco.h" #include "tun_afunix.h" +#include "schedule.h" #include "memdbg.h"
@@ -876,11 +877,6 @@init_ssl_lib (); -#ifdef SCHEDULE_TEST -schedule_test (); -return false; -#endif -#ifdef IFCONFIG_POOL_TEST ifconfig_pool_test (0x0A010004 ,0x0A0100FF );return false;
src/openvpn/otime.h +0 -74
80 lines not on this page · raw message
src/openvpn/schedule.c +2 -311
353 lines not on this page · raw message
src/openvpn/schedule.h +10 -8
@@ -34,9 +34,6 @@* a ping or scheduling a TLS renegotiation. */ -/* define to enable a special test mode */ -/*#define SCHEDULE_TEST*/ -#include "otime.h" #include "error.h"
@@ -63,11 +60,6 @@void schedule_remove_entry (struct schedule *s,struct schedule_entry *e); -#ifdef SCHEDULE_TEST -void schedule_test (void ); - -#endif -/* Private Functions */ /* is node already in tree? */
@@ -139,4 +131,14 @@ return ret; } +/** +* This method compares two schedule entries and return which one is +* earlier,later or equal. +* +* A key is simply a struct timeval containing the absolute time for +* an event. The unique treap priority (pri) is used to ensure +* that keys do not collide. +*/ +int +schedule_entry_compare (const struct schedule_entry *e1,const struct schedule_entry *e2);#endif /* ifndef SCHEDULE_H */
tests/unit_tests/openvpn/Makefile.am +4 -1
@@ -370,6 +370,7 @@ misc_testdriver_LDFLAGS = @TEST_LDFLAGS@ misc_testdriver_SOURCES = test_misc.c \ + test_schedule.c test_schedule.h \ mock_msg.c test_common.h \ mock_get_random.c \ $(top_srcdir)/src/openvpn/buffer.c \
@@ -377,7 +378,9 @@ $(top_srcdir)/src/openvpn/ssl_util.c \ $(top_srcdir)/src/openvpn/win32-util.c \ $(top_srcdir)/src/openvpn/platform.c \ - $(top_srcdir)/src/openvpn/list.c + $(top_srcdir)/src/openvpn/list.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/schedule.c push_update_msg_testdriver_CFLAGS = -I$(top_srcdir)/src/openvpn \ -I$(top_srcdir)/src/compat \
tests/unit_tests/openvpn/test_common.h +1 -1
@@ -78,7 +78,7 @@* @param filename name of the filename to retrieve relative to the * unit test source directory */ -void +static inline void openvpn_test_get_srcdir_dir (char *buf,size_t bufsize,const char *filename) {const char *srcdir =getenv ("srcdir" );
tests/unit_tests/openvpn/test_misc.c +4 -1
@@ -41,6 +41,8 @@#ifdef _WIN32#include "win32-util.h" #endif +#include "test_schedule.h" +static void test_compat_lzo_string (void **state)
@@ -488,7 +490,8 @@cmocka_unit_test (test_auth_fail_temp_flags),cmocka_unit_test (test_auth_fail_temp_flags_msg),cmocka_unit_test (test_list), - cmocka_unit_test(test_atoi_variants) +cmocka_unit_test (test_atoi_variants), + cmocka_unit_test(schedule_test) };int
tests/unit_tests/openvpn/test_schedule.c new file +310 -0
310 lines not on this page · raw message
tests/unit_tests/openvpn/test_schedule.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* OpenVPN -- An application to securely tunnel IP networks +* over a single TCP/UDP port, with support for SSL/TLS-based +* session authentication and key exchange, +* packet encryption, packet authentication, and +* packet compression. +* +* Copyright (C) 2002-2026 OpenVPN Inc <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 +* as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, see <https://www.gnu.org/licenses/>. +*/ +#ifndef SCHEDULE_TEST_H +#define SCHEDULE_TEST_H +/** Runs the schedule test */ +void +schedule_test (void **state); +#endif
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1828?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie33aea26026e07c860da7d79880cef6b27b7b0e8
Gerrit-Change-Number: 1828
Gerrit-PatchSet: 6
Gerrit-Owner: plaisthos <[email protected]>
Gerrit-Reviewer: flichtenheld <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel