2016-09-08 22:43:15 +00:00
|
|
|
SUBDIRS = \
|
2016-06-19 16:06:02 +00:00
|
|
|
sms_queue \
|
2017-01-25 14:04:16 +00:00
|
|
|
msc_vlr \
|
Introduce initial unit test for db_sms_* API
Since OsmoMSC has built-in SMSC, it needs to store the messages
somewhere. Currently we use libdbi and SQLite3 back-end for that.
For a long time, the db_sms_* API remained uncovered by unit tests.
This change aims to fix that, and does cover the following calls:
- db_sms_store(),
- db_sms_get(),
- db_sms_get_next_unsent(),
- db_sms_mark_delivered(),
- db_sms_delete_sent_message_by_id(),
- db_sms_delete_by_msisdn(),
- db_sms_delete_oldest_expired_message().
Due to performance reasons, the test database is initialized in
RAM using the magic filename ':memory:'. This is a feature of
SQLite3 (and not libdbi), see:
https://www.sqlite.org/inmemorydb.html
Of course, this unit test helped to discover some problems:
1) Storing an SMS with empty TP-User-Data (TP-UDL=0) causes
buffer overruns in both db_sms_store() and db_sms_get().
2) TP-User-Data-Length is always being interpreted in octets,
regardless of DCS (Data Coding Scheme). This results in
storing garbage in the database if the default 7-bit
encoding is used. Fortunately, the 'user_data' buffer
in structure 'gsm_sms' is large emough, so we don't
experience buffer overruns.
3) db_sms_delete_oldest_expired_message() doesn't work
as expected. Instead of removing the *oldest* expired
message, it tries to remove the *newest* one.
The current test expectations do reflect these problems.
All of them will be fixed in the follow-up patches.
Change-Id: Id94ad35b6f78f839137db2e17010fbf9b40111a3
2019-04-09 09:55:44 +00:00
|
|
|
db_sms \
|
2019-10-21 01:24:04 +00:00
|
|
|
sdp_msg \
|
2019-10-21 01:00:26 +00:00
|
|
|
mncc \
|
2016-09-08 22:43:15 +00:00
|
|
|
$(NULL)
|
2016-08-10 10:08:03 +00:00
|
|
|
|
2013-07-13 15:09:56 +00:00
|
|
|
if BUILD_SMPP
|
2016-09-08 22:43:15 +00:00
|
|
|
SUBDIRS += \
|
|
|
|
smpp \
|
|
|
|
$(NULL)
|
2013-07-13 15:09:56 +00:00
|
|
|
endif
|
2014-09-30 07:10:25 +00:00
|
|
|
|
2012-01-06 14:16:12 +00:00
|
|
|
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
|
2012-01-09 21:53:04 +00:00
|
|
|
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
|
2012-01-06 14:16:12 +00:00
|
|
|
:;{ \
|
|
|
|
echo '# Signature of the current package.' && \
|
|
|
|
echo 'm4_define([AT_PACKAGE_NAME],' && \
|
|
|
|
echo ' [$(PACKAGE_NAME)])' && \
|
|
|
|
echo 'm4_define([AT_PACKAGE_TARNAME],' && \
|
|
|
|
echo ' [$(PACKAGE_TARNAME)])' && \
|
|
|
|
echo 'm4_define([AT_PACKAGE_VERSION],' && \
|
|
|
|
echo ' [$(PACKAGE_VERSION)])' && \
|
|
|
|
echo 'm4_define([AT_PACKAGE_STRING],' && \
|
|
|
|
echo ' [$(PACKAGE_STRING)])' && \
|
|
|
|
echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
|
|
|
|
echo ' [$(PACKAGE_BUGREPORT)])'; \
|
|
|
|
echo 'm4_define([AT_PACKAGE_URL],' && \
|
|
|
|
echo ' [$(PACKAGE_URL)])'; \
|
2012-01-09 20:49:47 +00:00
|
|
|
} >'$(srcdir)/package.m4'
|
2012-01-06 14:16:12 +00:00
|
|
|
|
2016-09-08 22:43:15 +00:00
|
|
|
EXTRA_DIST = \
|
|
|
|
testsuite.at \
|
|
|
|
$(srcdir)/package.m4 \
|
|
|
|
$(TESTSUITE) \
|
|
|
|
vty_test_runner.py \
|
|
|
|
ctrl_test_runner.py \
|
|
|
|
smpp_test_runner.py \
|
2018-12-05 01:24:30 +00:00
|
|
|
test_nodes.vty \
|
2016-09-08 22:43:15 +00:00
|
|
|
$(NULL)
|
|
|
|
|
2012-01-09 20:49:47 +00:00
|
|
|
TESTSUITE = $(srcdir)/testsuite
|
2016-09-08 22:43:15 +00:00
|
|
|
|
|
|
|
DISTCLEANFILES = \
|
|
|
|
atconfig \
|
|
|
|
$(NULL)
|
2012-01-06 14:16:12 +00:00
|
|
|
|
2014-08-21 22:29:04 +00:00
|
|
|
if ENABLE_EXT_TESTS
|
2018-12-05 01:24:16 +00:00
|
|
|
# don't run multiple tests concurrently so that the ports don't conflict
|
2013-04-05 15:36:09 +00:00
|
|
|
python-tests: $(BUILT_SOURCES)
|
2018-12-05 01:24:16 +00:00
|
|
|
$(MAKE) vty-test
|
|
|
|
$(MAKE) ctrl-test
|
2014-03-06 22:43:13 +00:00
|
|
|
if BUILD_SMPP
|
2018-12-05 01:24:16 +00:00
|
|
|
$(MAKE) smpp-test
|
2014-03-06 22:43:13 +00:00
|
|
|
endif
|
2018-12-05 01:24:16 +00:00
|
|
|
|
2013-04-05 15:36:09 +00:00
|
|
|
else
|
|
|
|
python-tests: $(BUILT_SOURCES)
|
|
|
|
echo "Not running python-based tests (determined at configure-time)"
|
|
|
|
endif
|
|
|
|
|
2018-12-05 01:24:16 +00:00
|
|
|
vty-python-test: $(BUILT_SOURCES)
|
2019-10-29 14:37:19 +00:00
|
|
|
if BUILD_IU
|
|
|
|
IU=1 osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
|
|
|
IU=1 osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
|
|
|
else
|
|
|
|
IU=0 osmotestvty.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
|
|
|
IU=0 osmotestconfig.py -p $(abs_top_srcdir) -w $(abs_top_builddir) -v
|
|
|
|
endif
|
2018-12-05 01:24:16 +00:00
|
|
|
$(srcdir)/vty_test_runner.py -w $(abs_top_builddir) -v
|
|
|
|
rm -f $(top_builddir)/sms.db
|
|
|
|
|
2020-06-15 01:09:54 +00:00
|
|
|
# Run a specific transcript test with: 'make vty-transcript-test VTY_TEST=osmo-msc.vty'
|
|
|
|
VTY_TEST ?= *.vty
|
|
|
|
|
2018-12-05 01:24:16 +00:00
|
|
|
# To update the VTY script from current application behavior,
|
|
|
|
# pass -u to vty_script_runner.py by doing:
|
|
|
|
# make vty-transcript-test U=-u
|
|
|
|
vty-transcript-test:
|
2018-12-05 01:24:30 +00:00
|
|
|
osmo_verify_transcript_vty.py -v \
|
|
|
|
-n OsmoMSC -p 4254 \
|
|
|
|
-r "$(top_builddir)/src/osmo-msc/osmo-msc -c $(top_srcdir)/doc/examples/osmo-msc/osmo-msc.cfg" \
|
2020-06-15 01:09:54 +00:00
|
|
|
$(U) $(srcdir)/$(VTY_TEST)
|
2018-12-05 01:24:30 +00:00
|
|
|
rm -f $(builddir)/sms.db
|
2018-12-05 01:24:16 +00:00
|
|
|
|
|
|
|
# don't run multiple tests concurrently so that the ports don't conflict
|
|
|
|
vty-test:
|
|
|
|
$(MAKE) vty-python-test
|
|
|
|
$(MAKE) vty-transcript-test
|
|
|
|
|
|
|
|
ctrl-python-test: $(BUILT_SOURCES)
|
|
|
|
$(srcdir)/ctrl_test_runner.py -w $(abs_top_builddir) -v
|
|
|
|
rm -f $(top_builddir)/sms.db
|
|
|
|
|
|
|
|
# To update the CTRL script from current application behavior,
|
|
|
|
# pass -u to ctrl_script_runner.py by doing:
|
|
|
|
# make ctrl-transcript-test U=-u
|
|
|
|
ctrl-transcript-test:
|
|
|
|
echo "No ctrl-transcript-test exists yet"
|
|
|
|
|
|
|
|
# don't run multiple tests concurrently so that the ports don't conflict
|
|
|
|
ctrl-test:
|
|
|
|
$(MAKE) ctrl-python-test
|
|
|
|
$(MAKE) ctrl-transcript-test
|
|
|
|
|
|
|
|
smpp-test:
|
|
|
|
$(srcdir)/smpp_test_runner.py -w $(abs_top_builddir) -v
|
|
|
|
rm -f $(top_builddir)/sms.db
|
|
|
|
|
2012-01-06 14:16:12 +00:00
|
|
|
check-local: atconfig $(TESTSUITE)
|
|
|
|
$(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
|
2013-04-05 15:36:09 +00:00
|
|
|
$(MAKE) $(AM_MAKEFLAGS) python-tests
|
2012-01-06 14:16:12 +00:00
|
|
|
|
|
|
|
installcheck-local: atconfig $(TESTSUITE)
|
|
|
|
$(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
|
|
|
|
$(TESTSUITEFLAGS)
|
|
|
|
|
|
|
|
clean-local:
|
|
|
|
test ! -f '$(TESTSUITE)' || \
|
|
|
|
$(SHELL) '$(TESTSUITE)' --clean
|
|
|
|
|
|
|
|
AUTOM4TE = $(SHELL) $(top_srcdir)/missing --run autom4te
|
|
|
|
AUTOTEST = $(AUTOM4TE) --language=autotest
|
2012-01-09 20:49:47 +00:00
|
|
|
$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
|
2012-01-06 14:16:12 +00:00
|
|
|
$(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
|
|
|
|
mv $@.tmp $@
|