Change in openvpn[master]: Add unit tests for atoi parsing options helper
A message that is not in the archive (sent off-list or not yet received): gerrit.1737979301000.Ieee368e325d7f9c367fd91fee0fd3e281ee0855d@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
to review the following change.
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Add unit tests for atoi parsing options helper
Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
---
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/test_misc.c
3 files changed, 108 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/876/1
tests/unit_tests/openvpn/mock_msg.c +25 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,13 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +vprintf (format, arglist); +printf ("\n" ); + } +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 1024 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
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: Mon, 27 Jan 2025 12:26:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 Add unit tests for atoi parsing options helper
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
---
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/+/876
This mail reflects revision 1 of this Change.
Signed-off-by line for the author was added as per our policy.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
tests/unit_tests/openvpn/mock_msg.c +25 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,13 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +vprintf (format, arglist); +printf ("\n" ); + } +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 1024 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
Attention is currently required from: plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Patch Set 1: Code-Review-2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 27 Jan 2025 12:39:56 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
Hello cron2, flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Add unit tests for atoi parsing options helper
---
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/test_misc.c
3 files changed, 109 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/876/2
tests/unit_tests/openvpn/mock_msg.c +26 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,14 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); + +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +printf ("%s" , mock_msg_buf); +printf ("\n" ); + } }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 2048 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Jan 2025 14:27:12 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Patch Set 2: -Code-Review
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 28 Jan 2025 17:58:42 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v2 1/1 Add unit tests for atoi parsing options helper
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
---
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/+/876
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>
tests/unit_tests/openvpn/mock_msg.c +26 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,14 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); + +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +printf ("%s" , mock_msg_buf); +printf ("\n" ); + } }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 2048 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
[Openvpn-devel] [PATCH applied] Re: Add unit tests for atoi parsing options helper
Unit tests are good, and in v2, they actually pass without explosions :-)
Your patch has been applied to the master branch.
commit 2a6dbf5c6d8666a0dff586f36a867b8509d2f28d
Author: Arne Schwabe Date: Tue Jan 28 18:58:55 2025 +0100
Add unit tests for atoi parsing options helper
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Frank Lichtenheld <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30671.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Add unit tests for atoi parsing options helper
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30671.html
---
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/test_misc.c
3 files changed, 109 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/76/876/3
tests/unit_tests/openvpn/mock_msg.c +26 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,14 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); + +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +printf ("%s" , mock_msg_buf); +printf ("\n" ); + } }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 2048 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/876?usp=email )
Change subject: Add unit tests for atoi parsing options helper
......................................................................
Add unit tests for atoi parsing options helper
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg30671.html
---
M tests/unit_tests/openvpn/mock_msg.c
M tests/unit_tests/openvpn/mock_msg.h
M tests/unit_tests/openvpn/test_misc.c
3 files changed, 109 insertions(+), 3 deletions(-)
tests/unit_tests/openvpn/mock_msg.c +26 -2
@@ -37,10 +37,16 @@#include "errlevel.h" #include "error.h" +#include "mock_msg.h" unsigned int x_debug_level =0 ;/* Default to (almost) no debugging output */ +unsigned int print_x_debug_level =0 ; +bool fatal_error_triggered = false; +char mock_msg_buf[MOCK_MSG_BUF ]; + +void mock_set_debug_level (int level) {
@@ -48,6 +54,18 @@ }int +mock_get_debug_level (void ) +{ +return x_debug_level; +} + +void +mock_set_print_debug_level (int level) +{ + print_x_debug_level = level; +} + +int get_debug_level (void ) {return x_debug_level;
@@ -62,8 +80,14 @@ fatal_error_triggered = true;printf ("FATAL ERROR:" ); } -vprintf (format, arglist); -printf ("\n" ); +CLEAR (mock_msg_buf); +vsnprintf (mock_msg_buf,sizeof (mock_msg_buf), format, arglist); + +if ((flags &M_DEBUG_LEVEL ) <= print_x_debug_level) + { +printf ("%s" , mock_msg_buf); +printf ("\n" ); + } }void
tests/unit_tests/openvpn/mock_msg.h +14 -0
@@ -31,4 +31,18 @@*/ void mock_set_debug_level (int level); +#define MOCK_MSG_BUF 2048 + +extern bool fatal_error_triggered; +extern char mock_msg_buf[MOCK_MSG_BUF ]; + +void +mock_set_debug_level (int level); + +int +mock_get_debug_level (void ); + +void +mock_set_print_debug_level (int level); +#endif /* MOCK_MSG */
tests/unit_tests/openvpn/test_misc.c +69 -1
88 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/876?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ieee368e325d7f9c367fd91fee0fd3e281ee0855d
Gerrit-Change-Number: 876
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged