libosmocore/tests/testsuite.at

511 lines
15 KiB
Plaintext
Raw Normal View History

AT_INIT
AT_BANNER([Regression tests.])
# todo.. create one macro for it
AT_SETUP([a5])
AT_KEYWORDS([a5])
cat $abs_srcdir/a5/a5_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/a5/a5_test], [0], [expout])
AT_CLEANUP
AT_SETUP([abis])
AT_KEYWORDS([abis])
cat $abs_srcdir/abis/abis_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/abis/abis_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([ctrl])
AT_KEYWORDS([ctrl])
cat $abs_srcdir/ctrl/ctrl_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/ctrl/ctrl_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([kasumi])
AT_KEYWORDS([kasumi])
cat $abs_srcdir/kasumi/kasumi_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/kasumi/kasumi_test], [0], [expout])
AT_CLEANUP
AT_SETUP([bits])
AT_KEYWORDS([bits])
cat $abs_srcdir/bits/bitrev_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bits/bitrev_test], [0], [expout])
AT_CLEANUP
AT_SETUP([bitvec])
AT_KEYWORDS([bitvec])
cat $abs_srcdir/bitvec/bitvec_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bitvec/bitvec_test], [0], [expout])
AT_CLEANUP
AT_SETUP([bitcomp])
AT_KEYWORDS([bitcomp])
cat $abs_srcdir/bits/bitcomp_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bits/bitcomp_test], [0], [expout])
AT_CLEANUP
AT_SETUP([bitfield])
AT_KEYWORDS([bitfield])
cat $abs_srcdir/bits/bitfield_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bits/bitfield_test], [0], [expout])
AT_CLEANUP
AT_SETUP([conv])
AT_KEYWORDS([conv])
cat $abs_srcdir/conv/conv_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/conv/conv_test], [0], [expout])
AT_CLEANUP
AT_SETUP([conv_gsm0503])
AT_KEYWORDS([conv_gsm0503])
cat $abs_srcdir/conv/conv_gsm0503_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/conv/conv_gsm0503_test], [0], [expout])
AT_CLEANUP
AT_SETUP([coding])
AT_KEYWORDS([coding])
cat $abs_srcdir/coding/coding_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/coding/coding_test], [0], [expout])
AT_CLEANUP
AT_SETUP([msgb])
AT_KEYWORDS([msgb])
cat $abs_srcdir/msgb/msgb_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/msgb/msgb_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gea])
AT_KEYWORDS([gea])
cat $abs_srcdir/gea/gea_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gea/gea_test], [0], [expout])
AT_CLEANUP
if ENABLE_MSGFILE
AT_SETUP([msgfile])
AT_KEYWORDS([msgfile])
cp $abs_srcdir/msgfile/msgconfig.cfg .
cat $abs_srcdir/msgfile/msgfile_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/msgfile/msgfile_test], [0], [expout])
AT_CLEANUP
endif
AT_SETUP([sms])
AT_KEYWORDS([sms])
cat $abs_srcdir/sms/sms_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/sms/sms_test], [0], [expout])
AT_CLEANUP
AT_SETUP([smscb])
AT_KEYWORDS([smscb])
cat $abs_srcdir/smscb/smscb_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/smscb/smscb_test], [0], [expout])
AT_CLEANUP
AT_SETUP([smscb_gsm0341])
AT_KEYWORDS([smscb_gsm0341])
cat $abs_srcdir/smscb/gsm0341_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/smscb/gsm0341_test], [0], [expout])
AT_CLEANUP
AT_SETUP([smscb_cbsp])
AT_KEYWORDS([smscb_cbsp])
cat $abs_srcdir/smscb/cbsp_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/smscb/cbsp_test], [0], [expout])
AT_CLEANUP
AT_SETUP([ussd])
AT_KEYWORDS([ussd])
cat $abs_srcdir/ussd/ussd_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/ussd/ussd_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([auth])
AT_KEYWORDS([auth])
cat $abs_srcdir/auth/milenage_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/auth/milenage_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([auth_xor2g])
AT_KEYWORDS([auth_xor2g])
cat $abs_srcdir/auth/xor2g_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/auth/xor2g_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([comp128])
AT_KEYWORDS([comp128])
cat $abs_srcdir/comp128/comp128_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/comp128/comp128_test], [0], [expout])
AT_CLEANUP
AT_SETUP([lapd])
AT_KEYWORDS([lapd])
cat $abs_srcdir/lapd/lapd_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/lapd/lapd_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsm0502])
AT_KEYWORDS([gsm0502])
cat $abs_srcdir/gsm0502/gsm0502_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm0502/gsm0502_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([dtx])
AT_KEYWORDS([dtx])
cat $abs_srcdir/dtx/dtx_gsm0503_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/dtx/dtx_gsm0503_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsm0808])
AT_KEYWORDS([gsm0808])
cat $abs_srcdir/gsm0808/gsm0808_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm0808/gsm0808_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsm29205])
AT_KEYWORDS([gsm29205])
cat $abs_srcdir/gsm29205/gsm29205_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm29205/gsm29205_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsm0408])
AT_KEYWORDS([gsm0408])
cat $abs_srcdir/gsm0408/gsm0408_test.ok > expout
cat $abs_srcdir/gsm0408/gsm0408_test.err > experr
AT_CHECK([$abs_top_builddir/tests/gsm0408/gsm0408_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([gsm48_rest_octets])
AT_KEYWORDS([gsm48_rest_octets])
cat $abs_srcdir/gsm48/rest_octets_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm48/rest_octets_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gprs])
AT_KEYWORDS([gprs])
cat $abs_srcdir/gprs/gprs_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gprs/gprs_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([logging_stream])
AT_KEYWORDS([logging_stream])
cat $abs_srcdir/logging/logging_test.ok > expout
cat $abs_srcdir/logging/logging_test.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test stream], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([logging_wqueue])
AT_KEYWORDS([logging_wqueue])
cat $abs_srcdir/logging/logging_test.ok > expout
cat $abs_srcdir/logging/logging_test.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test wqueue], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([codec])
AT_KEYWORDS([codec])
cat $abs_srcdir/codec/codec_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/codec/codec_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([codec_ecu_fr])
AT_KEYWORDS([codec_ecu_fr])
cat $abs_srcdir/codec/codec_ecu_fr_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/codec/codec_ecu_fr_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([fr])
AT_KEYWORDS([fr])
cat $abs_srcdir/fr/fr_test.ok > expout
cat $abs_srcdir/fr/fr_test.err > experr
AT_CHECK([$abs_top_builddir/tests/fr/fr_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([loggingrb])
AT_KEYWORDS([loggingrb])
cat $abs_srcdir/loggingrb/logging_test.ok > expout
cat $abs_srcdir/loggingrb/logging_test.err > experr
AT_CHECK([$abs_top_builddir/tests/loggingrb/loggingrb_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([strrb])
AT_KEYWORDS([strrb])
cat $abs_srcdir/strrb/strrb_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/strrb/strrb_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([vty])
AT_KEYWORDS([vty])
cat $abs_srcdir/vty/vty_test.ok > expout
cat $abs_srcdir/vty/vty_test.err > experr
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-07 01:08:06 +00:00
cp $abs_srcdir/vty/*.cfg .
AT_CHECK([$abs_top_builddir/tests/vty/vty_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([gprs-bssgp])
AT_KEYWORDS([gprs-bssgp])
cat $abs_srcdir/gb/gprs_bssgp_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gb/gprs_bssgp_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gprs-bssgp-rim])
AT_KEYWORDS([gprs-bssgp-rim])
cat $abs_srcdir/gb/gprs_bssgp_rim_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gb/gprs_bssgp_rim_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gprs-ns])
AT_KEYWORDS([gprs-ns])
cat $abs_srcdir/gb/gprs_ns_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gb/gprs_ns_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gprs-ns2])
AT_KEYWORDS([gprs-ns2])
cat $abs_srcdir/gb/gprs_ns2_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gb/gprs_ns2_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([utils])
AT_KEYWORDS([utils])
cat $abs_srcdir/utils/utils_test.ok > expout
cat $abs_srcdir/utils/utils_test.err > experr
AT_CHECK([$abs_top_builddir/tests/utils/utils_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([stats])
AT_KEYWORDS([stats])
cat $abs_srcdir/stats/stats_test.ok > expout
cat $abs_srcdir/stats/stats_test.err > experr
AT_CHECK([$abs_top_builddir/tests/stats/stats_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([write_queue])
AT_KEYWORDS([write_queue])
cat $abs_srcdir/write_queue/wqueue_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/write_queue/wqueue_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([bssgp-fc])
AT_KEYWORDS([bssgp-fc])
cat $abs_srcdir/gb/bssgp_fc_tests.ok > expout
cat $abs_srcdir/gb/bssgp_fc_tests.err > experr
AT_CHECK([$abs_top_srcdir/tests/gb/bssgp_fc_tests.sh $abs_top_builddir/tests/gb], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([sim])
AT_KEYWORDS([sim])
AT_CHECK([test "x$enable_sim_test" = xyes || exit 77])
cat $abs_srcdir/sim/sim_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/sim/sim_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([timer])
AT_KEYWORDS([timer])
cat $abs_srcdir/timer/timer_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/timer/timer_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([clk_override])
AT_KEYWORDS([clk_override])
cat $abs_srcdir/timer/clk_override_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/timer/clk_override_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([tlv])
AT_KEYWORDS([tlv])
cat $abs_srcdir/tlv/tlv_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/tlv/tlv_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsup])
AT_KEYWORDS([gsup])
cat $abs_srcdir/gsup/gsup_test.ok > expout
cat $abs_srcdir/gsup/gsup_test.err > experr
AT_CHECK([$abs_top_builddir/tests/gsup/gsup_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([fsm])
AT_KEYWORDS([fsm])
cat $abs_srcdir/fsm/fsm_test.ok > expout
cat $abs_srcdir/fsm/fsm_test.err > experr
AT_CHECK([$abs_top_builddir/tests/fsm/fsm_test], [0], [expout], [experr])
AT_CLEANUP
fsm: support graceful osmo_fsm_inst_term() cascades Add global flag osmo_fsm_term_safely() -- if set to true, enable the following behavior: Detect osmo_fsm_inst_term() occuring within osmo_fsm_inst_term(): - collect deallocations until the outermost osmo_fsm_inst_term() is done. - call osmo_fsm_inst_free() *after* dispatching the parent event. If a struct osmo_fsm_inst enters osmo_fsm_inst_term() while another is already within osmo_fsm_inst_term(), do not directly deallocate it, but talloc-reparent it to a separate talloc context, to be deallocated with the outermost FSM inst. The effect is that all osmo_fsm_inst freed within an osmo_fsm_inst_term() cascade will stay allocated until all osmo_fsm_inst_term() are complete and all of them will be deallocated at the same time. Mark the deferred deallocation state as __thread in an attempt to make cascaded deallocation handling threadsafe. Keep the enable/disable flag separate, so that it is global and not per-thread. The feature is showcased by fsm_dealloc_test.c: with this feature, all of those wild deallocation scenarios succeed. Make fsm_dealloc_test a normal regression test in testsuite.at. Rationale: It is difficult to gracefully handle deallocations of groups of FSM instances that reference each other. As soon as one child dispatching a cleanup event causes its parent to deallocate before fsm.c was ready for it, deallocation will hit a use-after-free. Before this patch, by using parent_term events and distinct "terminating" FSM states, parent/child FSMs can be taught to wait for all children to deallocate before deallocating the parent. But as soon as a non-child / non-parent FSM instance is involved, or actually any other cleanup() action that triggers parent FSMs or parent talloc contexts to become unused, it is near impossible to think of all possible deallocation events ricocheting, and to avoid running into freeing FSM instances that were still in the middle of osmo_fsm_inst_term(), or FSM instances to enter osmo_fsm_inst_term() more than once. This patch makes deallocation of "all possible" setups of complex cross referencing FSM instances easy to handle correctly, without running into use-after-free or double free situations, and, notably, without changing calling code. Change-Id: I8eda67540a1cd444491beb7856b9fcd0a3143b18
2019-03-24 04:56:21 +00:00
AT_SETUP([fsm_dealloc])
AT_KEYWORDS([fsm_dealloc])
cat $abs_srcdir/fsm/fsm_dealloc_test.err > experr
AT_CHECK([$abs_top_builddir/tests/fsm/fsm_dealloc_test], [0], [ignore], [experr])
AT_CLEANUP
AT_SETUP([oap])
AT_KEYWORDS([oap])
cat $abs_srcdir/oap/oap_test.ok > expout
touch experr
AT_CHECK([$abs_top_builddir/tests/oap/oap_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([oap_client])
AT_KEYWORDS([oap_client])
cat $abs_srcdir/oap/oap_client_test.ok > expout
cat $abs_srcdir/oap/oap_client_test.err > experr
AT_CHECK([$abs_top_builddir/tests/oap/oap_client_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([socket])
AT_KEYWORDS([socket])
cat $abs_srcdir/socket/socket_test.ok > expout
cat $abs_srcdir/socket/socket_test.err > experr
touch experr
AT_CHECK([$abs_top_builddir/tests/socket/socket_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([socket_sctp])
AT_KEYWORDS([socket_sctp])
AT_SKIP_IF([! test -e $abs_top_builddir/tests/socket/socket_sctp_test])
cat $abs_srcdir/socket/socket_sctp_test.ok > expout
cat $abs_srcdir/socket/socket_sctp_test.err > experr
touch experr
AT_CHECK([$abs_top_builddir/tests/socket/socket_sctp_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([osmo-auc-gen])
AT_KEYWORDS([osmo-auc-gen])
cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.ok > expout
cat $abs_srcdir/osmo-auc-gen/osmo-auc-gen_test.err > experr
AT_CHECK([$abs_top_srcdir/tests/osmo-auc-gen/osmo-auc-gen_test.sh $abs_top_builddir/utils/osmo-auc-gen], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([endian])
AT_KEYWORDS([endian])
cat $abs_srcdir/endian/endian_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/endian/endian_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([sercomm])
AT_KEYWORDS([sercomm])
cat $abs_srcdir/sercomm/sercomm_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/sercomm/sercomm_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([prbs])
AT_KEYWORDS([prbs])
cat $abs_srcdir/prbs/prbs_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/prbs/prbs_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gsm23003])
AT_KEYWORDS([gsm23003])
cat $abs_srcdir/gsm23003/gsm23003_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm23003/gsm23003_test], [0], [expout], [ignore])
AT_CLEANUP
add osmo_tdef API, originally adopted from osmo-bsc T_def Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more consistent. Upgrade to first class API: - add timer grouping - add generic vty support - add mising API doc - add C test - add VTY transcript tests, also as examples for using the API From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API. The root reason for moving to libosmocore is that I want to use the mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible place for this. osmo_tdef provides: - a list of Tnnnn (GSM) timers with description, unit and default value. - vty UI to allow users to configure non-default timeouts. - API to tie T timers to osmo_fsm states and set them on state transitions. - a few standard units (minute, second, millisecond) as well as a custom unit (which relies on the timer's human readable description to indicate the meaning of the value). - conversion for standard units: for example, some GSM timers are defined in minutes, while our FSM definitions need timeouts in seconds. Conversion is for convenience only and can be easily avoided via the custom unit. By keeping separate osmo_tdef arrays, several groups of timers can be kept separately. The VTY tests in tests/tdef/ showcase different schemes: - tests/vty/tdef_vty_test_config_root.c: Keep several timer definitions in separately named groups: showcase the osmo_tdef_vty_groups*() API. Each timer group exists exactly once. - tests/vty/tdef_vty_test_config_subnode.c: Keep a single list of timers without separate grouping. Put this list on a specific subnode below the CONFIG_NODE. There could be several separate subnodes with timers like this, i.e. continuing from this example, sets timers could be separated by placing timers in specific config subnodes instead of using the global group name. - tests/vty/tdef_vty_test_dynamic.c: Dynamically allocate timer definitions per each new created object. Thus there can be an arbitrary number of independent timer definitions, one per allocated object. T_def was introduced during the recent osmo-bsc refactoring for inter-BSC handover, and has proven useful: - without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be programmed with the right timeout value, for all code paths that invoke this state change. It is a likely source of errors to get one of them wrong. By defining a T timer exactly for an FSM state, the caller can merely invoke the state change and trust on the original state definition to apply the correct timeout. - it is helpful to have a standardized config file UI to provide user configurable timeouts, instead of inventing new VTY commands for each separate application of T timer numbers. Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5
2019-01-26 19:36:12 +00:00
AT_SETUP([gsm23236])
AT_KEYWORDS([gsm23236])
cat $abs_srcdir/gsm23236/gsm23236_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm23236/gsm23236_test], [0], [expout], [ignore])
AT_CLEANUP
add osmo_tdef API, originally adopted from osmo-bsc T_def Move T_def from osmo-bsc to libosmocore as osmo_tdef. Adjust naming to be more consistent. Upgrade to first class API: - add timer grouping - add generic vty support - add mising API doc - add C test - add VTY transcript tests, also as examples for using the API From osmo_fsm_inst_state_chg() API doc, cross reference to osmo_tdef API. The root reason for moving to libosmocore is that I want to use the mgw_endpoint_fsm in osmo-msc for inter-MSC handover, and hence want to move the FSM to libosmo-mgcp-client. This FSM uses the T_def from osmo-bsc. Though the mgw_endpoint_fsm's use of T_def is minimal, I intend to use the osmo_tdef API in osmo-msc (and probably elsewhere) as well. libosmocore is the most sensible place for this. osmo_tdef provides: - a list of Tnnnn (GSM) timers with description, unit and default value. - vty UI to allow users to configure non-default timeouts. - API to tie T timers to osmo_fsm states and set them on state transitions. - a few standard units (minute, second, millisecond) as well as a custom unit (which relies on the timer's human readable description to indicate the meaning of the value). - conversion for standard units: for example, some GSM timers are defined in minutes, while our FSM definitions need timeouts in seconds. Conversion is for convenience only and can be easily avoided via the custom unit. By keeping separate osmo_tdef arrays, several groups of timers can be kept separately. The VTY tests in tests/tdef/ showcase different schemes: - tests/vty/tdef_vty_test_config_root.c: Keep several timer definitions in separately named groups: showcase the osmo_tdef_vty_groups*() API. Each timer group exists exactly once. - tests/vty/tdef_vty_test_config_subnode.c: Keep a single list of timers without separate grouping. Put this list on a specific subnode below the CONFIG_NODE. There could be several separate subnodes with timers like this, i.e. continuing from this example, sets timers could be separated by placing timers in specific config subnodes instead of using the global group name. - tests/vty/tdef_vty_test_dynamic.c: Dynamically allocate timer definitions per each new created object. Thus there can be an arbitrary number of independent timer definitions, one per allocated object. T_def was introduced during the recent osmo-bsc refactoring for inter-BSC handover, and has proven useful: - without osmo_tdef, each invocation of osmo_fsm_inst_state_chg() needs to be programmed with the right timeout value, for all code paths that invoke this state change. It is a likely source of errors to get one of them wrong. By defining a T timer exactly for an FSM state, the caller can merely invoke the state change and trust on the original state definition to apply the correct timeout. - it is helpful to have a standardized config file UI to provide user configurable timeouts, instead of inventing new VTY commands for each separate application of T timer numbers. Change-Id: Ibd6b1ed7f1bd6e1f2e0fde53352055a4468f23e5
2019-01-26 19:36:12 +00:00
AT_SETUP([tdef])
AT_KEYWORDS([tdef])
cat $abs_srcdir/tdef/tdef_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/tdef/tdef_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([sockaddr_str])
AT_KEYWORDS([sockaddr_str])
cat $abs_srcdir/sockaddr_str/sockaddr_str_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/sockaddr_str/sockaddr_str_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([use_count])
AT_KEYWORDS([use_count])
cat $abs_srcdir/use_count/use_count_test.ok > expout
cat $abs_srcdir/use_count/use_count_test.err > experr
AT_CHECK([$abs_top_builddir/tests/use_count/use_count_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([context])
AT_KEYWORDS([context])
cat $abs_srcdir/context/context_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/context/context_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([exec])
AT_KEYWORDS([exec])
cat $abs_srcdir/exec/exec_test.ok > expout
cat $abs_srcdir/exec/exec_test.err > experr
AT_CHECK([$abs_top_builddir/tests/exec/exec_test], [0], [expout], [experr])
AT_CLEANUP
AT_SETUP([i460_mux])
AT_KEYWORDS([i460_mux])
cat $abs_srcdir/i460_mux/i460_mux_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/i460_mux/i460_mux_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([bitgen])
AT_KEYWORDS([bitgen])
cat $abs_srcdir/bitgen/bitgen_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bitgen/bitgen_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([gad])
AT_KEYWORDS([gad])
cat $abs_srcdir/gad/gad_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gad/gad_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([bsslap])
AT_KEYWORDS([bsslap])
cat $abs_srcdir/bsslap/bsslap_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bsslap/bsslap_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([bssmap_le])
AT_KEYWORDS([bssmap_le])
cat $abs_srcdir/bssmap_le/bssmap_le_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/bssmap_le/bssmap_le_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([it_q])
AT_KEYWORDS([it_q])
cat $abs_srcdir/it_q/it_q_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/it_q/it_q_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([base64])
AT_KEYWORDS([base64])
cat $abs_srcdir/base64/base64_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/base64/base64_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([time_cc])
AT_KEYWORDS([time_cc])
cat $abs_srcdir/time_cc/time_cc_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/time_cc/time_cc_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([iuup])
AT_KEYWORDS([iuup])
cat $abs_srcdir/iuup/iuup_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/iuup/iuup_test], [0], [expout], [ignore])
AT_CLEANUP
AT_SETUP([v110_test_frame])
AT_KEYWORDS([v110_test_frame])
cat $abs_srcdir/v110/test_frame.ok > expout
AT_CHECK([$abs_top_builddir/tests/v110/test_frame], [], [expout],[])
AT_CLEANUP
AT_SETUP([v110_test_ra1])
AT_KEYWORDS([v110_test_ra1])
cat $abs_srcdir/v110/test_ra1.ok > expout
AT_CHECK([$abs_top_builddir/tests/v110/test_ra1], [], [expout],[])
AT_CLEANUP
AT_SETUP([gsm44021_test_frame_csd])
AT_KEYWORDS([gsm44021_test_frame_csd])
cat $abs_srcdir/gsm44021/test_frame_csd.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm44021/test_frame_csd], [], [expout],[])
AT_CLEANUP