summaryrefslogtreecommitdiffstats
path: root/tests/msgb
Commit message (Collapse)AuthorAgeFilesLines
* add function msgb_printf() to print formatted text into msg bufPhilipp Maier2017-10-222-0/+113
| | | | | | | | | | | In ASCII string based protocols it a printf() version that prints directly to the message buffer may be useful. Add function msgb_printf(), make sure that msg buffer bounderies are not exceeded. If the end of the tail buffer is hit, return with an error code. Change-Id: I15e1af68616309555d0ed9ac5da027c9833d42e3
* Fix msgb_test on 64 bit architecturesHarald Welte2016-12-091-1/+1
| | | | | | | | | | | truncating the unsigned long pointer msg->data to 'int' and then passin git into msgb_resize_area() is unsafe as depending on the 32rd address bit it will be eiether negative or positive. That will in turn change the expected "Sub area is not fully contained in the msg data\n" error message into "Negative sizes are not allowed\n" which is not what the autotest case expects. Change-Id: I87ce13c265704d4ba8724e7dc7ed874c1128e0fa
* test: Fix compiler warnings on 64bit systemsHolger Hans Peter Freyther2015-11-091-6/+6
| | | | | | Use %td to print ptrdiff_t use %zu to print size_t, include time.h on FreeBSD. Some more compiler warnings are left but they require more thinking.
* msgb/test: Add test case for error casesJacob Erlbeck2016-01-152-0/+24
| | | | | | Include a test for msgb_trim. Sponsored-by: On-Waves ehf
* msgb/test: Add tests for msgb_resize_area and msgb_copyJacob Erlbeck2016-01-152-0/+149
| | | | Sponsored-by: On-Waves ehf
* msgb/test: Add functions to catch and check exceptionsJacob Erlbeck2016-01-151-0/+31
| | | | | | | | | | | | | | | | Currently the msgb error handling cannot be fully tested, since in many cases osmo_panic will be called. This will in turn call abort(). Using an osmo_panic_handler that just returns will not help, since many msgb functions rely on MSGB_ABORT to not return at all. This commit uses an alternative osmo_panic_raise handler that just calls longjmp to return to the test function. Since some of this activity is logged to stderr where the strings may contain variable parts like pointer addresses, stderr checking is disabled in testsuite.at. Sponsored-by: On-Waves ehf
* msgb/test: Add test for msgb message buffersJacob Erlbeck2016-01-152-0/+125
This tests several API functions of the msgb by checking the invariant and by dumping resulting message buffers as hex. Sponsored-by: On-Waves ehf Conflicts: tests/Makefile.am