Change in libosmocore[master]: msgb: add test helpers

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Dec 3 17:48:15 UTC 2018


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 <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Comment-Date: Mon, 03 Dec 2018 17:48:15 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181203/0f4be6eb/attachment.htm>


More information about the gerrit-log mailing list