Commit Graph

93 Commits

Author SHA1 Message Date
Max 7918f84aeb LCLS, TS 29.205: add GCR routines
Add functions to encode and decode Global Call Reference as per
3GPP TS 29.205 Table B 2.1.9.1 add corresponding tests.

Change-Id: Iee95aa4e5c056645b6cb5667e4a067097d52dfbf
Related: OS#2487
2018-12-14 13:15:39 +00:00
Neels Hofmeyr 3a9ff11e57 logging vty: add VTY transcript test
I am setting out to refactor various details about logging. To show the effect,
I am first adding this new test to illustrate the exact effects on the various
osmo programs.

Add logging_vty_test.c as a standalone program that simply defines a few
logging categories and opens a telnet vty to play with.

Add logging_vty_test.vty, as an osmo_verify_transcript_vty.py test script.

Add --enable-external-tests to configure.ac, to enable running
logging_vty_test.vty during 'make check'.

Also allow running 'make vty-test' without the need to first configure with
--enable-external-tests (a flexibility I've missed many times over in the other
osmo source trees).

Add a Makefile.am stub for external CTRL tests, basically a copy-paste from
osmo-msc.git. I doubt that libosmocore will get python driven CTRL interface
testing any time soon, but if so we will know to not run it concurrently.

Change-Id: I948e832a33131f8eab98651d6010ceb0ccbc9a9c
2018-09-12 03:06:37 +02:00
Neels Hofmeyr ec6fdbb128 fix tests linking: don't use system installed libs
Do not link against the system-wide installed libosmo* libs when building the
regression test programs. Always use the locally built ones.

Linking some libosmo libraries causes libtool to pull in other libosmo libs
even though they were not explicitly named. For example, ctrl_test explicitly
links libosmoctrl, but this also has dependencies to libosmovty and libosmogsm:

  ldd src/ctrl/.libs/libosmoctrl.so | grep osmo
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f26c26d4000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f26c22bb000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f26c2171000)

If we omit explicit LDADD of these dependencies in the Makefile.am, libtool
will take the first canonical place to find them, which may just be the already
installed older versions of the same libs, which may or may not be compatible
with the current build. In any case, it is never intended to link installed
libs.

All library dependencies are listed by this quick script:

  cd libosmocore
  for l in $(find . -name "*.so") ; do echo; echo "$l"; ldd $l | grep libosmo; done

  ./.libs/libosmocore.so

  ./coding/.libs/libosmocoding.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f25fc3c2000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f25fbfa9000)
    libosmocodec.so.0 => /usr/local/lib/libosmocodec.so.0 (0x00007f25fbf9b000)

  ./codec/.libs/libosmocodec.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007fb4c900d000)

  ./ctrl/.libs/libosmoctrl.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f5df5129000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f5df4d10000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f5df4bc6000)

  ./gb/.libs/libosmogb.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f788e536000)
    libosmovty.so.4 => /usr/local/lib/libosmovty.so.4 (0x00007f788e3ec000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f788dfd3000)

  ./vty/.libs/libosmovty.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f3b7ed21000)

  ./gsm/.libs/libosmogsm.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007fc69472e000)

  ./sim/.libs/libosmosim.so
    libosmocore.so.11 => /usr/local/lib/libosmocore.so.11 (0x00007f2f6412d000)
    libosmogsm.so.10 => /usr/local/lib/libosmogsm.so.10 (0x00007f2f63d14000)

Add all explicit linking of all required library dependencies in all regression
test programs, as shown by above listing.

Example for reproducing a problem:

In libosmocore.a, introduce a new function, and call that from libosmovty code.
For example, I made loglevel_strs non-static in logging.c, and used that in
logging_vty.c. Build and install this in a place where libtool can find it.
Then go back to before this change and rebuild. You will see that linking
ctrl_test (before this patch) then complains about libosmovty requiring the
loglevel_strs symbol which it cannot find in libosmocore.so.

Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
2018-09-11 23:21:28 +02:00
Harald Welte 6db529aedd import oap_client_test from osmo-sgsn
As oap_client has moved from osmo-sgsn to libosmogsm, it is only fair
that the related unit test shall also be moved here.

Change-Id: I9d64e10b4bacac9b530cf077841bad762fc6d558
2018-07-30 18:24:49 +02:00
Neels Hofmeyr 1504211fdc utils_test: check stderr to catch sanitizer issues
Recent OS#3407 shows that we should verify stderr to catch sanitizer failures.
(They might not always be ignorable like that one.)

Change-Id: Ic9e437a1cc96ae081e0fd6a9b6e3156987e14c0c
2018-07-20 14:02:21 +00:00
Vadim Yanitskiy 94c0031297 Don't enforce Python 2 for utilities
The conv_gen.py utility was tested against both Python 2 and 3,
so there is no need to enforce Python 2. Also, having:

  #!/usr/local/bin/python{2|3}

is a bad idea, because Python may be installed in a different location.

Change-Id: I6007d481047b584db13d6eda70fb99f11f9ddaa1
2018-07-02 20:30:31 +07:00
Pau Espin cacaa4a161 configure: Check separately for lib implementing dlopen and dlsym
Sometimes the library probiding dlopen is not the same one providing
dlsym.
This is the case when compiling with AddressSanitizer enabled. In this
case, AC_SEARCH_LIBS([dlopen]...) reports no lib is required, but tests
using dlsym still require to link against -ldl.

Change-Id: Ic619b0885688066b60c97caf1e2c7e5402c1d9f7
2018-05-04 19:25:16 +02:00
Pau Espin 87fade88bd timer: Introduce osmo_clock_gettime to override clock_gettime
Change-Id: I5bebc6e01fc9d238065bc2517058f0ba85620349
2018-03-01 12:33:02 +00:00
Max 3da793857d Embedded: add sercomm stubs
The sercomm functions are unavailable in case of embedded build. Add
stub and link the tests against it.

Change-Id: I9bc5cb2f822b1a3ffdc6ec29f46b6bac8288314e
2018-01-21 19:08:05 +00:00
Max 89c8c4027b Embedded: disable stats test
As of 67bdd80a96 the stats.c is
effectively disable so we should disable the corresponding tests as
well.

Change-Id: I42ff7a6619c0a5926fdc2ec779cf04689c567e15
2018-01-21 19:05:00 +00:00
Philipp Maier 40def49ac4 libosmocodec: implement ECU (Error Concealment Unit) for FR
When a bad GSM voice frame is received, it's being replaced
by a silence frame. This may cause unpleasant audio effects.

This change implements a functionality to craft a replacement
frame from the last known good frame. Currently, only FR is
supported, support for other codecs may be added latter.

Change-Id: I06a21f60db01bfe1c2b838f93866fad1d53fdcd1
2018-01-15 20:12:03 +00:00
Max ad1797e359 embedded: fix tests
In case of embedded build some tests are failing to link properly. Fix
it:

* do not run fsm_test unless CTRL is enabled
* do not run fr_test unless GB is enabled
* do not link loggingrb_test with libosmovty

Change-Id: Icedad5ba3ed311ccdb97fa3ccd3002f5fda8be68
2017-12-04 09:40:39 +00:00
Max 29d489f081 coding test: cosmetic cleanup
* remove duplicate code: use function from libosmocore
* use utility function to dump ubits
* reformat for easier reading
* link against libosmocore

Change-Id: I8c31b0954176a2c53305936a025c92a793b6d9b6
2017-11-28 18:02:03 +01:00
Harald Welte d068210896 Print /proc/cpuinfo before executing testsuite
The testsuite fails on some specific build machines in the OBS
build cluster.  Let's try to figure out which CPU flags they have
to narrow down the cause of this.

Change-Id: Ib23e5bfb3c894206fad62d6cc6151583b1bb75a6
2017-11-16 16:57:33 +00:00
Max ba1059c173 Move additional libraries to appropriate place
According to
https://www.gnu.org/software/automake/manual/automake.html#Libtool-Flags
the libraries supposed to be added to *_LDADD or *_LIBADD
while *_LDFLAGS should contain additional libtool linking
flags. Previously we used both. Let's unify this and move all the
libraries into proper automake variable. While at it - also add
libosmocore.la for tests to LDADD since all the tests link against it
anyway.

Change-Id: Ia657a66db75df831421af5df1175a992da5ba80f
2017-10-30 13:50:31 +01:00
Max 9818664315 Add tests for bitvec_write_field()
This function is actively used by OsmoPCU but have not been covered by
tests so far. The test code is based on
Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> submission with some
modifications.

The test's FIXME will be addressed in follow-up patches.

Change-Id: I2ee544256b8675bc62a42493aab66a8eeee54f90
Related: OS#1526
2017-10-24 08:21:59 +00:00
Neels Hofmeyr 9cd1e7417e add osmo_imsi_str_valid() and osmo_msisdn_str_valid()
Add GSM23003_IMSI_MIN_DIGITS definition.
Add regression test gsm23003_test.c to test the two new functions.

Will be used by OsmoHLR to validate VTY and CTRL input.

Change-Id: I1e94f5b0717b947d2a7a7d36bacdf04a75cb3522
2017-10-05 19:44:28 +02:00
Neels Hofmeyr 430636328c fix vty regression: empty parent node
The recent exit-by-indent patch breaks a VTY case where a node is entered but
directly followed by a sibling or ancestor without listing any child nodes.
Regression introduced by I24cbb3f6de111f2d31110c3c484c066f1153aac9.

An example is a common usage in osmo-bts, where 'phy N' / 'instance N' is a
parent node that is commonly left empty:

	phy 0
	 instance 0
	bts 0
	 band 1800

Before this patch, this case produces the error:

	There is no such command.
	Error occurred during reading the below line:
	bts 0

Fix indentation parsing logic in command.c to accomodate this case.

Add a unit test for empty parent node.

Change-Id: Ia0880a17ae55accb092ae8585cc3a1bec9986891
2017-09-20 00:57:33 +02:00
Neels Hofmeyr 4a31ffa2f0 VTY: implicit node exit by de-indenting, not parent lookup
Note: This will break users' config files if they do not use consistent
indenting. (see below for a definition of "consistent".)

When reading VTY commands from a file, use indenting as means to implicitly
exit child nodes. Do not look for commands in the parent node implicitly.

The VTY so far implies 'exit' commands if a VTY line cannot be parsed on the
current node, but succeeds on the parent node. That is the mechanism by which
our VTY config files do not need 'exit' at the end of each child node.

We've hit problems with this in the following scenarios, which will show
improved user experience after this patch:

*) When both a parent and its child node have commands with identical names:

  cs7 instace 0
   point-code 1.2.3
   sccp-address osmo-msc
    point-code 0.0.1

If I put the parent's command below the child, it is still interpreted in the
context of the child node:

  cs7 instace 0
   sccp-address osmo-msc
    point-code 0.0.1
   point-code 1.2.3

Though the indenting lets me assume I am setting the cs7 instance's global PC
to 1.2.3, I'm actually overwriting osmo-msc's PC with 1.2.3 and discarding the
0.0.1.

*) When a software change moves a VTY command from a child to a parent. Say
'timezone' moved from 'bts' to 'network' level:

  network
   timezone 1 2

Say a user still has an old config file with 'timezone' on the child level:

  network
   bts 0
    timezone 1 2
    trx 0

The user would expect an error message that 'timezone' is invalid on the 'bts'
level. Instead, the VTY finds the parent node's 'timezone', steps out of 'bts'
to the 'network' level, and instead says that the 'trx' command does not exist.

Format:

Consistent means that two adjacent indenting lines have the exact
same indenting characters for the common length:

Weird mix if you ask me, but correct and consistent:

  ROOT
  <space>PARENT
  <space><tab><space>CHILD
  <space><tab><space><tab><tab>GRANDCHILD
  <space><tab><space><tab><tab>GRANDCHILD2
  <space>SIBLING

Inconsistent:

  ROOT
  <space>PARENT
  <tab><space>CHILD
  <space><space><tab>GRANDCHILD
  <space><tab><tab>GRANDCHILD2
  <tab>SIBLING

Also, when going back to a parent level, the exact same indenting must be used
as before in that node:

Incorrect:

  ROOT
  <tab>PARENT
  <tab><tab><tab>CHILD
  <tab><tab>SIBLING

As not really intended side effect, it is also permitted to indent the entire
file starting from the root level. We could guard against it but there's no
harm:

Correct and consistent:

  <tab>ROOT
  <tab><tab>PARENT
  <tab><tab><tab><tab>CHILD
  <tab><tab>SIBLING

Implementation:

Track parent nodes state: whenever a command enters a child node, push a parent
node onto an llist to remember the exact indentation characters used for that
level.

As soon as the first line on a child node is parsed, remember this new
indentation (which must have a longer strlen() than its parent level) to apply
to all remaining child siblings and grandchildren.

If the amount of spaces that indent a following VTY command are less than this
expected indentation, call vty_go_parent() until it matches up.

At any level, if the common length of indentation characters mismatch, abort
parsing in error.

Transitions to child node are spread across VTY implementations and are hard to
change. But transitions to the parent node are all handled by vty_go_parent().
By popping a parent from the list of parents in vty_go_parent(), we can also
detect that a command has changed the node without changing the parent, hence
it must have stepped into a child node, and we can push a parent frame.

The behavior on the interactive telnet VTY remains unchanged.

Change-Id: I24cbb3f6de111f2d31110c3c484c066f1153aac9
2017-09-19 01:35:30 +00:00
Harald Welte 1389e86d11 Add pseudo-random bit sequence generator to libosmcoore
These PRBS sequences are specified in ITU-T O.150.  They are typically
used as test data to be transmitted for BER (bit error rate) testing.

Change-Id: I227b6a6e86a251460ecb816afa9a7439d5fb94d1
2017-07-10 23:42:02 +02:00
Vadim Yanitskiy b6c8dda5e3 tests/Makefile.am: do not test disabled features
Compiling tests for disabled features breaks build.

Change-Id: Iebcc24b493092a5a8e3561d7642a0b4608a8beae
2017-05-18 23:59:02 +03:00
Harald Welte a362ee90b4 add sercomm unit test
Change-Id: I9e2e7fcda28e7c6844d5faa09e02acf537cea44d
2017-05-17 15:15:09 +01:00
Harald Welte 3318c657de introduce byteswap.h with osmo_{htonl,ntohl,htons,ntohs}
We need to have an architecture-independend way of endian conversion /
byte swapping functions which will also work on embedded (bare iron)
builds.   Let's introduce osmocom/core/bytesawp.h for this purpose.

Change-Id: Ibc0cc1e36d4ed63a35cf8ceff3af0f26e5ac7a3d
2017-05-15 13:42:00 +02:00
Vadim Yanitskiy 33e03065a5 tests/conv: add GSM 05.03 specific test
This change extends the convolutional code test coverage, adding
the GSM 05.03 specific test vectors, generated by the conv_gen.py.

Inspired by Tom's patch:
http://lists.osmocom.org/pipermail/openbsc/2014-April/007364.html

Change-Id: I76d1cd4032d2f74c5bb93bde4fab99aa655b7f1a
2017-04-30 02:59:42 +07:00
Max f74cfd35ac Add SW Description (de)marshalling
* data structure representing 3GPP TS 52.021 §9.4.62 SW Description
* function to serialize it into msgb
* function to deserialize it from buffer
* functions to extract/estimate buffer size for SW Description
* test harness (partially taken from OpenBSC)

There are several similar functions to deal with SW Description in
OpenBSC, there's also need to use similar functionality in
OsmoBTS. Hence it's better to put the code into common library with
proper tests and documentation.

Change-Id: Ib63b6b5e83b8914864fc7edd789f8958cdc993cd
Related: OS#1614
2017-04-28 08:45:09 +00:00
Harald Welte f85861d6eb control_if: Add helper function for 'local execution' of control command
Sometimes (particularly when testing), we may want to parse+execute an
arbitrary control command simply form a string buffer, rather than from
a msgb.  Let's add a helper for that.

Change-Id: Iaca748e0d942bb2a1ee7c2776b37485e1439eb0c
2017-04-27 09:50:33 +02:00
Neels Hofmeyr d3b58730d5 add osmo-auc-gen_test
Add test for osmo-auc-gen invocations to ensure stability across upcoming SQN
increment scheme changes.

The test comprises of a shell script that invokes the osmo-auc-gen binary with
various milenage parameters, of which the stdout/stderr are verified.

More osmo-auc-gen invocations could be added, but my main focus is on the SEQ
changes. Instead of manually testing that it still works for each SQN patch, I
want this test to do it for me.

To make sure that osmo-auc-gen is build before the tests are launched, place
'utils' before 'tests' in the root Makefile.am.

Related: OS#1968
Change-Id: Ib4af34201cd2e7d76037bcd31dd89ef18c1a9aec
2017-03-15 12:46:08 +00:00
Vadim Yanitskiy 3262f820b5 libosmocoding: migrate transcoding routines from OsmoBTS
There are some projects, such as GR-GSM and OsmocomBB, which would
benefit from using one shared implementation of GSM 05.03 code. So,
this commit introduces a new sub-library called libosmocoding, which
(for now) provides GSM, GPRS and EDGE transcoding routines, migrated
from OsmoBTS.

The original GSM 05.03 code from OsmoBTS was relicensed under
GPLv2-or-later with permission of copyright holders (Andreas Eversberg,
Alexander Chemeris and Tom Tsou).

The following data types are currently supported:

 - xCCH
 - PDTCH (CS 1-4 and MCS 1-9)
 - TCH/FR
 - TCH/HR
 - TCH/AFS
 - RCH/AHS
 - RACH
 - SCH

Change-Id: I0c3256b87686d878e4e716d12393cad5924fdfa1
2017-03-07 01:06:38 +07:00
Vadim Yanitskiy 68930e85b5 tests/conv: separate test logic
To be able to add some more tests, related to convolutional coding,
without duplication of code, the test logic was separated from the
conv_test.c into conv.c and conv.h.

Change-Id: Idbdc7e19cb9b9a36cd1fccd621cd858e87530d98
2017-03-06 17:06:45 +00:00
Max 70c7d4160d Use value_string for ctrl_type
Use value_string for enum ctrl_type instead of custom code. Add
corresponding unit tests.

Related: OS#1615
Change-Id: Icd4e96dd9f00876cb70b43cfcf42ab4f10311b28
2017-03-01 16:37:59 +00:00
Neels Hofmeyr bd9de2f66f gsup_test: also check stderr
Configure logging to be deterministic and add stderr checking to testuite.at.

However, exclude the thousands of message modification log lines from the log
to not have a huge test expectation file.

Change-Id: I0dd7112967a64a168556b62e5ec15107b7608ffb
2017-02-22 07:29:46 +00:00
Harald Welte 4ffb43f654 Add minimal testing of socket.c helper functions
Change-Id: I2773b3859a206f96fb8fa095d50a653d9eeb8d79
2017-02-08 18:23:06 +01:00
Neels Hofmeyr d981efa976 oap: add encode/decode unit test
Change-Id: I0e14099e2fc18e333a73d38bda059d53a8ca9944
2016-12-11 03:42:58 +01:00
Holger Hans Peter Freyther c7f52c4c84 wqueue: Reject messges if queue is considered full
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
2016-12-09 11:37:37 +01:00
Neels Hofmeyr 96831049d9 build: make check: disable sim_test when built with --disable-pcsc
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
2016-11-16 16:40:44 +00:00
Neels Hofmeyr d95f01d204 build: tests: don't link system installed libosmogsm.
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
2016-09-10 12:03:39 +00:00
Max 4f169500df Add GEA3 & GEA4 ciphers
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
2016-07-11 19:15:24 +00:00
Harald Welte 136e73764e Add Finite State Machine abstraction code
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>
2016-06-16 21:43:45 +00:00
Max 92db150488 Add helper functions for AMR codec
* 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>
2016-05-31 10:11:51 +00:00
Harald Welte 3b6fb0880c import gprs_gsup_message.[ch] from openbsc as gsup.[ch]
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.
2016-05-06 11:21:06 +02:00
Harald Welte fbd02fa8cc tlv: Import osmo_shift_* and osmo_match_shift_* from openbsc
These routines have nothing to do with specifically the BSC, so import
them to the TLV parser we keep in libosmogsm.
2016-05-05 18:49:27 +02:00
Harald Welte 84da22f964 Add code generator for convolutional codes
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
2016-04-29 13:17:22 +02:00
Harald Welte 676e534462 sim: Add simplistic unit test for APDU class tables 2016-03-17 16:55:11 +01:00
Max 5c18e26bc2 Add T4 bit map compression routines
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>
2016-02-18 19:45:44 +01:00
Jacob Erlbeck 7cd8a1b063 msgb/test: Add test for msgb message buffers
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
2016-01-15 18:09:06 +01:00
Jacob Erlbeck 5f349be820 bitvec: Add get/set byte sequences
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
2016-01-15 14:51:32 +01:00
Jacob Erlbeck 8114294bf2 gsm: Add APN conversion functions
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
2016-01-15 14:46:19 +01:00
Harald Welte 90e614f7cc remove our internal copy of talloc, use system libtalloc
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.
2015-12-05 23:38:18 +01:00
Jacob Erlbeck ee2657f6af test: Remove unneeded linking to libosmovty.la
The addition of libosmovty.la to several test cases as done in
commit 738d9e2210 (stats: Add vty_out_stat_item_group)
is not needed.

This commit removes them.

Sponsored-by: On-Waves ehf
2015-08-22 01:31:23 +00:00
Jacob Erlbeck 738d9e2210 stats: Add vty_out_stat_item_group
This functions dumps a whole stat item group to the VTY.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:12 +01:00