| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The write queue was always meant to not queue more than the
max_length messages but the implementation never rejected a
message.
Begin to log and enforce the queue size limit, add a testcase
to verify the code and initialize except_cb as part of a fix
for that new test case.
Real applications might now run into the queue limit and drop
messages where they just queued them before. It is unfortunate
but I still think it is good to implement the routine as it was
intended. We need to review osmo_wqueue_enqueue once more to
see that no msgb is leaked.
Change-Id: I1e6aef30f3e73d4bcf2967bc49f0783aa65395ae
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Numerous issues caused sim_test to be attempted even though libosmosim was not
built:
In configure.ac, the ENABLE_PCSC variable lacked an AC_SUBST() to be exported.
Furthermore in configure.ac, no value 'yes'/'no' was assigned to the
ENABLE_PCSC variable, only to the enable_pcsc value.
In testsuite.at, encapsulating the sim_test in 'if ENABLE_PCSC' seems to have
no effect, regardless (not even when using a variable that should be defined
accurately).
So fix with these steps, similarly to how we do it in openbsc:
In AC_ARG_ENABLE, directly use 'ENABLE_PCSC' to assign 'yes'/'no'.
Export the same using AC_SUBST().
Add tests/atlocal.in to translate ENABLE_PCSC to enable_sim_test (also add
atlocal to AC_OUTPUT and distclean).
Use enable_sim_test in testuite.at, as seen in openbsc: use AT_CHECK() to
indicate skipping the test if enable_sim_test isn't 'yes'.
Change-Id: I9e8740c7d2dfbd272e22fee85972ef3fda7184a8
|
|
|
|
|
|
|
|
|
|
|
|
| |
As outlined by mail on the 13th of July the tree based approach to
decoding in the PCU is faster by order of magnitude. Instead of having a
slow implementation in the library and a quick one in the PCU, let's
only have a quick one in the PCU and at some point in the future move it
to libosmocore.
Execute the plan and remove t4_decode.
Change-Id: I021424444625a097560d086c217c81eac4a5ee44
|
|
|
|
|
|
|
|
| |
osmo_fsm_inst_alloc() logs allocation but osmo_fsm_inst_free() is
silent. Fix this by adding log message for deallocation to make FSM
lifecycle tracking easier. Also make sure it's covered by test suite.
Change-Id: I7e5b55a1fff8e36cf61c7fb61d3e79c1f00e29d2
|
|
|
|
|
|
|
| |
Check that RTP payload we're about to decode is not NULL and return
proper error code instead of segfaulting. Add corresponding test case.
Change-Id: Ib6cda9900a41ed16bbfbde9df3de9d38e0a7469b
|
|
|
|
|
|
|
| |
Previously function was defined but not exposed so there were a way to
register FSM but no way to unregister it.
Change-Id: I2e749d896009784b77d6d5952fcc38e1c131db2b
|
|
|
|
| |
Change-Id: Ib26214add1932e93651c248cc09fbc68339b4dce
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The osmo_hexdump of the output in sh_chk() omitted the last byte of the
returned bytes from the osmo_nibble_shift_*() functions.
Determine the number of bytes from nibbles divided by two plus one for any odd
nibble number. Output this number of bytes of output data.
Memset the output buffer to get well-defined bytes for unwritten places.
Also assert that we have enough buffer length for all nibbles.
Change-Id: I011f42bca555caec0dfe8688ff1f28303fa04fad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously while testing osmo_nibble_shift_left_unal() following error was
triggered by AddressSanitizer upon offs == 12 and the last sh_chk line, i.e.
shift left of 12 nibbles from in2:
==3890== ERROR: AddressSanitizer: stack-buffer-overflow on address 0xbff5b5b6 at pc 0xb6186862 bp 0xbff5b4a8 sp 0xbff5b49c
READ of size 1 at 0xbff5b5b6 thread T0
#0 0xb6186861 (/home/msuraev/source/gsm/libosmocore/src/.libs/libosmocore.so.7.0.0+0xc861)
#1 0x8049d8b (/home/msuraev/source/gsm/libosmocore/tests/bits/.libs/lt-bitrev_test+0x8049d8b)
#2 0x804a9d1 (/home/msuraev/source/gsm/libosmocore/tests/bits/.libs/lt-bitrev_test+0x804a9d1)
#3 0xb5fe3af2 (/lib/i386-linux-gnu/libc-2.19.so+0x19af2)
#4 0x8048a30 (/home/msuraev/source/gsm/libosmocore/tests/bits/.libs/lt-bitrev_test+0x8048a30)
Address 0xbff5b5b6 is located at offset 38 in frame <main> of T0's stack:
This frame has 3 object(s):
[32, 38) 'in2'
[96, 104) 'out'
[160, 168) 'in1'
The reason is incorrect range in test cycle. Fix it and adjust test
output accordingly.
Tweaked-by: Neels Hofmeyr <nhofmeyr@sysmocom.de>
Fixes: OW#1589 ("undefined behavior in libosmocore triggered by tests")
Change-Id: I5eb3f600290c05b4ab9ac2450a28d616e6b415fd
|
|
|
|
| |
Change-Id: I5070578e9fe2bdacaad000eaafb8dc5f549d6f3e
|
|
|
|
|
|
|
| |
The test is now fully deterministic, so include all detail in stdout, to check
for.
Change-Id: Iecf6387f1d25253fcf1260777673853030c1d326
|
|
|
|
|
|
| |
This way we can check the output in timer_test.ok.
Change-Id: Ia3bba1c650be3558d370e0f59d4ee7f36ef97506
|
|
|
|
| |
Change-Id: I9833031407e99f5d7a1144c26b68a7e320b2020d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use osmo_gettimeofday_override* to decouple the timer test from real time. No
longer call osmo_select_main(), since select() actually waits for real time.
This reduces the timer_test to the osmo_timer_* logic and excludes the real
time and osmo_timers_nearest() accuracy testing with actual waiting involved.
This may be seen as a loss, but is more fit for a test suite.
The main point here is to get deterministic results in jenkins, so that we
don't have to retrigger jobs based on timing failures; added bonus is that the
test runs much faster now.
Change-Id: Ic5649512df86dd17070daa2f314159eafaf8feb8
|
|
|
|
|
|
|
| |
This allows feeding a custom time for unit tests by overriding
osmo_gettimeofday.
Change-Id: Ic7a81a6eb51f27fe452962b91f2eae2070d87089
|
|
|
|
| |
Change-Id: I1570b7096c757d63d23e0950feeeb7230f8a5c9f
|
|
|
|
|
|
|
|
| |
When a timer was late, show the timing details.
Also count whether timers fired early, for completeness' sake.
Change-Id: Id3942637d77a28b5092ffffcc3e6d9d67c2b8e68
|
|
|
|
|
|
|
|
|
|
| |
The timer_test schedules timers and records the desired stop time. Also store
the usec value of the desired stop time, because scheduling at e.g. sec N usec
999999 but recording sec N usec 0, and then receiving a timer at sec N+1 usec 0
is only 1 usec late, but records as 1000000 usecs late. This might have been
the main cause of the timer test not working well on the osmocom build server.
Change-Id: I13bb60f7d341a397f95d13d9c63c40188b6cd5a0
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add src/gsm/libosmogsm.la explicitly to some test linkages, because otherwise
the linker would pick the libosmogsm already installed on the system instead of
the one that was just built in the source tree.
I noticed because a libosmogsm needing some more symbols from libosmocodec was
still installed, while the patch that cause it was already removed. Thus I
caught all(?) test binaries that linked libosmogsm from $PREFIX.
Change-Id: Ie61d60e1506f16de20add70fd0f44ebfa7a00a75
|
|
|
|
|
|
|
|
|
|
|
|
| |
Keith of Rhizomatica has an issue of a unrejected interrogateSS.
Start with just decoding the message and printing the empty test
and the code.
What is kind of missing is the classification between invoke,
returnResult and returnResultLast that we need to add in the
long run.
Change-Id: Iadfa156707a96f2a34f3948c7cc9a74435f17114
|
|
|
|
|
|
|
|
|
|
|
| |
Corresponding test code include both official test vectors from the
specs and data from over-the-air tests.
This obsoletes libosmo-crypt-a53 as it was last missing piece
unimplemented in libosmogsm.
Change-Id: I939e4f6b91b4a7c591ef3761fe2d46ed1c2fb2d3
Related: OS#1582
|
|
|
|
|
|
|
| |
Check if library actually support Milenage, COMP128 v2 and v3 algorithms
instead of just printing enum values or nothing.
Change-Id: I2b98481f56a8381058d4b29db5e8a36eb193eee9
|
|
|
|
|
|
|
|
|
| |
The actual code is from OsmoBTS' tch.c by Harald Welte. Add unit tests,
doxygen annotation and extra memory safety check. Those functions are
used in several BTS implementations but seems generic enough to be
generally useful.
Change-Id: I2b1901c4161e8035f059585901dca593b661556d
|
|
|
|
|
|
|
|
|
|
| |
This code is supposed to formalize some of the state machine handling in
Osmocom code.
Change-Id: I0b0965a912598c1f6b84042a99fea9d522642466
Reviewed-on: https://gerrit.osmocom.org/163
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
|
|
|
|
|
|
|
|
|
|
|
| |
Add functions which check if given FR or HR frame (packed in RTP)
contains SID (SIlence Descriptor) and corresponding tests.
Related: OS#22
Change-Id: I4051e3c0d4fb9ee93d7e9e0ef4abaf9f18e227ca
Reviewed-on: https://gerrit.osmocom.org/160
Tested-by: Jenkins Builder
Reviewed-by: Harald Welte <laforge@gnumonks.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add functions to encode/decode various codec paramters from RTP payload with
AMR frame according to RFC 4867
* those functions are extended version based on code from osmo-bts'
amr.c by Andreas Eversberg
* add corresponding enum types and strings for logging
* add regression tests
It's useful both to replace manual parsing in osmo-bts with fuctions
covered by test suite and as a debugging helpers for issues related to
AMR.
Change-Id: Ia217679a07d3fbc970f435e20f6eac33d34bd597
Related: OS#1562
Reviewed-on: https://gerrit.osmocom.org/118
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
|
|
|
|
|
|
|
| |
Move those routines from OpenBSC to libosmogsm, so they can be
re-used from other programs. I think it was a mistake to add them only
inside the openbsc repository in the first place. We need to pay more
attention to this in the future.
|
|
|
|
|
| |
These routines have nothing to do with specifically the BSC, so import
them to the TLV parser we keep in libosmogsm.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add python utility to generate .c code with convolutional
encoder/decoder based on polynomial description of the code. If argument
given it'll be interpreted as intended output directory, otherwise
current working directory is used.
Codes for *CCH, CS2/3 and TCH/AFS are generated. Corresponding manual
implementations are removed from tests. This introduce build-time
dependency on python.
The main work for this patch was generously contributed by Sylvain
Munaut.
Fixes: OS#1629
|
|
|
|
|
| |
Move functions for conversion between soft and unpacked bits to main
library as they are generally useful.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Add function which adds specified number of bits from each element of
array to the bit vector prefixing each addition with one and finishing
entire sequence with adding 0. This is very common patter for various
repetitive data structures described with CSN.1 in 3GPP standards.
Corresponding test vectors and doxygen headers are added too.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 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>
|
|
|
|
|
| |
Add bit filling, shifting and other functions necessary for bit
compression implementation. Add corresponding tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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_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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
GCC 5 has changed inline semantics (https://gcc.gnu.org/gcc-5/porting_to.html)
and apparently that now fails to link.
|
|
|
|
|
|
| |
Include a test for msgb_trim.
Sponsored-by: On-Waves ehf
|
|
|
|
| |
Sponsored-by: On-Waves ehf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|