Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/12017 )

Change subject: msgb: add test helpers
......................................................................


Patch Set 5: Code-Review+1

(1 comment)

nice idea to add general tests helpers. Things that complicate the idea:

- tests often have different output scenarios: 
{printf,LOG}x{stdout,stderr}x{checked,unchecked} so I usually end up tailoring 
the debug output to the specific test. fprintf(stdout) is ok in test.c but not 
in libosmocore API.

- when an error occurs, I sometimes needed the position of the difference 
indicated (usually only during development cycles)

- usually when I write tests, I use hex strings instead of buffers, because 
they are easily editable and imply the length.

It's not so easy to accomodate all current test styles, but we could with this 
API define how tests should be written from now on. Could add hex string API 
(in a later patch?) and could add difference position indicator (in a later 
patch?).

Might be interesting to take a look through other msgb/buffer printing routines 
flying around in various tests today? Maybe figure out a smaller set of API 
satisfying all cases?

https://gerrit.osmocom.org/#/c/12017/5/src/msgb.c
File src/msgb.c:

https://gerrit.osmocom.org/#/c/12017/5/src/msgb.c@198
PS5, Line 198: printf
> ACK
one slight problem with LOGP could be that in regression tests, we often only 
check stdout.



--
To view, visit https://gerrit.osmocom.org/12017
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I3bc95f2f5ab6e3f4b502647fb3e0aaaf1f7c4cf5
Gerrit-Change-Number: 12017
Gerrit-PatchSet: 5
Gerrit-Owner: Max <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Vadim Yanitskiy <[email protected]>
Gerrit-Comment-Date: Mon, 03 Dec 2018 17:48:15 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes

Reply via email to