Commit Graph

50 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 00a12feae6 timer: Increase the imprecision we accept in this test
On a loaded server we might not be able to reach 10ms precision
in the test configuration and this is not a high precision timer
anyway.
2012-04-05 09:53:38 +02:00
Holger Hans Peter Freyther 13b07de36a auth: Update test result with the new OP/OPC output 2012-03-21 20:54:44 +01:00
Harald Welte 042afe7fe7 milenage: Add function to compute OPC from OP and K 2012-03-21 08:19:47 +01:00
Harald Welte 07b625dd2c GSM 08.08: change gsm0808_create_classmark_update() prototype
The caller explicitly specifies CM2 and CM3, rather than one blob
containing both.
2012-01-26 22:42:16 +01:00
Holger Hans Peter Freyther 97510814d8 tests: Introduce a very basic gsm0808 test
This tests verifies the content of the GSM 08.08 messages, it does
not verify the remaining headroom (which the SCCP/IPA code relies
on being plenty to prepend the header). More to come in the future.
2012-01-22 13:46:58 +01:00
Holger Hans Peter Freyther 3a5f08c221 lapdm: Make sure that the msgb_l3len(msg) == length...
This code should not play with the internals of the msgb like this,
this code got introduced in af48bed556 and is breaking the
osmo-bts usecase of forwarding an RSL message.

Add a test case that fails without the new code. I would prefer if
we could get rid of the manipulating the msgb like this, it is prone
to errors like this one.
2012-01-12 23:23:19 +01:00
Holger Hans Peter Freyther 90656dbd00 lapd: Warn if someone attempts to send an empty message
DATA REQ with a msgb_l3len(msg) == 0 message does not make any
sense, log an error and return immediately before attempting to
send an empty I frame in lapd_send_i.
2012-01-12 23:23:10 +01:00
Holger Hans Peter Freyther 4a075f82f0 lapd: Disable one part of the test as it fails on FreeBSD
I thought this number would be wrong in the same way but it depends
on OS/ARCH. Disable this part of the test for now.
2011-12-12 00:41:25 +01:00
Holger Hans Peter Freyther 15f740caa3 lapd_test: Look at the content of LAPD messages and compare them
Verify the output, accept two known errors in the generation of it.
2011-12-12 00:34:06 +01:00
Holger Hans Peter Freyther 72bd4eb3b9 lapdm: Create a simple test case to transmit data between both ends
This is testing the establishment of two ends (BTS, MS) one is in
the polling mode as used by osmo-bts. Transfer data between the two
ends. The sent data is not verified though. This should be followed
up soon.
2011-12-11 21:35:06 +01:00
Harald Welte aae2362455 auth_core: don't use anonymous unions to make certain gcc versions happy 2011-12-07 11:35:02 +01:00
Harald Welte 57143a4361 milenage_test: make sure test output is what .ok file expects 2011-12-07 03:12:44 +01:00
Harald Welte 9df00bb857 milenage_test: make sure test result matches expectations 2011-12-07 02:56:11 +01:00
Harald Welte 5c6032393b whitespace fixes in milenage_test.ok 2011-12-07 00:24:59 +01:00
Harald Welte e076ac087c add autotest script for milenage/auth testing 2011-12-07 00:10:18 +01:00
Holger Hans Peter Freyther 62cb457632 tests: Use the missing from the source directory
No need to keep a manual copy of the missing binary, use the one
that will be in the top_srcdir.
2011-11-29 22:20:34 +01:00
Sylvain Munaut 29eb92db02 core/conv: Add regression testing code
It tests both a given test vector encoding/decoding, and
some random coding/decoding cycles.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-24 17:48:42 +01:00
Sylvain Munaut a42e2f6fb6 tests/a5: Add a5_test.ok as EXTRA_DIST
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 21:31:01 +01:00
Sylvain Munaut fb19530f67 tests: fix cut & paste error
Damn ... I fixed it locally and didn't properly commit the fix before
push.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 21:16:51 +01:00
Sylvain Munaut 810c33483e tests/a5: Add a5 regression testing
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2011-11-17 20:33:19 +01:00
Holger Hans Peter Freyther f6c1d4cd81 tests: Fix the make distcheck of libosmocore with the tests 2011-11-14 14:37:46 +01:00
Holger Hans Peter Freyther bf12800c51 tests: Initialize log system to fix crash, update test result
Use osmo_init_logging to initialize the log system to fix crashes
when we attempt to parse broken ASN1 messages.

Ignore stderr with parse errors, update the test result. make check
is now passing.
2011-11-14 13:35:42 +01:00
Pablo Neira Ayuso 72eb44cc51 tests: timer: set maximum wait time to obtain test results
If the timer test takes more than 2 * (number of steps + 10), we
abort the test. This calculation is based on the maximum timeout
randomly set (10 seconds) plus the number of steps (some existing
timers may be reset in each step). We double this to have some
extra grace time to finish.
2011-11-14 13:35:42 +01:00
Pablo Neira Ayuso 7a0ca16eec tests: timer: use stderr for non-repeatable output
This makes happy gnu-autotest for the timer test.

We may still may fail if we run the test on a very heavy loaded
system, but given the amount of timers that we using for the
automatic test (only 32), this seems very unlikely to me.
2011-11-14 13:35:42 +01:00
Holger Hans Peter Freyther ad0e8859c2 tests: Reduce the iterations for the timertest, ignore stderr
Use one of the magic commands for the stderr, in this case we want
to log the output but ignore it for processing.

http://www.gnu.org/s/hello/manual/autoconf/Writing-Testsuites.html#Writing-Testsuites
2011-11-14 13:35:41 +01:00
Pablo Neira Ayuso f141837ea8 tests: timer: add parameter to select the number of steps
Holger likes having a parameter to set the number of steps in this
test. Now you can set it via `-s' option.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-11-14 13:35:41 +01:00
Holger Hans Peter Freyther f9eda7489b tests: Use GNU autotest to execute our tests and compare textual output
The output of make check is looking like this now:

Regression tests.

  1: bits                                            ok
  2: msgfile                                         ok
  3: sms                                             ok
  4: smscb                                           ok
  5: timer                                           FAILED (testsuite.at:38)
  6: ussd                                            FAILED (testsuite.at:44)
2011-11-14 13:35:41 +01:00
Pablo Neira Ayuso 9ebc5056b4 tests: add new torture test for timer infrastructure
This is a new test for the timer infrastructure. It basically consists
of adding 2^N timers per step (where N is the number of step) that
expire in (random() % 10) + 1 seconds. Moreover, we randomly delete
timers that fulfill (random() % 100) < 10 everytime one timer expires.

The default number of steps is 16, the test also allows to check for
timer imprecisions (currently, defaulting to 10ms as aceptable).

The list-based implementation crashes or it seems loop forever with
this test (I guess due to some memory corruption).

BTW, this patch contains one cosmetic clean up since we go back to
8-chars per indentations, which seems to be the policy in osmocom.
2011-10-17 13:25:29 +02:00
Harald Welte 712691d8d8 add functions for bit-reversal
Sometimes we need stuff like reversing every bit in each byte (but not
the byte-order).
2011-09-01 14:47:31 +02:00
Dennis Wehrle 291e61346b sms: SMS where cropped (from VTY), concatenation of SMS where not possible
Additionally it wasn't possible to send concatenated sms from the vty.
To send multiple sms, it is necessary to use padding bits and add a user_data_header.
Therefore the gsm_7bit_encode function was splitted to gsm_7bit_encode and gsm_septets2octets.
gsm_septets2octets: this is the old gsm_7bit_encode function + additional padding parameter

Additionally the gsm_7bit_decode function was modified to take account for the user_data_header.
With the new gsm_get_octet_len function you can get the octet length for a given septet length.

I also added several sms tests.
2011-07-24 20:14:13 +02:00
Pablo Neira Ayuso 1b4a42c3b1 msgfile: use namespace prefix osmo_* and use more descriptive names
Summary of changes:

s/msg_entry/osmo_config_entry/g
s/msg_entries/osmo_config_list/g
s/msg_entry_parse/osmo_config_list_parse/g

minor glitch included in this patch while I was at it:

-#include "linuxlist.h"
+#include <osmocom/core/linuxlist.h>
2011-05-07 13:14:41 +02:00
Pablo Neira Ayuso f7f89d0cfe select: use namespace prefix osmo_fd* and osmo_select*
Summary of changes:

s/struct bsc_fd/struct osmo_fd/g
s/bsc_register_fd/osmo_fd_register/g
s/bsc_unregister_fd/osmo_fd_unregister/g
s/bsc_select_main/osmo_select_main/g
2011-05-07 13:00:51 +02:00
Pablo Neira Ayuso 0b21c1c885 timer: use namespace prefix osmo_timer*
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-07 13:00:51 +02:00
Holger Hans Peter Freyther 28dbfe9bf7 misc: Remove the sys/types.h include from various files
We used this include for the u_int{8,16,32}_t types but we do
not need this anymore.
2011-04-18 16:57:04 +02:00
Pablo Neira Ayuso 8341934844 include: reorganize headers file to include/osmocom/[gsm|core]
This patch moves all GSM-specific definitions to include/osmocom/gsm.
Moreover, the headers in include/osmocore/ have been moved to
include/osmocom/core.

This has been proposed by Harald Welte and Sylvain Munaunt.

Tested with `make distcheck'.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:09:28 +01:00
Pablo Neira Ayuso fba495e5f6 This patch moves the GSM-specific functions to the new library
libosmogsm which is provided by libosmocore.

I have also moved generate_backtrace() to backtrace.c instead
of gsm_utils.c, otherwise the timer and msgfile tests depend on
libosmogsm.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-03-23 18:08:08 +01:00
Holger Hans Peter Freyther e05c7dfa8e smscb: Add some simple decoding routines for SMSCB. 2010-12-29 22:51:45 +01:00
Holger Hans Peter Freyther 131bc80b96 msgfile: Allow to have comments in the simple CSV file 2010-10-26 09:32:35 +02:00
Holger Hans Peter Freyther f632371b76 ussd: Verify that parsing is stil working and print the decoded text. 2010-10-11 09:26:19 +02:00
Holger Hans Peter Freyther c88a44f493 ussd: Add next test that show that we access the data out of bounds
This test is showing that the internal ASN1 code is not checking
the size properly.
2010-10-11 09:26:19 +02:00
Holger Hans Peter Freyther daa653fc22 ussd: Add a test case, switch parsing to use a gsm48_hdr and len
The current USSD code is not doing any size checks, add a test
case to find out how easily we access the data out of bounds.
Begin to use the length in some places.
2010-10-11 09:25:14 +02:00
Holger Hans Peter Freyther c87f266522 msgfile: Add a file parser for a simple file format
This file format will be used to store per country code,
per network code messages. This will be used for various
things ranging from access control, to messages...
2010-10-08 19:23:18 +08:00
Nico Golde c0ce9aa20d tests: don't hardcode length values of expected encoding gsm_7bit_encode:
make sure to return the number of actually written bytes gsm_7bit_decode:
calculate length of resulting septets from input length before decoding

The input length to gsm_7bit_decode reflects the number of encoded bytes
to be decoded. As the decoding is done on the input in septetes we need
to take this into account and recalculate the length.
2010-07-21 02:43:58 +08:00
Holger Hans Peter Freyther 31e97ea34e tests: Separate encoding/decoding test to verify them independly
Use the current test result as test data for future
regression testing. The encode function appears to
add too many zeros to the text.
2010-07-20 02:48:17 +08:00
Nico Golde 28de05336b * rewrite GSM 7bit default encoding/decoding based on a lookup table as the previous code produced wrong encodings for certain characters. 2010-07-20 02:48:17 +08:00
Harald Welte f8b2ba7dc8 add option --disable-tests to disable building of test binaries 2010-03-07 20:33:59 +01:00
Holger Hans Peter Freyther d60c7a895e [timer] Fix compile warning of the timer test 2010-02-26 20:03:13 +01:00
Harald Welte e94ad58e8e fix config.h directory 2010-02-20 22:06:24 +01:00
Harald Welte 3cae0398ea add missing automake / autoconf files 2010-02-20 21:09:24 +01:00
Harald Welte ec8b4501c7 intial checkin of the libosmocore project 2010-02-20 20:34:29 +01:00