Commit Graph

38 Commits

Author SHA1 Message Date
Vadim Yanitskiy 8c88219ecc {src,tests}/Makefile.am: $(COMMON_LA) is not definied
Change-Id: I4958b5d62645be6ed2a200a50a23c567c9a9f3c0
2022-08-09 16:05:35 +00:00
Vadim Yanitskiy a1f1128be5 tests: target 'check-local' does not depend on BUILT_SOURCES
Change-Id: I6cef8024cc10998b29e2bf7fc64c4c98fed7d8dd
2022-08-06 18:36:12 +00:00
Vadim Yanitskiy 19319ce487 tests: make target 'check-local' depend on 'atconfig'
I believe this may be related to sporadic failures we hit on Jenkins:

  test -z "atconfig" || rm -f atconfig
  ../../../tests/testsuite: line 987: ./atconfig: No such file or directory
  make[2]: *** [Makefile:1464: clean-local] Error 1

This dependency is present in all other Osmocom projects.

Change-Id: Id9bf06392ad31e1ecc66a5bd13069a915183a76b
2022-08-06 18:36:12 +00:00
Oliver Smith e54f148ce9 tests: make update_exp: build check_PROGRAMS first
Make test development a bit more convenient.

Change-Id: Ic053aa3ab7485176b58eab6ebb4835cfbe6b8260
2021-08-23 14:56:27 +02:00
Oliver Smith 3f561bfbfe test: add 'make update_exp' target
Add convenience target to update the test output.

Change-Id: I225dd3746200cad748ea09b2c3e1c7f9d006d32f
2021-08-06 22:21:14 +02:00
Pau Espin 582a15e413 tests: Introduce unit tests for PDCH UL Controller
Related: OS#5020
Change-Id: Ie1ff0ca3d7fc8a9824d6fe4dceb746e301082bda
2021-03-15 19:35:43 +01:00
Pau Espin 5bc9612c02 cosmetic: tests/Makefile.am: Split content into several lines
Change-Id: I67361862b992d761b314d9565165ece7e380606d
2021-03-15 19:34:35 +01:00
Pau Espin c0a250d17d Introduce NACC support
A new nacc_fsm is introduced per MS object, with its partner priv
structure struct nacc_fsm_ctx, which exists and is available in the MS
object only during the duration of the NACC procedure.

The NACC context is created on an MS whenever a Pkt Cell Change
Notification is received on Uplink RLCMAC, which asks for neighbor
information of a given ARFCN+BSIC.

First, the target ARFCN+BSIC needs to be translated into a CGI-PS
(RAC+CI) address. That's done by asking the BSC through the Neighbour
Resolution Service available in osmo-bsc using the CTRL interface.

Once the CGI-PS of the target cell is known, PCU starts a RIM RAN-INFO
request against the SGSN (which will route the request as needed), and
wait for a response containing the SI bits from the target cell.

After the SI are received, the scheduler is instructed to eventually
poll a TBF for the MS originating the CCN, so that we can send the SI
encapsulated into multiple Packet Neighbor Cell Data messages on the
downlink.

One all the SI bits are sent, the scheduler is instructed to send a
Packet Cell Change Continue message.

Once the message above has been sent, the FSM autodestroys itself.

Caches are also introduced in this patch which allows for re-using
recently known translations ARFCN+BSIC -> CGI-PS and CGI-PS -> SI_INFO
respectively.

Change-Id: Id35f40d05f3e081f32fddbf1fa34cb338db452ca
2021-01-29 12:59:30 +01:00
Vadim Yanitskiy 8a87f913bd tests/rlcmac: additionally match debug output of the CSN.1 codec
This would allow us to catch more bugs. Note that I had to remove
printing of pointer address to make the output deterministic.

Change-Id: I1a77441eb957353c919bc73f8e3a2e38f4a383a9
2020-02-17 02:30:58 +07:00
Pau Espin ea39fade07 tests/rlcmac: Don't check stderr output
Current stderr output is empty anyway, and not checking it allows
enavling different log levels to easily debug issues.

Change-Id: I5b12e919e08a6eeaad31a459e5a15fdee4d76a61
2020-01-24 13:01:23 +01:00
Pau Espin 474dc77894 tests: TbfTest: Unify stderr and stdout to ease debugging
osmo-pcu code is really verbose, and since log lines printing start and
end of tests are sent to a different file, it's really difficult to
understand which test outputs what.

Change-Id: I3e887158e2c9585c360d44f12f995f55861170f2
2019-09-16 14:21:21 +00:00
Oliver Smith cfb6321b88 Forward ETWS Primary Notification to MS
Receive an Application Information Request from the BTS via PCU
interface. Construct a Packet Application Information message from it
(3GPP TS 44.060 11.2.47) and send it to all MS with active TBF.

The TTCN-3 test infrastructure to test this feature is not quite ready
yet, so I've added C unit tests instead.

Related: OS#4048
Change-Id: Ie35959f833f46bde5f2126314b6f96763f863b36
2019-09-14 15:28:43 +00:00
Oliver Smith 0fb91b736c tests: use -no-install libtool flag to avoid ./lt-* scripts
This ensures that the rpath of the generated binaries is set to use only
the just-compiled so-files and not any system-wide installed libraries
while avoiding the ugly shell script wrapper.

Change-Id: I2915f0de87598f9f23efc2b9a8f4a6bdf4966efb
2019-03-19 13:46:08 +01:00
Max a296118e6d TBF: override send function via linker option
Use --wrap linker facility to override pcu_sock_send() similar to other
Osmo* projects.

Change-Id: Ia3d436bd3d1fb0ce8e98526bd7457f4c57667ceb
2018-01-25 19:54:57 +01:00
Max 46fbfceac6 Add tests for find_multi_slots()
* make function public
* add tests

Change-Id: I4174703808335c19341cd5b5f4422496d958967f
2018-01-25 16:12:56 +00:00
Harald Welte ac0490ad2a tests: Don't use private version of log_info but global gprs_log_info
There's no need for each test case to carry their own log_info and
filter function.  They can simply use the global gprs_log_info and
configure the stderr log verbosity according to their needs.

Change-Id: I8706a624e5d06e062d1198711aa197fbd0860769
2017-10-29 11:02:34 +01:00
Max b86a30dc22 tests: include headers from include/
In addition to .h files from src/ add include/ as well: some headers are
now public and reside in separate directory.

Change-Id: I09c02a171fb3b2f2791ce938725db7d4ff397e95
2017-03-13 13:43:22 +00:00
Philipp Maier 1275a3f91a BTS: Convert relative frame numbers to absolute frame numbers
The implementation of the method rcv_rach() in class BTS, restores
the absolute frame number of the incoming RACH-Request by using
the relative frame number (RFn = Fn mod 42432) from the rach
request and the already known internal absolute frame number
m_cur_fn, which is continusly updated by the CCU interface.

In some rare cases, a RACH request might be received by the BTS,
a very short time before the frame number wraps in its 42432.
Depending on the PCU location, RACH request might be received
by the BSC, which forwards it to the PCU. It is then likely
that, while the RACH request is being forwarded to the PCU, the
PCU internal absolute frame number wraps before the RACH
can be processed. The relative frame number from the rach
request would then be interpreted as if it were received after
the wrapping of the internal frame number modulos.

This commit adds logic to detect and resolve this race condition.
Also a unit test is added to check some cornercases.

Change-Id: I74f00c11e5739d49f370ce6c357149e81d9aa759
2017-03-05 12:23:56 +00:00
Pravin Kumarvel 0a4a6c1200 EGPRS: Add EPDAN CRBB Tree based decoding
Implemented tree based algorithm to decode compressed bitmap in EPDAN
as described in section 9.1.10 of 3GPP 44.060.
This algorithm intends to improve the performance over existing method.
New Regression test is added under bitcomp directory.
Test case is added to validate decompressed result of the bitmap
Present in EPDAN.
Test is done for multiple bitmaps of varying length.
Invalid inputs are also part of the test vector.

Change-Id: Ieae1992ed4b02bb1e09eec2d3de1a030eabd16ce
2016-10-17 11:00:57 +05:30
Jacob Erlbeck d0222cfe2d edge: Add test for GprsCodingScheme
This test checks constructors, predicates, and operators of the
GprsCodingScheme class.

Sponsored-by: On-Waves ehf
2015-12-15 15:19:42 +01:00
Jacob Erlbeck 4f666bc113 llc: Add CoDel AQM implementation
This commit adds an implementation of the CoDel algorithm based on
the reference pseudocode presented in
http://queue.acm.org/appendices/codel.html. Instead of abstracting
the queue itself, the implementation provides a time stamp based
automaton which is invoked after a package has been dequeued.

Note that the modifications of the algorithm shown in
https://tools.ietf.org/html/draft-ietf-aqm-codel-01 are not yet
applied.

Sponsored-by: On-Waves ehf
2015-07-21 19:22:32 +02:00
Jacob Erlbeck 9cc783a87d Revert "llc/test: Explicitly enable extended initialiser lists"
This reverts commit a99d95e3af.

That commit has only removed the warning but not the error.

Sponsored-by: On-Waves ehf
2015-06-29 10:27:25 +02:00
Jacob Erlbeck a99d95e3af llc/test: Explicitly enable extended initialiser lists
To support extended initialiser lists some platforms (at least debian
squeeze) require to add -std=c++0x or -std=gnu++0x to CXXFLAGS. While
that option is deprecated on newer platforms (at least gcc 4.8) this
options is still supported on every platform currently in use.

This commit adds -std=gnu++0x to the CXXFLAGS used to compile
LlcTest.cpp.

Sponsored-by: On-Waves ehf
2015-06-29 10:06:29 +02:00
Jacob Erlbeck 626369c2fb llc/test: Add test program for LLC related tests
Sponsored-by: On-Waves ehf
2015-06-22 10:39:06 +02:00
Jacob Erlbeck b4584ff6c4 build: Add -lrt to AM_LDFLAGS
This is needed to link programs using clock_gettime and related
functions when compiling with older glibc versions.

This should fix the Jenkins build. Nevertheless fixing this in
configure.ac were probably nicer.

Sponsored-by: On-Waves ehf
2015-06-22 10:36:50 +02:00
Holger Hans Peter Freyther b75e23143b llist: Reduce the external dependencies of this test
Debian is using the classic bfd linker and when passing
libosmogb as link dependency it always wants/needs to
resolve the bssgp_prim_cb symbol (which is to be provided
by the application).

Only keep the libosmocore dependency.

Fixes:
lib/libosmogb.so: undefined reference to `bssgp_prim_cb'
collect2: error: ld returned 1 exit status
Makefile:511: recipe for target 'llist/LListTest' failed
2015-05-22 10:33:35 +02:00
Jacob Erlbeck dfef28de88 llist: Add a C++ wrapper for linux_list
This commit adds the LListHead class which is a wrapper around the
linuxlist. It adds an additional member to refer to the container,
since the container_of macro doesn't work properly with C++ classes.
All functions and macros from linuxlist.h are support except for the
entry macros (e.g. llist_entry, llist_for_each_entry, ...). To access
the container (entry), an entry() method is provided instead:

  llist_for_each(pos, &elems) {
      pos->entry()->do_something();
  }

Sponsored-by: On-Waves ehf
2015-05-20 11:36:06 +02:00
Jacob Erlbeck e04e0b0a20 ms: Add GprsMs class to hold per-MS information
Currently only TBF objects are used to handle the data flow between
the MS and the SGSN. MS specific data (e.g. pending LLC frames, TLLI)
is copied between successive TBFs. If all TBFs (uplink and downlink)
are idle for some time, all information about the MS is discarded in
the PCU. This makes the implementation of some features more
difficult, e.g. proper TLLI and timing advance handling,
connection based CS selection, and proper management of multiple TBF.

This commit adds the GprsMs class that is intended to hold
information directly related to the MS and to keep references to the
active TBFs.

The class is not yet integrated with the other PCU code. A GprsMs
object container and MS specific fields (TA, CS) will be added in
later commits.

Note that calling detach_tbf() can possibly delete the MS object
depending on the callback implementation.

Ticket: #1674
Sponsored-by: On-Waves ehf
2015-05-20 11:30:41 +02:00
Jacob Erlbeck 18fef10641 tests: Fix library link order
Currently libgprs.la is listed after libosmocore.so which leads to
link errors when compiling under Ubuntu with the system build tools
(no cross compiling).

This patch moves libgprs.la in front of the external libs.

Sponsored-by: On-Waves ehf
2015-02-23 14:17:01 +01:00
Holger Hans Peter Freyther 6058220d2a types: Add a simple testcase for basic types and fix the LLC code
* Make append_data, remaining_space and fits_in_current.. work
  on m_length and not the index. This ways things can't overflow.
* The current API consumer was moving the m_index so it should have
  worked okay.
2013-11-21 21:30:23 +01:00
Holger Hans Peter Freyther b809866be5 tbf: Learn and propagate the TLLI changes due a new P-TMSI
During a routing area update a new P-TMSI was assigned. During
the PACKET CONTROL ACK on the DL we notice the change of TLLI
but didn't propagate this. This means that a Routing Area Update
Complete was only sent after a new RACH request.

Addresses:
<0007> gprs_rlcmac_meas.cpp:103 UL RSSI of TLLI=0x88661bc6: -67 dBm
<0002> bts.cpp:945 Got ACK, but UL TBF is gone TLLI=0xe512eba3
<0007> gprs_rlcmac_meas.cpp:158 DL packet loss of IMSI=274080000004765 / TLLI=0xe512eba3: 0%
<0002> tbf.cpp:668 TBF TFI=0 TLLI=0x88661bc6 T3169 timeout during transsmission
<0002> tbf.cpp:690 - Assignment was on PACCH
<0002> tbf.cpp:694 - No uplink data received yet
2013-10-30 21:24:13 +01:00
Holger Hans Peter Freyther bfdd5f285b alloc: Add very basic test case for the alloc_a algorithm 2013-10-30 21:20:44 +01:00
Holger Hans Peter Freyther 9d938388f6 emu: Add a crash re-producer for the SGSN (and the concept of tests)
Introduce the concept of tests that will be ran one after the other.
This new test will send static message that will lead to the opening
of a PDP context. At this point one should use ping with a large
packet size and suspend/stop the emulator. Once the NS connection is
considered dead the SGSN will crash with a double free.

Reproduce:
0.) Add IMSI 901700000003094 to the ACL
1.) Stop/Suspend the emulation process so the NS Alive times out
2.) Use ping IP -s 2048

This will create a double free...

 #4  0xb7bb2646 in talloc_abort_double_free () at talloc.c:175
 #5  0xb7bbd41a in talloc_chunk_from_ptr (ptr=0x8091208) at talloc.c:190
 #6  _talloc_free (ptr=0x8091208) at talloc.c:517
 #7  talloc_free (ptr=ptr@entry=0x8091208) at talloc.c:990
 #8  0xb7bb319b in msgb_free (m=m@entry=0x8091208) at msgb.c:72
 #9  0x0804db54 in sndcp_send_ud_frag (fs=0xbfffcc6c) at gprs_sndcp.c:423
 #10 sndcp_unitdata_req (msg=msg@entry=0x808eed8, lle=0x808fbc8, nsapi=5 '\005',
    mmcontext=mmcontext@entry=0x80903e8) at gprs_sndcp.c:471
2013-09-04 21:29:00 +04:00
Holger Hans Peter Freyther bc1e52cfbf emu: Use OpenBSC code to decode the LLC and add assertions
Use the OpenBSC SGSN code to parse the LLC data and look into
the data we receive. Add assertions to verify the the sequence
number is increasing.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 741481d3e0 emu: Send a static GPRS ATTACH request and wait for the reply.
This will send a static message. It will trigger the GMM code
on the SGSN and might ask us for the IMEI/IMSI or send us an
accept. As we are not replying at all the SGSN needs to send new
requests and we can observe if the sequence number is increasing
like it should.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther 4ea940787e emu: Create an app that allows to communicate with a SGSN
This code can open a BSSGP connection toward a SGSN and will
inititate the unblocking. It does not send any user data.
2013-09-04 21:28:53 +04:00
Holger Hans Peter Freyther e13298d093 tests: Move the RLCMACTest into the test directory and setup autotest 2013-08-02 13:40:20 +04:00
Holger Hans Peter Freyther bb00704871 tests: Create tests directory and move the VTY testing into there 2013-08-02 13:39:55 +04:00