Commit Graph

20 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther fdb4667609 test: Fix compiler warnings on 64bit systems
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.
2015-11-09 16:46:03 +00:00
Alexander Chemeris e4c50d5a43 sms_test: Do not crash on logging. 2014-03-20 22:02:46 +01:00
Jacob Erlbeck 26cbd459fc sms: Fix gsm_7bit legacy functions return value
The legacy 7bit conversion functions (those without the '_n_' in the
name) gave wrong return values on 64 bit platforms due to unproper
signed/unsigned conversions and the usage of SIZE_MAX.

This patch fixes this by using a smaller max size (see
GSM_7BIT_LEGACY_MAX_BUFFER_SIZE, currently set to 64k) for the legacy
wrappers and by using unsigned int for max_septets.
In addition, there are tests now that check the return values of
legacy encoding and decoding.

Sponsored-by: On-Waves ehf
2014-01-09 08:22:14 +01:00
Jacob Erlbeck 73ae7a9ca0 tests: Fix warnings
This fixes warnings that are raised by missing includes, missing casts,
missing return statements, using printf %lu with uint64_t, and unused
symbols.
2013-10-08 14:00:24 +02:00
Holger Hans Peter Freyther bb9f89745a tests: Fix the sms_test and use the right array
It started to behave weird on Debian Testing (GCC 4.8), I compiled it
with address sanitizer support and set a breakpoint in
__asan_report_error to get a backtrace.
2013-10-08 13:57:51 +02:00
Holger Hans Peter Freyther 4d7e49bc0a sms: Implement encoding the address as alphanumeric type
The number of digits is the number of used octets times two (two
digits per octet). The result has been successfully dissected by
wireshark. It has not been tested with real phones.
2013-09-04 10:41:07 +02:00
Jacob Erlbeck 1d7f3b5eb2 sms: Added result buffer size parameter to 7bit conv funs
The 7bit<->8bit encoding/decoding functions didn't check whether
there is still enough space in the destination buffer. Therefore a
buffer size parameter has been added to each of the functions which
is used to truncate the output if the buffer is too small.

In addition, the return value of the decoding functions has been
changed to number of characters written (excluding \0), so this
value is always equal to strlen(decoded).

The old functions are still available as wrapper functions.
2013-08-12 17:22:27 +02:00
Holger Hans Peter Freyther 6bfa7445fc encoding: Provide an overload for the gsm_7bit_encode and a simple test
This is required for encoding the SMS header using the alpha numeric
rules.

Reviewed-by: Jacob Erlbeck <jerlbeck@sysmocom.de>
2013-08-08 14:25:09 +02:00
Diego Elio Pettenò ea0e1eca2b build: simplify test handling and speed up build.
Instead of using a ./configure parameter to decide whehter to build
tests or not, use the check_PROGRAMS variable so that the tests are
only built when running `make check`.

To avoid slowing down the test phase itself, collapse the declaration
of the test targets in the tests/Makefile.am file, this way they can
be built and linked in parallel before the testsuite is executed.

Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.eu>
2012-06-30 22:01:42 +02: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 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
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
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
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 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