summaryrefslogtreecommitdiffstats
path: root/tests/gb/bssgp_fc_test.c
Commit message (Collapse)AuthorAgeFilesLines
* use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr2018-04-061-3/+5
| | | | | | | | Ironically, when deprecating osmo_init_logging() in I216837780e9405fdaec8059c63d10699c695b360, I forgot to change the callers within libosmocore itself, i.e. in the various regression tests. Change-Id: Ia36c248f99353d5baaa2533f46a2f60a8579bdf8
* bssgp_fc_test: sanitize: free fc struct when doneNeels Hofmeyr2017-11-201-0/+2
| | | | | | Helps fix sanitizer build on debian 9. Change-Id: I0ef95ee8185a4789f0732b9420243dda5104d181
* gprs_bssgp: bssgp_fc_in(): fix mem leak on queue overflowNeels Hofmeyr2017-11-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All successful and all error code paths of bssgp_fc_in() free the msgb, except the code path calling fc_enqueue() when the msg is dropped (due to queue being full, or failure to allocate). Callers could theoretically catch the -ENOSPC return value and discard the msgb. However, in other code paths, a callback's return value is returned, which is expected to free the msgb, so such callback would have to never return -ENOSPC when it freed the msgb. Much simpler semantics would be to free the msgb in every code path, no matter which kind of error occurred. Who is currently calling bssgp_fc_in and how do they handle the return value? - bssgp_fc_test.c ignores the return value (and hits a mem leak aka sanitizer build failure if the queue is full). - fc_timer_cb() ignores the return value. - bssgp_tx_dl_ud() returns the bssgp_fc_in() rc. - which is returned by a cascade of functions leading up to being returned, for example, by gprs_llgmm_reset(), which is usually called with ignored return code. At this point it is already fairly clear that bssgp_fc_in() should always free the msgb, since the callers don't seem to distinguish even between error or success, let alone between -ENOSPC or other errors. bssgp_fc_test: assert that no msgbs remain unfreed after the tests. Adjust expected results. Helps fix sanitizer build on debian 9. Change-Id: I00c62a104baeaad6a85883c380259c469aebf0df
* bssgp_fc_test: sanitizer: free msgb context when doneNeels Hofmeyr2017-11-201-0/+8
| | | | | | | | | | | | Print remaining msgbs when done, then free the entire tall_msgb_context. To be able to do that, call msgb_talloc_ctx_init() and use its return value. A subsequent patch will fix a known mem leak and add assertions for 0b in 1 blocks remaining in the tall_msgb_context. Helps fix sanitizer build on debian 9. Change-Id: I67d347ab2642b0bfc27b21b44231a7f3146ff641
* bssgp_fc_test: clarify by outputting ok / failure messagesNeels Hofmeyr2017-11-201-3/+19
| | | | | | | | | | | The test fills up the queue / sends too large PDUs on purpose. Make that obvious by outputting returned errors in the expected output. Cosmetic: - fc_in()'s return value is ignored, hence don't return anything. - add comment. Change-Id: I57d6fce2515a65f6dd037e75af5397079215cb46
* bssgp_fc_test: remove rounding to decisecondsNeels Hofmeyr2017-11-201-10/+0
| | | | | | | | Ever since this test was changed to use osmo_gettimeofday_override, the times it sees are exact every time and don't need rounding to pass the expected output. Change-Id: I4a9a5d31fc02eb55caf7ba9c141426d8115bb740
* bssgp_fc_test: do not use real timeNeels Hofmeyr2017-02-071-1/+8
| | | | | | | | | Employ osmo_gettimeofday_override_* to take bssgp_fc_test off real time. The jenkins build slave often failed the test based on sporadic time delays due to server load and randomly rejected good patches. This patch ends that. Change-Id: Ie5029b85c2a154554d75d7f9af49a3b93425fdd9 Related: OS#1809
* add osmo_gettimeofday as a shim around gettimeofdayNeels Hofmeyr2016-09-221-2/+2
| | | | | | | This allows feeding a custom time for unit tests by overriding osmo_gettimeofday. Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
* bssgp: Free msgb in case of error when calling into gprs_ns_sendmsgHolger Hans Peter Freyther2014-10-101-4/+8
| | | | | | | | | | | | | | | | | | | | | In the OsmoSGSN we have a crash with a DEAD/BLOCKED GPRS-NS and segmented SN-UNITDATA. For the caller it is not easy to know if the passed msg buffer has been freed or not. The most easy solution is to always take the ownership and either pass it on or free it in case of an error. Adjust indirect and direct callers of gprs_ns_sendmsg. I found the following call-chains with an external msgb parameter. gprs_ns_sendmsg <- _bssgp_tx_dl_ud <- bssgp_fc_in <- bssgp_tx_dl_ud Update the test to allocate a real msgb because for the test with '1000' we will msgb_free it right away. Sponsored-by: On-Waves ehf
* bssgp: Address various compiler warnings in the bssgp codeHolger Hans Peter Freyther2013-09-161-0/+3
| | | | | | | | | gb/bssgp_fc_test.c: In function ‘fc_out_cb’: gb/bssgp_fc_test.c:46:1: warning: no return statement in function returning non-void [-Wreturn-type] gb/bssgp_fc_test.c: In function ‘fc_in’: gb/bssgp_fc_test.c:56:1: warning: no return statement in function returning non-void [-Wreturn-type] gb/bssgp_fc_test.c: In function ‘test_fc’: gb/bssgp_fc_test.c:79:3: warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration]
* tests: Make the gb test work with srcdir != builddirHolger Hans Peter Freyther2012-09-111-0/+3
| | | | | | | * Disable color and printing the filename of the stderr log target, update the results * Add the .ok, .err and .sh files to the extra_dist * Execute the shell script from the source directory
* BSSGP flow-control: Add unit test for algorithm testsHarald Welte2012-09-071-0/+167