[PATCH 4/6] Cleanup db tests

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/OpenBSC@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Mon May 9 14:50:26 UTC 2016


> On 04 May 2016, at 13:02, msuraev at sysmocom.de wrote:
> 
> From: Max <msuraev at sysmocom.de>
> 
> Move copy-pasted code into separate function to make writing more tests
> easier.


and change behavior..



> +static void test_subs(const char *alice_imsi, char *imei1, char *imei2)
> {
> -	char scratch_str[256];
> +	struct gsm_subscriber *alice = NULL, *alice_db;
> +        char scratch_str[256];

tabs vs. spaces


> +	/* Get by extension */
> +	alice_db = db_get_subscriber(GSM_SUBSCRIBER_EXTENSION, alice->extension);
> +	if (alice_db) {
> +		COMPARE(alice, alice_db);
> +		SUBSCR_PUT(alice_db);
> +	}
> +	SUBSCR_PUT(alice);

The if looks a bit weak here? So no error if the look-up code starts to break? In general I think we want to have strong post conditions. If alice_db should be !NULL then we should aggressively check for it.





More information about the OpenBSC mailing list