aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gb/bssgp_fc_test.c
AgeCommit message (Collapse)AuthorFilesLines
2021-02-20Drop use of log_set_print_filename() API inside libosmocorePau Espin Pedrol1-1/+1
Let's use log_set_print_filename2() API instead, which has less ackward behavior implications like changing the print status of category-hex. Related: OS#5034 Change-Id: Ifc78e1dcba5baf0b41f6ccbbbd1e3f06552d73da
2021-02-20tests: Set print_category values explicitlyPau Espin Pedrol1-0/+2
This will alow easily changing default values for print_category vs print_category_hex later. In any case, every test relying on logging output validation should always explicitly state the config to avoid issues in the future if default values change. Related: OS#5034 Change-Id: If29b40557d5c2bcda04b964f344070bad58d8f28
2018-04-06use osmo_init_logging2() with proper talloc ctxNeels Hofmeyr1-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
2017-11-20bssgp_fc_test: sanitize: free fc struct when doneNeels Hofmeyr1-0/+2
Helps fix sanitizer build on debian 9. Change-Id: I0ef95ee8185a4789f0732b9420243dda5104d181
2017-11-20gprs_bssgp: bssgp_fc_in(): fix mem leak on queue overflowNeels Hofmeyr1-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
2017-11-20bssgp_fc_test: sanitizer: free msgb context when doneNeels Hofmeyr1-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
2017-11-20bssgp_fc_test: clarify by outputting ok / failure messagesNeels Hofmeyr1-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
2017-11-20bssgp_fc_test: remove rounding to decisecondsNeels Hofmeyr1-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
2017-02-07bssgp_fc_test: do not use real timeNeels Hofmeyr1-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
2016-09-22add osmo_gettimeofday as a shim around gettimeofdayNeels Hofmeyr1-2/+2
This allows feeding a custom time for unit tests by overriding osmo_gettimeofday. Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
2014-10-10bssgp: Free msgb in case of error when calling into gprs_ns_sendmsgHolger Hans Peter Freyther1-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
2013-09-16bssgp: Address various compiler warnings in the bssgp codeHolger Hans Peter Freyther1-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]
2012-09-11tests: Make the gb test work with srcdir != builddirHolger Hans Peter Freyther1-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
2012-09-07BSSGP flow-control: Add unit test for algorithm testsHarald Welte1-0/+167