summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* logging: Move the filter check up as wellHolger Hans Peter Freyther2016-02-292-7/+15
| | | | | | There doesn't seem to be a reason not to check the filter. Update and extend the test. Currently the filter function will be called once for the log check and once for the output of it.
* log/test: Extend test case for log_check_levelJacob Erlbeck2016-02-292-1/+11
| | | | | | | | This commit adds OSMO_ASSERTs for mandatory conditions related to log_check_level, and fprintfs for optional conditions, since it is always safe for log_check_level to return != 0. Sponsored-by: On-Waves ehf
* Add byte printing macrosMax2016-02-251-12/+1
| | | | | | It's sometimes handy for debugging to be able to immediately see which bits are set in a given byte. Generalize macro used for that in bitvec tests and make it available for the rest of the library.
* gb: Add bssgp_msgb_copy functionJacob Erlbeck2016-02-222-0/+38
| | | | | | | | | | | | | | This function originates from openbsc/src/gprs but is just specific to BSSGP/Gb on the same level like bssgp_msgb_alloc. This commit puts the former gprs_msgb_copy function beside bssgp_msgb_alloc. Renamed function: gprs_msgb_copy -> bssgp_msgb_copy Sponsored-by: On-Waves ehf
* Add T4 bit map compression routinesMax2016-02-184-2/+106
| | | | | | | | | | | | | | | Add bit map encoder and decoder functions: decoder is fully functional while encoder is good enough for testing - no backtracking to find the best possible compression is implemented. If somebody is willing to implement MS side of EDGE than this has to be expanded. Add corresponding tests. N. B: the encoding is implemented according to ETSI TS 44.060 which is slightly different from T4 used for fax according to CCITT G31D (RFC 804). Ticket: OW#2407 Sponsored-by: On-Waves ehf Signed-off-by: Max <msuraev@sysmocom.de>
* Expand bitvec interfaceMax2016-02-182-2/+258
| | | | | Add bit filling, shifting and other functions necessary for bit compression implementation. Add corresponding tests.
* bivec: Fix the output of the testcaseHolger Hans Peter Freyther2016-01-302-12/+16
| | | | | | | | | | | | | | osmo_hexdump_nospc/osmo_hexdump is an old school C routine with a static internal array. This means that printf will most likely one of the two strings twice. For Linux/glibc this is the first string (for whatever reason?) and for FreeBSD it is the last call of the osmo_hexdump_nospc. We could have noticed by both strings being of the same length besides the different length input. The second issue is that we cast a hexstring to uint8_t and dump the string as hex. So the two strings should not match at all. Fix it by printing the hex string as plain hex and separating the two printf calls. Update the test output.
* bitvec: Test and fix regression for C++->C conversionHolger Hans Peter Freyther2016-01-302-0/+31
| | | | | | | | | | | | | bitvec_read_field/bitvec_write_field in the PCU used a C++ reference and when porting to C it was decided to pass the parameter by value and this lost the "back propagation" of the new index. Change the parameter to be an in/out parameter and this way do not have a silent semantic break in the osmo-pcu (where we copy the reference in csn.1 by value) and have a true compile failure. Add Max's simple test for bitvec_unhex function leaving the checking of bitvec_read_field and the side effect in the datastructure about the number of bits still open.
* test: Fix compiler warnings on 64bit systemsHolger Hans Peter Freyther2015-11-096-17/+18
| | | | | | 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.
* kasumi: Fix build with gcc5 that changed behavior of inlineHolger Hans Peter Freyther2016-01-211-1/+1
| | | | | GCC 5 has changed inline semantics (https://gcc.gnu.org/gcc-5/porting_to.html) and apparently that now fails to link.
* 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-152-1/+32
| | | | | | | | | | | | | | | | 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-154-2/+136
| | | | | | | | | | 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
* bitvec: Add get/set byte sequencesJacob Erlbeck2016-01-154-2/+77
| | | | | | | | | | | | | | | The new functions bitvec_get_bytes and bitvec_set_bytes copy byte sequences from bitvecs to uint8_t arrays and vice versa. While the bytes in the bitvecs do not need to be aligned, the uint8_t arrays always are. In case the bytes in the bitvec are aligned, the implementation uses memcpy. Note that the implementation like the other existing functions assume MSB first encoding. [hfreyther: Squash the comment fix into this commit as well] Sponsored-by: On-Waves ehf
* gsm: Add APN conversion functionsJacob Erlbeck2016-01-154-3/+136
| | | | | | | | | | | | These functions are currently part of openbsc but also needed by other projects. The function have been renamed as follows: gprs_apn_to_str -> osmo_apn_to_str gprs_str_to_apn -> osmo_apn_from_str Sponsored-by: On-Waves ehf
* ns: Force a defined state when sending NS RESETJacob Erlbeck2015-12-172-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | Currently the state is assumed to remain the same while the reset procedure is active. While this works correctly in general, a single unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not stop the reset procedure. The leads to repeated RESET messages, where the corresponding RESET_ACK is ignored. This is a stable state which can only be left by manual intervention or by reception of a RESET message from the peer. This commit changes the RESET timeout handler to set the state to BLOCKED/RESET when sending the new NS RESET message. Note that this should ensure a clean restart even if the state has been screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK in abnormal cases. Addresses: gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention) gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895) gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895 Ticket: OW#1551 Sponsored-by: On-Waves ehf
* remove our internal copy of talloc, use system libtallocHarald Welte2015-12-051-1/+2
| | | | | | | Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
* stats/test: Add memory leak checkJacob Erlbeck2015-11-261-4/+9
| | | | | | Adds a rudimentary leak check for the counters and stat items. Sponsored-by: On-Waves ehf
* stats/test: Add test for reportingJacob Erlbeck2015-11-262-17/+369
| | | | | | | | | | | | | | This tests uses a dedicated test reported to check several aspects of the value reporting. - addition/removal of stats reporter - addition/removal of counters/items - setting of max_class - initial value flush - updating single counters/items - reporter retrieval - enable/disable Sponsored-by: On-Waves ehf
* stats/test: Add tests to check VTY configurationJacob Erlbeck2015-08-222-0/+194
| | | | | | | This commit adds tests to verify the stats related VTY configuration commands. Sponsored-by: On-Waves ehf
* vty/test: Refactor vty creation/deletion into separate functionsJacob Erlbeck2015-08-221-29/+46
| | | | | | | | | | Currently this is part of the only test function that uses the vty directly. In preperation for more such test cases, this commit moves this code into separate functions. Sponsored-by: On-Waves ehf
* test: Remove unneeded linking to libosmovty.laJacob Erlbeck2015-08-221-4/+4
| | | | | | | | | | The addition of libosmovty.la to several test cases as done in commit 738d9e22108a8e47245 (stats: Add vty_out_stat_item_group) is not needed. This commit removes them. Sponsored-by: On-Waves ehf
* stats: Add osmo_ name prefix to identifiersJacob Erlbeck2015-11-021-55/+55
| | | | | | | | | | Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
* stats/vty: Add stats configurationJacob Erlbeck2015-10-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | This commit provides stats configuration similar to the log configuration. The following vty commands are added to the config node: stats reporter statsd Create/Modify a statsd reporter no stats reporter statsd Remove a statsd reporter To actually configure a reporter, the config-stats node is entered when the "stats reporter" command has succeeded. The following new vty commands are available there: local-ip ADDR Set the IP address to which we bind locally no local-ip Do not bind to a certain IP address remote-ip ADDR Set the remote IP address to which we connect remote-port <1-65535> Set the remote port to which we connect prefix PREFIX Set the item/counter name prefix no prefix Do not use a prefix enable Enable the reporter disable Disable the reporter Sponsored-by: On-Waves ehf
* stats: Use a global index for stat item valuesJacob Erlbeck2015-10-281-14/+29
| | | | | | | | | | | | | | | Currently each stat item has a separate index value which basically counts each single value added to the item and which can be used by a reporter to get all new values that have not been reported yet. The drawback is, that such an index must be stored for each stat item. This commit introduces a global index which is incremented for each new stat item value. This index is then stored together with the item value. So a single stored index per reporter is sufficient to make sure that only new values are reported. Sponsored-by: On-Waves ehf
* stats: Add vty_out_stat_item_groupJacob Erlbeck2015-10-281-4/+4
| | | | | | This functions dumps a whole stat item group to the VTY. Sponsored-by: On-Waves ehf
* stats: Add stat_item for value monitoringJacob Erlbeck2015-10-284-2/+209
| | | | | | | | | | | | | | This commit adds instrumentation function to gather measurement and statistical values similar to counter groups. Multiple values can be stored per item, which can be retrieved in FIFO order. Getting values from the item does not modify its state to allow for multiple independant backends (e.g. VTY and statd). When a new value is set, the oldest value gets silently overwritten. Lost values are skipped when getting values from the item. Sponsored-by: On-Waves ehf
* build: have a disable-static build succeedJan Engelhardt2015-09-161-4/+2
| | | | | | | | | | | | | When using configure --disable-static, no libosmogsm.a will be created, and the tests fail to link because symbols like _a5_3 and _a5_4 are not exported through the only remaining libosmogsm.so. A method to overcome this is an intermediate private non-distributed library, examples of which are present in e.g. libabc, kmod and systemd. With this, disable-static can now be the default and practical compile time be halved.
* tests: Don't reference file in src/ to test hidden func. Use static link.Sylvain Munaut2015-08-191-2/+3
| | | | | | | Taken from: https://qiaomuf.wordpress.com/2011/03/27/handling-unit-test-with-c-visibilityhidden/ Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* bssgp/test: Add missing START/END printfsJacob Erlbeck2015-06-192-1/+8
| | | | Sponsored-by: On-Waves ehf
* ipa: Properly parse LV stream of a ID_GET requestHolger Hans Peter Freyther2015-06-022-1/+62
| | | | | | | | For some reason the structure is closer to be a LV (length and value). The value is actually a tag but it is counted inside the length. Introduce an overload of the parse function to provide an offset for the length. This will be taken from the returned length.
* build: Fix the building of tests as wellHolger Hans Peter Freyther2015-05-171-1/+1
| | | | | | | In file included from ../../include/osmocom/core/msgb.h:25:0, from ../../tests/sms/sms_test.c:31: ../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory #include <osmocom/core/bit16gen.h>
* bssgp: Fix bssgp_tx_fc_bvc parameter typeJacob Erlbeck2015-05-062-0/+79
| | | | | | | | | | | | Currently large values for Bmax default MS get sliced since a uint16_t is used as the type of the corresponding parameter of bssgp_tx_fc_bvc. GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum of 6MB (0xffff * 100). This commit changes the type to uint32_t to cover the full value range. Sponsored-by: On-Waves ehf
* bssgp/test: Fix bssgp-fc testJacob Erlbeck2015-05-041-30/+0
| | | | | | | | | | | | | The fix in the commit "bssgp: Fix call to llist_entry in fc_queue_timer_cfg" prevents the flow control code from generating certain logging messages ("-BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes") during the tests. This breaks the test suite, since the update of the correseponding stderr output file misses. This commit updates the bssgp_fc_tests.err file accordingly. Sponsored-by: On-Waves ehf
* logginrb: Fix compiler warning about fprintfHolger Hans Peter Freyther2015-04-111-2/+2
| | | | | | | | | loggingrb/loggingrb_test.c:76:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security] fprintf(stderr, log_target_rb_get(ringbuf_target, 0)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ loggingrb/loggingrb_test.c:77:18: warning: format string is not a string literal (potentially insecure) [-Wformat-security] fprintf(stderr, log_target_rb_get(ringbuf_target, 1)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* bssgp: Ensure non-NULL bctx before calling bssgp_rx_ptp (Coverity)Jacob Erlbeck2015-04-071-0/+17
| | | | | | | | | | | | | | Currently bssgp_rx_ptp might be called with bctx being NULL, when the NS BVCI is neither BVCI_SIGNALLING nor BVCI_PTM, but the message is a BVC_RESET or it contains an BVCI IE != BVCI_SIGNALLING where the BVCI is not known. This patch ensures that bssgp_rx_ptp will only be called with a non-NULL bctx. A log message will be issued, if the bctx is NULL when this was not expected. Fixes: Coverity CID 1040674 Sponsored-by: On-Waves ehf
* fix compiler warnings for a5 testsMax2015-04-071-0/+4
| | | | Signed-off-by: Max <max.suraev@fairwaves.co>
* Tests: Fix broken loggingrb testcase.Michael McTernan2015-04-012-7/+6
| | | | | | | | The loggingrb (ringbuffer) test case was not actually being built or ran, instead still using the normal logging test. This patch fixes the makefile, then the loggingrb testcase is changed to use the current loggingrb API so that it builds and passes. Signed-off-by: Michael McTernan <mike.mcternan@wavemobile.com>
* gsm: Add A5/3-4 cipher supportMax2015-03-283-15/+79
| | | | | Signed-off-by: Max <max.suraev@fairwaves.co> Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
* bssgp: Handle BSSGP STATUS messagesJacob Erlbeck2015-03-182-0/+39
| | | | | | | | | | | | | | | | | | | Currently incoming BSSGP STATUS messages are just logged and no other action is taken. This makes it impossible for higher layers to react to failures which are indicated by corresponding STATUS messages unless a timeout is triggered as a result of that failure later on. This commit adds a bssgp_rx_status() function and calls it on incoming STATUS messages. That function logs a message, increments the new BSSGP_CTR_STATUS counter if the bctx context exists and invokes an NM_STATUS status indication. The latter will allow the application to handle failures immediately. Since all STATUS messages should be handled, the function is already called in bssgp_rcvmsg and the message is no longer handled in (and will not reach) bssgp_rx_sign and bssgp_rx_ptp. Ticket: OW#1414 Sponsored-by: On-Waves ehf
* Supplementary Services (de)activation, interrogation addedTobias Engel2015-01-011-7/+7
| | | | | | | | | | | | | These patches enhance the Supplementary Service (SS) processing from only being able to handle USSD to other SS, specifically activation, deactivation and interrogation of those SS. Registration is not yet implemented. include/osmocom/gsm/protocol/gsm_09_02.h has been added with needed values for SS. Modified by Harald Welte to keep the old ussd-only functiosn for API/ABI stability.
* SMS-CB: introduce and use GSM341_7BIT_PADDINGHarald Welte2014-12-301-2/+3
|
* use the new GSM341 / GSM412 size constantsHarald Welte2014-12-301-3/+3
|
* smscb/gsm0341_test: Add \r padding to the messageDaniel Willmann2014-12-301-1/+7
|
* testHarald Welte2014-12-301-1/+4
|
* add gsm0341_test to generate SMSCB hex stringsHarald Welte2014-12-292-1/+67
| | | | Those hex strings can then be copy+pasted into the OSmoNITB VTY
* bssgp: Include sys/socket.h for AF_INET on FreeBSDHolger Hans Peter Freyther2014-10-251-0/+1
|
* gprs: Don't discard SUSPEND/RESUME in bssgp_rcvmsgJacob Erlbeck2014-10-232-2/+4
| | | | | | | | | | | | | | | Currently sending SUSPEND/RESUME messages to this function (like it is done in the osmo-sgsn) results in STATUS messages complaining about an unknown BVCI. The reason is, that these messages rely on a TLLI/RAI pair to identify the context and do not contain an explicit BVCI. This patch modifies bssgp_rcvmsg() to only complain about and unknown BVCI if one is given but a matching context is not found (except for RESET messages). The ctx argument is removed from the functions handling SUSPEND and RESUME since it will always be NULL then. Sponsored-by: On-Waves ehf
* gprs/test: Add BSSGP testsJacob Erlbeck2014-10-234-2/+168
| | | | | | | | This patch adds a test suite for the BSSGP protocol. The first (and only) test checks the handling of BSSGP SUSPEND/RESUME. Sponsored-by: On-Waves ehf