From 7b740f72c3f63ca4fdaf9219bfe413a26e67bc71 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 6 Feb 2019 01:08:43 +0100 Subject: platform independence fix: tdef range tests Run INT_MAX and ULONG_MAX related tests only manually, remove from automatic testing. This will hopefully fix recent build failures on various platforms. Add a 64 bit output example for expected results when invoking `./tdef_test range'. This is not checked automatically and merely serves for manual reference. For vty tests, use 32bit max values instead of INT_MAX and ULONG_MAX. Change-Id: I6242243bde1d7ddebb858512a1f0b07f4ec3e5c2 --- tests/Makefile.am | 1 + tests/tdef/tdef_test.c | 144 ++++++----- tests/tdef/tdef_test.ok | 41 +-- tests/tdef/tdef_test_range_64bit.ok | 375 ++++++++++++++++++++++++++++ tests/tdef/tdef_vty_test_config_root.c | 4 +- tests/tdef/tdef_vty_test_config_root.vty | 32 +-- tests/tdef/tdef_vty_test_config_subnode.c | 4 +- tests/tdef/tdef_vty_test_config_subnode.vty | 22 +- 8 files changed, 490 insertions(+), 133 deletions(-) create mode 100644 tests/tdef/tdef_test_range_64bit.ok (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 54fb11f0..63f3959d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -300,6 +300,7 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \ oap/oap_client_test.ok oap/oap_client_test.err \ vty/vty_transcript_test.vty \ tdef/tdef_test.ok \ + tdef/tdef_test_range_64bit.ok \ tdef/tdef_vty_test_config_root.vty \ tdef/tdef_vty_test_config_subnode.vty \ tdef/tdef_vty_test_dynamic.vty \ diff --git a/tests/tdef/tdef_test.c b/tests/tdef/tdef_test.c index 682c7ac7..f5b6413c 100644 --- a/tests/tdef/tdef_test.c +++ b/tests/tdef/tdef_test.c @@ -49,21 +49,12 @@ static struct osmo_tdef tdefs[] = { /* test conversions */ { .T=1000, .default_val=2*1000, .unit=OSMO_TDEF_MS, .desc="two seconds from ms" }, { .T=1001, .default_val=60*1000, .unit=OSMO_TDEF_MS, .desc="one minute from ms" }, - { .T=1002, .default_val=(ULONG_MAX/60), .unit=OSMO_TDEF_M, .desc="almost too many seconds" }, - { .T=1003, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="too many seconds" }, { .T=1004, .default_val=1, .unit=OSMO_TDEF_MS, .desc="one ms" }, { .T=1005, .default_val=0, .unit=OSMO_TDEF_MS, .desc="zero ms" }, { .T=1006, .default_val=0, .unit=OSMO_TDEF_S, .desc="zero s" }, { .T=1007, .default_val=0, .unit=OSMO_TDEF_M, .desc="zero m" }, { .T=1008, .default_val=0, .unit=OSMO_TDEF_CUSTOM, .desc="zero" }, - /* test range */ - { .T=INT_MAX, .default_val=ULONG_MAX, .unit=OSMO_TDEF_S, .desc="very large" }, - { .T=INT_MAX-1, .default_val=ULONG_MAX-1, .unit=OSMO_TDEF_S, .desc="very large" }, - { .T=INT_MAX-2, .default_val=LONG_MAX, .unit=OSMO_TDEF_S, .desc="very large" }, - { .T=INT_MAX-3, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="very large in minutes" }, - { .T=INT_MIN, .default_val=ULONG_MAX, .unit=OSMO_TDEF_S, .desc="negative" }, - { .T=0, .default_val=1, .unit=OSMO_TDEF_CUSTOM, .desc="zero" }, /* no desc */ @@ -72,13 +63,26 @@ static struct osmo_tdef tdefs[] = { {} // <-- important! last entry shall be zero }; -#define print_tdef_get(T, AS_UNIT) do { \ - unsigned long val = osmo_tdef_get(tdefs, T, AS_UNIT, 999); \ +static struct osmo_tdef tdefs_range[] = { + { .T=1002, .default_val=(ULONG_MAX/60), .unit=OSMO_TDEF_M, .desc="almost too many seconds" }, + { .T=1003, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="too many seconds" }, + + { .T=INT_MAX, .default_val=ULONG_MAX, .unit=OSMO_TDEF_S, .desc="very large" }, + { .T=INT_MAX-1, .default_val=ULONG_MAX-1, .unit=OSMO_TDEF_S, .desc="very large" }, + { .T=INT_MAX-2, .default_val=LONG_MAX, .unit=OSMO_TDEF_S, .desc="very large" }, + { .T=INT_MAX-3, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="very large in minutes" }, + { .T=INT_MIN, .default_val=ULONG_MAX, .unit=OSMO_TDEF_S, .desc="negative" }, + + {} +}; + +#define print_tdef_get(TDEFS, T, AS_UNIT) do { \ + unsigned long val = osmo_tdef_get(TDEFS, T, AS_UNIT, 999); \ printf("osmo_tdef_get(tdefs, %d, %s, 999)\t= %lu\n", T, osmo_tdef_unit_name(AS_UNIT), val); \ } while (0) -#define print_tdef_get_short(T, AS_UNIT) do { \ - unsigned long val = osmo_tdef_get(tdefs, T, AS_UNIT, 999); \ +#define print_tdef_get_short(TDEFS, T, AS_UNIT) do { \ + unsigned long val = osmo_tdef_get(TDEFS, T, AS_UNIT, 999); \ printf("osmo_tdef_get(%d, %s)\t= %lu\n", T, osmo_tdef_unit_name(AS_UNIT), val); \ } while (0) @@ -95,7 +99,7 @@ void print_tdef_info(unsigned int T) printf("\n"); } -static void test_tdef_get() +static void test_tdef_get(bool test_range) { int i; enum osmo_tdef_unit as_unit; @@ -108,7 +112,18 @@ static void test_tdef_get() unsigned int T = tdefs[i].T; print_tdef_info(T); for (as_unit = OSMO_TDEF_S; as_unit <= OSMO_TDEF_CUSTOM; as_unit++) { - print_tdef_get_short(T, as_unit); + print_tdef_get_short(tdefs, T, as_unit); + } + } + + if (!test_range) + return; + + for (i = 0; i < ARRAY_SIZE(tdefs_range)-1; i++) { + unsigned int T = tdefs_range[i].T; + print_tdef_info(T); + for (as_unit = OSMO_TDEF_S; as_unit <= OSMO_TDEF_CUSTOM; as_unit++) { + print_tdef_get_short(tdefs_range, T, as_unit); } } } @@ -117,10 +132,10 @@ static void test_tdef_get_nonexisting() { printf("\n%s()\n", __func__); - print_tdef_get(5, OSMO_TDEF_S); - print_tdef_get(5, OSMO_TDEF_MS); - print_tdef_get(5, OSMO_TDEF_M); - print_tdef_get(5, OSMO_TDEF_CUSTOM); + print_tdef_get(tdefs, 5, OSMO_TDEF_S); + print_tdef_get(tdefs, 5, OSMO_TDEF_MS); + print_tdef_get(tdefs, 5, OSMO_TDEF_M); + print_tdef_get(tdefs, 5, OSMO_TDEF_CUSTOM); } static void test_tdef_set_and_get() @@ -132,23 +147,23 @@ static void test_tdef_set_and_get() printf("setting 7 = 42\n"); t->val = 42; print_tdef_info(7); - print_tdef_get_short(7, OSMO_TDEF_MS); - print_tdef_get_short(7, OSMO_TDEF_S); - print_tdef_get_short(7, OSMO_TDEF_M); - print_tdef_get_short(7, OSMO_TDEF_CUSTOM); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_MS); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_S); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_M); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_CUSTOM); printf("setting 7 = 420\n"); t->val = 420; print_tdef_info(7); - print_tdef_get_short(7, OSMO_TDEF_MS); - print_tdef_get_short(7, OSMO_TDEF_S); - print_tdef_get_short(7, OSMO_TDEF_M); - print_tdef_get_short(7, OSMO_TDEF_CUSTOM); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_MS); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_S); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_M); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_CUSTOM); printf("resetting\n"); osmo_tdefs_reset(tdefs); print_tdef_info(7); - print_tdef_get_short(7, OSMO_TDEF_S); + print_tdef_get_short(tdefs, 7, OSMO_TDEF_S); } enum test_tdef_fsm_states { @@ -306,7 +321,7 @@ static void print_fsm_state(struct osmo_fsm_inst *fi) } -#define test_tdef_fsm_state_chg(NEXT_STATE) do { \ +#define test_tdef_fsm_state_chg(tdefs, NEXT_STATE) do { \ const struct osmo_tdef_state_timeout *st = osmo_tdef_get_state_timeout(NEXT_STATE, \ test_tdef_state_timeouts); \ if (!st) { \ @@ -318,7 +333,7 @@ static void print_fsm_state(struct osmo_fsm_inst *fi) printf(" --> %s (configured as T%d%s %lu %s) rc=%d;\t", osmo_fsm_state_name(&test_tdef_fsm, \ NEXT_STATE), \ st->T, st->keep_timer ? "(keep_timer)" : "", \ - t? t->val : -1, t? osmo_tdef_unit_name(t->unit) : "-", \ + t? t->val : 0, t? osmo_tdef_unit_name(t->unit) : "-", \ rc); \ print_fsm_state(fi); \ } \ @@ -329,7 +344,6 @@ static void print_fsm_state(struct osmo_fsm_inst *fi) static void test_tdef_state_timeout(bool test_range) { struct osmo_fsm_inst *fi; - struct osmo_tdef *m = osmo_tdef_get_entry(tdefs, INT_MAX); unsigned long m_secs; printf("\n%s()\n", __func__); @@ -341,51 +355,57 @@ static void test_tdef_state_timeout(bool test_range) OSMO_ASSERT(fi); print_fsm_state(fi); - test_tdef_fsm_state_chg(S_A); - test_tdef_fsm_state_chg(S_B); - test_tdef_fsm_state_chg(S_C); - test_tdef_fsm_state_chg(S_D); + test_tdef_fsm_state_chg(tdefs, S_A); + test_tdef_fsm_state_chg(tdefs, S_B); + test_tdef_fsm_state_chg(tdefs, S_C); + test_tdef_fsm_state_chg(tdefs, S_D); - test_tdef_fsm_state_chg(S_G); - test_tdef_fsm_state_chg(S_H); - test_tdef_fsm_state_chg(S_I); - test_tdef_fsm_state_chg(S_J); + test_tdef_fsm_state_chg(tdefs, S_G); + test_tdef_fsm_state_chg(tdefs, S_H); + test_tdef_fsm_state_chg(tdefs, S_I); + test_tdef_fsm_state_chg(tdefs, S_J); printf("- test keep_timer:\n"); fake_time_passes(123, 45678); print_fsm_state(fi); - test_tdef_fsm_state_chg(S_K); - test_tdef_fsm_state_chg(S_A); + test_tdef_fsm_state_chg(tdefs, S_K); + test_tdef_fsm_state_chg(tdefs, S_A); fake_time_passes(23, 45678); print_fsm_state(fi); - test_tdef_fsm_state_chg(S_K); + test_tdef_fsm_state_chg(tdefs, S_K); - test_tdef_fsm_state_chg(S_A); + test_tdef_fsm_state_chg(tdefs, S_A); fake_time_passes(23, 45678); print_fsm_state(fi); - test_tdef_fsm_state_chg(S_L); - - printf("- test large T:\n"); - test_tdef_fsm_state_chg(S_M); - - printf("- test T<0:\n"); - test_tdef_fsm_state_chg(S_N); + test_tdef_fsm_state_chg(tdefs, S_L); printf("- test T=0:\n"); - test_tdef_fsm_state_chg(S_O); + test_tdef_fsm_state_chg(tdefs, S_O); printf("- test no timer:\n"); - test_tdef_fsm_state_chg(S_X); + test_tdef_fsm_state_chg(tdefs, S_X); printf("- test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999:\n"); - test_tdef_fsm_state_chg(S_Y); + test_tdef_fsm_state_chg(tdefs, S_Y); /* the range of unsigned long is architecture dependent. This test can be invoked manually to see whether * clamping the timeout values works, but the output will be of varying lengths depending on the system's * unsigned long range, and would cause differences in expected output. */ if (test_range) { + struct osmo_tdef *m; + + printf("- test large T:\n"); + test_tdef_fsm_state_chg(tdefs_range, S_M); + + printf("- test T<0:\n"); + test_tdef_fsm_state_chg(tdefs_range, S_N); + printf("- test range:\n"); - test_tdef_fsm_state_chg(S_M); + test_tdef_fsm_state_chg(tdefs_range, S_M); + + m = osmo_tdef_get_entry(tdefs_range, INT_MAX); + OSMO_ASSERT(m); + /* sweep through all the bits, shifting in 0xfffff.. from the right. */ m_secs = 0; do { @@ -408,19 +428,19 @@ static void test_tdef_state_timeout(bool test_range) } m->val = m_secs - 1; - test_tdef_fsm_state_chg(S_M); + test_tdef_fsm_state_chg(tdefs_range, S_M); m->val = m_secs; - test_tdef_fsm_state_chg(S_M); + test_tdef_fsm_state_chg(tdefs_range, S_M); m->val = m_secs + 1; - test_tdef_fsm_state_chg(S_M); + test_tdef_fsm_state_chg(tdefs_range, S_M); } while (m_secs < ULONG_MAX); } printf("- test disallowed transition:\n"); - test_tdef_fsm_state_chg(S_Z); - test_tdef_fsm_state_chg(S_B); - test_tdef_fsm_state_chg(S_C); - test_tdef_fsm_state_chg(S_D); + test_tdef_fsm_state_chg(tdefs, S_Z); + test_tdef_fsm_state_chg(tdefs, S_B); + test_tdef_fsm_state_chg(tdefs, S_C); + test_tdef_fsm_state_chg(tdefs, S_D); } int main(int argc, char **argv) @@ -434,7 +454,7 @@ int main(int argc, char **argv) osmo_fsm_register(&test_tdef_fsm); - test_tdef_get(); + test_tdef_get(argc > 1); test_tdef_get_nonexisting(); test_tdef_set_and_get(); /* Run range test iff any argument is passed on the cmdline. For the rationale, see the comment in diff --git a/tests/tdef/tdef_test.ok b/tests/tdef/tdef_test.ok index cf4b77f5..6e6ba004 100644 --- a/tests/tdef/tdef_test.ok +++ b/tests/tdef/tdef_test.ok @@ -50,16 +50,6 @@ osmo_tdef_get(1001, s) = 60 osmo_tdef_get(1001, ms) = 60000 osmo_tdef_get(1001, m) = 1 osmo_tdef_get(1001, custom-unit) = 60000 -T1002=307445734561825860m -osmo_tdef_get(1002, s) = 18446744073709551600 -osmo_tdef_get(1002, ms) = 18446744073709551615 -osmo_tdef_get(1002, m) = 307445734561825860 -osmo_tdef_get(1002, custom-unit) = 307445734561825860 -T1003=18446744073709551615m -osmo_tdef_get(1003, s) = 18446744073709551615 -osmo_tdef_get(1003, ms) = 18446744073709551615 -osmo_tdef_get(1003, m) = 18446744073709551615 -osmo_tdef_get(1003, custom-unit) = 18446744073709551615 T1004=1ms osmo_tdef_get(1004, s) = 1 osmo_tdef_get(1004, ms) = 1 @@ -85,31 +75,6 @@ osmo_tdef_get(1008, s) = 0 osmo_tdef_get(1008, ms) = 0 osmo_tdef_get(1008, m) = 0 osmo_tdef_get(1008, custom-unit) = 0 -T2147483647=18446744073709551615s -osmo_tdef_get(2147483647, s) = 18446744073709551615 -osmo_tdef_get(2147483647, ms) = 18446744073709551615 -osmo_tdef_get(2147483647, m) = 307445734561825861 -osmo_tdef_get(2147483647, custom-unit) = 18446744073709551615 -T2147483646=18446744073709551614s -osmo_tdef_get(2147483646, s) = 18446744073709551614 -osmo_tdef_get(2147483646, ms) = 18446744073709551615 -osmo_tdef_get(2147483646, m) = 307445734561825861 -osmo_tdef_get(2147483646, custom-unit) = 18446744073709551614 -T2147483645=9223372036854775807s -osmo_tdef_get(2147483645, s) = 9223372036854775807 -osmo_tdef_get(2147483645, ms) = 18446744073709551615 -osmo_tdef_get(2147483645, m) = 153722867280912931 -osmo_tdef_get(2147483645, custom-unit) = 9223372036854775807 -T2147483644=18446744073709551615m -osmo_tdef_get(2147483644, s) = 18446744073709551615 -osmo_tdef_get(2147483644, ms) = 18446744073709551615 -osmo_tdef_get(2147483644, m) = 18446744073709551615 -osmo_tdef_get(2147483644, custom-unit) = 18446744073709551615 -T-2147483648=18446744073709551615s -osmo_tdef_get(-2147483648, s) = 18446744073709551615 -osmo_tdef_get(-2147483648, ms) = 18446744073709551615 -osmo_tdef_get(-2147483648, m) = 307445734561825861 -osmo_tdef_get(-2147483648, custom-unit) = 18446744073709551615 T0=1custom-unit osmo_tdef_get(0, s) = 1 osmo_tdef_get(0, ms) = 1 @@ -167,16 +132,12 @@ state=A T=1, 76.954322 s remaining Total time passed: 169.137034 s state=A T=1, 76.954322 s remaining --> L (configured as T123(keep_timer) 1 s) rc=0; state=L T=123, 76.954322 s remaining -- test large T: - --> M (configured as T2147483647 18446744073709551615 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining -- test T<0: - --> N (configured as T-2147483648 18446744073709551615 s) rc=0; state=N T=-2147483648, 2147483647.000000 s remaining - test T=0: --> O (no timer configured for this state) - test no timer: --> X (no timer configured for this state) - test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999: - --> Y (configured as T666 18446744073709551615 -) rc=0; state=Y T=666, 999.000000 s remaining + --> Y (configured as T666 0 -) rc=0; state=Y T=666, 999.000000 s remaining - test disallowed transition: --> Z (no timer configured for this state) --> B (configured as T2 100 ms) rc=0; state=B T=2, 1.000000 s remaining diff --git a/tests/tdef/tdef_test_range_64bit.ok b/tests/tdef/tdef_test_range_64bit.ok new file mode 100644 index 00000000..bd104b66 --- /dev/null +++ b/tests/tdef/tdef_test_range_64bit.ok @@ -0,0 +1,375 @@ + +test_tdef_get() +T1=100s +osmo_tdef_get(1, s) = 100 +osmo_tdef_get(1, ms) = 100000 +osmo_tdef_get(1, m) = 2 +osmo_tdef_get(1, custom-unit) = 100 +T2=100ms +osmo_tdef_get(2, s) = 1 +osmo_tdef_get(2, ms) = 100 +osmo_tdef_get(2, m) = 1 +osmo_tdef_get(2, custom-unit) = 100 +T3=100m +osmo_tdef_get(3, s) = 6000 +osmo_tdef_get(3, ms) = 6000000 +osmo_tdef_get(3, m) = 100 +osmo_tdef_get(3, custom-unit) = 100 +T4=100custom-unit +osmo_tdef_get(4, s) = 100 +osmo_tdef_get(4, ms) = 100 +osmo_tdef_get(4, m) = 100 +osmo_tdef_get(4, custom-unit) = 100 +T7=50s +osmo_tdef_get(7, s) = 50 +osmo_tdef_get(7, ms) = 50000 +osmo_tdef_get(7, m) = 1 +osmo_tdef_get(7, custom-unit) = 50 +T8=300s +osmo_tdef_get(8, s) = 300 +osmo_tdef_get(8, ms) = 300000 +osmo_tdef_get(8, m) = 5 +osmo_tdef_get(8, custom-unit) = 300 +T9=5m +osmo_tdef_get(9, s) = 300 +osmo_tdef_get(9, ms) = 300000 +osmo_tdef_get(9, m) = 5 +osmo_tdef_get(9, custom-unit) = 5 +T10=20m +osmo_tdef_get(10, s) = 1200 +osmo_tdef_get(10, ms) = 1200000 +osmo_tdef_get(10, m) = 20 +osmo_tdef_get(10, custom-unit) = 20 +T1000=2000ms +osmo_tdef_get(1000, s) = 2 +osmo_tdef_get(1000, ms) = 2000 +osmo_tdef_get(1000, m) = 1 +osmo_tdef_get(1000, custom-unit) = 2000 +T1001=60000ms +osmo_tdef_get(1001, s) = 60 +osmo_tdef_get(1001, ms) = 60000 +osmo_tdef_get(1001, m) = 1 +osmo_tdef_get(1001, custom-unit) = 60000 +T1004=1ms +osmo_tdef_get(1004, s) = 1 +osmo_tdef_get(1004, ms) = 1 +osmo_tdef_get(1004, m) = 1 +osmo_tdef_get(1004, custom-unit) = 1 +T1005=0ms +osmo_tdef_get(1005, s) = 0 +osmo_tdef_get(1005, ms) = 0 +osmo_tdef_get(1005, m) = 0 +osmo_tdef_get(1005, custom-unit) = 0 +T1006=0s +osmo_tdef_get(1006, s) = 0 +osmo_tdef_get(1006, ms) = 0 +osmo_tdef_get(1006, m) = 0 +osmo_tdef_get(1006, custom-unit) = 0 +T1007=0m +osmo_tdef_get(1007, s) = 0 +osmo_tdef_get(1007, ms) = 0 +osmo_tdef_get(1007, m) = 0 +osmo_tdef_get(1007, custom-unit) = 0 +T1008=0custom-unit +osmo_tdef_get(1008, s) = 0 +osmo_tdef_get(1008, ms) = 0 +osmo_tdef_get(1008, m) = 0 +osmo_tdef_get(1008, custom-unit) = 0 +T0=1custom-unit +osmo_tdef_get(0, s) = 1 +osmo_tdef_get(0, ms) = 1 +osmo_tdef_get(0, m) = 1 +osmo_tdef_get(0, custom-unit) = 1 +T123=1s +osmo_tdef_get(123, s) = 1 +osmo_tdef_get(123, ms) = 1000 +osmo_tdef_get(123, m) = 1 +osmo_tdef_get(123, custom-unit) = 1 +T1002=NULLosmo_tdef_get(1002, s) = 0 +osmo_tdef_get(1002, ms) = 0 +osmo_tdef_get(1002, m) = 0 +osmo_tdef_get(1002, custom-unit) = 0 +T1003=NULLosmo_tdef_get(1003, s) = 0 +osmo_tdef_get(1003, ms) = 0 +osmo_tdef_get(1003, m) = 0 +osmo_tdef_get(1003, custom-unit) = 0 +T2147483647=NULLosmo_tdef_get(2147483647, s) = 0 +osmo_tdef_get(2147483647, ms) = 0 +osmo_tdef_get(2147483647, m) = 0 +osmo_tdef_get(2147483647, custom-unit) = 0 +T2147483646=NULLosmo_tdef_get(2147483646, s) = 0 +osmo_tdef_get(2147483646, ms) = 0 +osmo_tdef_get(2147483646, m) = 0 +osmo_tdef_get(2147483646, custom-unit) = 0 +T2147483645=NULLosmo_tdef_get(2147483645, s) = 0 +osmo_tdef_get(2147483645, ms) = 0 +osmo_tdef_get(2147483645, m) = 0 +osmo_tdef_get(2147483645, custom-unit) = 0 +T2147483644=NULLosmo_tdef_get(2147483644, s) = 0 +osmo_tdef_get(2147483644, ms) = 0 +osmo_tdef_get(2147483644, m) = 0 +osmo_tdef_get(2147483644, custom-unit) = 0 +T-2147483648=NULLosmo_tdef_get(-2147483648, s) = 0 +osmo_tdef_get(-2147483648, ms) = 0 +osmo_tdef_get(-2147483648, m) = 0 +osmo_tdef_get(-2147483648, custom-unit) = 0 + +test_tdef_get_nonexisting() +osmo_tdef_get(tdefs, 5, s, 999) = 999 +osmo_tdef_get(tdefs, 5, ms, 999) = 999 +osmo_tdef_get(tdefs, 5, m, 999) = 999 +osmo_tdef_get(tdefs, 5, custom-unit, 999) = 999 + +test_tdef_set_and_get() +setting 7 = 42 +T7=42s(def=50) +osmo_tdef_get(7, ms) = 42000 +osmo_tdef_get(7, s) = 42 +osmo_tdef_get(7, m) = 1 +osmo_tdef_get(7, custom-unit) = 42 +setting 7 = 420 +T7=420s(def=50) +osmo_tdef_get(7, ms) = 420000 +osmo_tdef_get(7, s) = 420 +osmo_tdef_get(7, m) = 7 +osmo_tdef_get(7, custom-unit) = 420 +resetting +T7=50s +osmo_tdef_get(7, s) = 50 + +test_tdef_state_timeout() +Total time passed: 0.000000 s +state=A T=0, no timeout + --> A (configured as T1 100 s) rc=0; state=A T=1, 100.000000 s remaining + --> B (configured as T2 100 ms) rc=0; state=B T=2, 1.000000 s remaining + --> C (configured as T3 100 m) rc=0; state=C T=3, 6000.000000 s remaining + --> D (configured as T4 100 custom-unit) rc=0; state=D T=4, 100.000000 s remaining + --> G (configured as T7 50 s) rc=0; state=G T=7, 50.000000 s remaining + --> H (configured as T8 300 s) rc=0; state=H T=8, 300.000000 s remaining + --> I (configured as T9 5 m) rc=0; state=I T=9, 300.000000 s remaining + --> J (configured as T10 20 m) rc=0; state=J T=10, 1200.000000 s remaining +- test keep_timer: +Total time passed: 123.045678 s +state=J T=10, 1076.954322 s remaining + --> K (configured as T0(keep_timer) 1 custom-unit) rc=0; state=K T=10, 1076.954322 s remaining + --> A (configured as T1 100 s) rc=0; state=A T=1, 100.000000 s remaining +Total time passed: 146.091356 s +state=A T=1, 76.954322 s remaining + --> K (configured as T0(keep_timer) 1 custom-unit) rc=0; state=K T=1, 76.954322 s remaining + --> A (configured as T1 100 s) rc=0; state=A T=1, 100.000000 s remaining +Total time passed: 169.137034 s +state=A T=1, 76.954322 s remaining + --> L (configured as T123(keep_timer) 1 s) rc=0; state=L T=123, 76.954322 s remaining +- test T=0: + --> O (no timer configured for this state) +- test no timer: + --> X (no timer configured for this state) +- test undefined timer, using default_val arg of osmo_tdef_fsm_inst_state_chg(), here passed as 999: + --> Y (configured as T666 18446744073709551615 -) rc=0; state=Y T=666, 999.000000 s remaining +- test large T: + --> M (configured as T2147483647 0 s) rc=0; state=M T=2147483647, no timeout +- test T<0: + --> N (configured as T-2147483648 0 s) rc=0; state=N T=-2147483648, no timeout +- test range: + --> M (configured as T2147483647 0 s) rc=0; state=M T=2147483647, no timeout + --> M (configured as T2147483647 0 s) rc=0; state=M T=2147483647, no timeout + --> M (configured as T2147483647 1 s) rc=0; state=M T=2147483647, 1.000000 s remaining + --> M (configured as T2147483647 2 s) rc=0; state=M T=2147483647, 2.000000 s remaining + --> M (configured as T2147483647 2 s) rc=0; state=M T=2147483647, 2.000000 s remaining + --> M (configured as T2147483647 3 s) rc=0; state=M T=2147483647, 3.000000 s remaining + --> M (configured as T2147483647 4 s) rc=0; state=M T=2147483647, 4.000000 s remaining + --> M (configured as T2147483647 6 s) rc=0; state=M T=2147483647, 6.000000 s remaining + --> M (configured as T2147483647 7 s) rc=0; state=M T=2147483647, 7.000000 s remaining + --> M (configured as T2147483647 8 s) rc=0; state=M T=2147483647, 8.000000 s remaining + --> M (configured as T2147483647 14 s) rc=0; state=M T=2147483647, 14.000000 s remaining + --> M (configured as T2147483647 15 s) rc=0; state=M T=2147483647, 15.000000 s remaining + --> M (configured as T2147483647 16 s) rc=0; state=M T=2147483647, 16.000000 s remaining + --> M (configured as T2147483647 30 s) rc=0; state=M T=2147483647, 30.000000 s remaining + --> M (configured as T2147483647 31 s) rc=0; state=M T=2147483647, 31.000000 s remaining + --> M (configured as T2147483647 32 s) rc=0; state=M T=2147483647, 32.000000 s remaining + --> M (configured as T2147483647 62 s) rc=0; state=M T=2147483647, 62.000000 s remaining + --> M (configured as T2147483647 63 s) rc=0; state=M T=2147483647, 63.000000 s remaining + --> M (configured as T2147483647 64 s) rc=0; state=M T=2147483647, 64.000000 s remaining + --> M (configured as T2147483647 126 s) rc=0; state=M T=2147483647, 126.000000 s remaining + --> M (configured as T2147483647 127 s) rc=0; state=M T=2147483647, 127.000000 s remaining + --> M (configured as T2147483647 128 s) rc=0; state=M T=2147483647, 128.000000 s remaining + --> M (configured as T2147483647 254 s) rc=0; state=M T=2147483647, 254.000000 s remaining + --> M (configured as T2147483647 255 s) rc=0; state=M T=2147483647, 255.000000 s remaining + --> M (configured as T2147483647 256 s) rc=0; state=M T=2147483647, 256.000000 s remaining + --> M (configured as T2147483647 510 s) rc=0; state=M T=2147483647, 510.000000 s remaining + --> M (configured as T2147483647 511 s) rc=0; state=M T=2147483647, 511.000000 s remaining + --> M (configured as T2147483647 512 s) rc=0; state=M T=2147483647, 512.000000 s remaining + --> M (configured as T2147483647 1022 s) rc=0; state=M T=2147483647, 1022.000000 s remaining + --> M (configured as T2147483647 1023 s) rc=0; state=M T=2147483647, 1023.000000 s remaining + --> M (configured as T2147483647 1024 s) rc=0; state=M T=2147483647, 1024.000000 s remaining + --> M (configured as T2147483647 2046 s) rc=0; state=M T=2147483647, 2046.000000 s remaining + --> M (configured as T2147483647 2047 s) rc=0; state=M T=2147483647, 2047.000000 s remaining + --> M (configured as T2147483647 2048 s) rc=0; state=M T=2147483647, 2048.000000 s remaining + --> M (configured as T2147483647 4094 s) rc=0; state=M T=2147483647, 4094.000000 s remaining + --> M (configured as T2147483647 4095 s) rc=0; state=M T=2147483647, 4095.000000 s remaining + --> M (configured as T2147483647 4096 s) rc=0; state=M T=2147483647, 4096.000000 s remaining + --> M (configured as T2147483647 8190 s) rc=0; state=M T=2147483647, 8190.000000 s remaining + --> M (configured as T2147483647 8191 s) rc=0; state=M T=2147483647, 8191.000000 s remaining + --> M (configured as T2147483647 8192 s) rc=0; state=M T=2147483647, 8192.000000 s remaining + --> M (configured as T2147483647 16382 s) rc=0; state=M T=2147483647, 16382.000000 s remaining + --> M (configured as T2147483647 16383 s) rc=0; state=M T=2147483647, 16383.000000 s remaining + --> M (configured as T2147483647 16384 s) rc=0; state=M T=2147483647, 16384.000000 s remaining +--- int32_t max --- + --> M (configured as T2147483647 32766 s) rc=0; state=M T=2147483647, 32766.000000 s remaining + --> M (configured as T2147483647 32767 s) rc=0; state=M T=2147483647, 32767.000000 s remaining + --> M (configured as T2147483647 32768 s) rc=0; state=M T=2147483647, 32768.000000 s remaining +--- uint32_t max --- + --> M (configured as T2147483647 65534 s) rc=0; state=M T=2147483647, 65534.000000 s remaining + --> M (configured as T2147483647 65535 s) rc=0; state=M T=2147483647, 65535.000000 s remaining + --> M (configured as T2147483647 65536 s) rc=0; state=M T=2147483647, 65536.000000 s remaining + --> M (configured as T2147483647 131070 s) rc=0; state=M T=2147483647, 131070.000000 s remaining + --> M (configured as T2147483647 131071 s) rc=0; state=M T=2147483647, 131071.000000 s remaining + --> M (configured as T2147483647 131072 s) rc=0; state=M T=2147483647, 131072.000000 s remaining + --> M (configured as T2147483647 262142 s) rc=0; state=M T=2147483647, 262142.000000 s remaining + --> M (configured as T2147483647 262143 s) rc=0; state=M T=2147483647, 262143.000000 s remaining + --> M (configured as T2147483647 262144 s) rc=0; state=M T=2147483647, 262144.000000 s remaining + --> M (configured as T2147483647 524286 s) rc=0; state=M T=2147483647, 524286.000000 s remaining + --> M (configured as T2147483647 524287 s) rc=0; state=M T=2147483647, 524287.000000 s remaining + --> M (configured as T2147483647 524288 s) rc=0; state=M T=2147483647, 524288.000000 s remaining + --> M (configured as T2147483647 1048574 s) rc=0; state=M T=2147483647, 1048574.000000 s remaining + --> M (configured as T2147483647 1048575 s) rc=0; state=M T=2147483647, 1048575.000000 s remaining + --> M (configured as T2147483647 1048576 s) rc=0; state=M T=2147483647, 1048576.000000 s remaining + --> M (configured as T2147483647 2097150 s) rc=0; state=M T=2147483647, 2097150.000000 s remaining + --> M (configured as T2147483647 2097151 s) rc=0; state=M T=2147483647, 2097151.000000 s remaining + --> M (configured as T2147483647 2097152 s) rc=0; state=M T=2147483647, 2097152.000000 s remaining + --> M (configured as T2147483647 4194302 s) rc=0; state=M T=2147483647, 4194302.000000 s remaining + --> M (configured as T2147483647 4194303 s) rc=0; state=M T=2147483647, 4194303.000000 s remaining + --> M (configured as T2147483647 4194304 s) rc=0; state=M T=2147483647, 4194304.000000 s remaining + --> M (configured as T2147483647 8388606 s) rc=0; state=M T=2147483647, 8388606.000000 s remaining + --> M (configured as T2147483647 8388607 s) rc=0; state=M T=2147483647, 8388607.000000 s remaining + --> M (configured as T2147483647 8388608 s) rc=0; state=M T=2147483647, 8388608.000000 s remaining + --> M (configured as T2147483647 16777214 s) rc=0; state=M T=2147483647, 16777214.000000 s remaining + --> M (configured as T2147483647 16777215 s) rc=0; state=M T=2147483647, 16777215.000000 s remaining + --> M (configured as T2147483647 16777216 s) rc=0; state=M T=2147483647, 16777216.000000 s remaining + --> M (configured as T2147483647 33554430 s) rc=0; state=M T=2147483647, 33554430.000000 s remaining + --> M (configured as T2147483647 33554431 s) rc=0; state=M T=2147483647, 33554431.000000 s remaining + --> M (configured as T2147483647 33554432 s) rc=0; state=M T=2147483647, 33554432.000000 s remaining + --> M (configured as T2147483647 67108862 s) rc=0; state=M T=2147483647, 67108862.000000 s remaining + --> M (configured as T2147483647 67108863 s) rc=0; state=M T=2147483647, 67108863.000000 s remaining + --> M (configured as T2147483647 67108864 s) rc=0; state=M T=2147483647, 67108864.000000 s remaining + --> M (configured as T2147483647 134217726 s) rc=0; state=M T=2147483647, 134217726.000000 s remaining + --> M (configured as T2147483647 134217727 s) rc=0; state=M T=2147483647, 134217727.000000 s remaining + --> M (configured as T2147483647 134217728 s) rc=0; state=M T=2147483647, 134217728.000000 s remaining + --> M (configured as T2147483647 268435454 s) rc=0; state=M T=2147483647, 268435454.000000 s remaining + --> M (configured as T2147483647 268435455 s) rc=0; state=M T=2147483647, 268435455.000000 s remaining + --> M (configured as T2147483647 268435456 s) rc=0; state=M T=2147483647, 268435456.000000 s remaining + --> M (configured as T2147483647 536870910 s) rc=0; state=M T=2147483647, 536870910.000000 s remaining + --> M (configured as T2147483647 536870911 s) rc=0; state=M T=2147483647, 536870911.000000 s remaining + --> M (configured as T2147483647 536870912 s) rc=0; state=M T=2147483647, 536870912.000000 s remaining + --> M (configured as T2147483647 1073741822 s) rc=0; state=M T=2147483647, 1073741822.000000 s remaining + --> M (configured as T2147483647 1073741823 s) rc=0; state=M T=2147483647, 1073741823.000000 s remaining + --> M (configured as T2147483647 1073741824 s) rc=0; state=M T=2147483647, 1073741824.000000 s remaining +--- int64_t max --- + --> M (configured as T2147483647 2147483646 s) rc=0; state=M T=2147483647, 2147483646.000000 s remaining + --> M (configured as T2147483647 2147483647 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2147483648 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining +--- uint64_t max --- + --> M (configured as T2147483647 4294967294 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4294967295 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4294967296 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8589934590 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8589934591 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8589934592 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17179869182 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17179869183 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17179869184 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 34359738366 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 34359738367 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 34359738368 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 68719476734 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 68719476735 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 68719476736 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 137438953470 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 137438953471 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 137438953472 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 274877906942 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 274877906943 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 274877906944 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 549755813886 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 549755813887 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 549755813888 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1099511627774 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1099511627775 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1099511627776 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2199023255550 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2199023255551 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2199023255552 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4398046511102 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4398046511103 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4398046511104 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8796093022206 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8796093022207 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 8796093022208 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17592186044414 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17592186044415 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 17592186044416 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 35184372088830 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 35184372088831 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 35184372088832 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 70368744177662 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 70368744177663 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 70368744177664 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 140737488355326 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 140737488355327 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 140737488355328 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 281474976710654 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 281474976710655 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 281474976710656 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 562949953421310 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 562949953421311 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 562949953421312 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1125899906842622 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1125899906842623 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1125899906842624 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2251799813685246 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2251799813685247 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2251799813685248 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4503599627370494 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4503599627370495 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4503599627370496 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9007199254740990 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9007199254740991 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9007199254740992 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 18014398509481982 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 18014398509481983 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 18014398509481984 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 36028797018963966 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 36028797018963967 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 36028797018963968 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 72057594037927934 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 72057594037927935 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 72057594037927936 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 144115188075855870 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 144115188075855871 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 144115188075855872 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 288230376151711742 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 288230376151711743 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 288230376151711744 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 576460752303423486 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 576460752303423487 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 576460752303423488 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1152921504606846974 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1152921504606846975 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 1152921504606846976 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2305843009213693950 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2305843009213693951 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 2305843009213693952 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4611686018427387902 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4611686018427387903 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 4611686018427387904 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9223372036854775806 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9223372036854775807 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 9223372036854775808 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 18446744073709551614 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 18446744073709551615 s) rc=0; state=M T=2147483647, 2147483647.000000 s remaining + --> M (configured as T2147483647 0 s) rc=0; state=M T=2147483647, no timeout +- test disallowed transition: + --> Z (no timer configured for this state) + --> B (configured as T2 100 ms) rc=0; state=B T=2, 1.000000 s remaining + --> C (configured as T3 100 m) rc=0; state=C T=3, 6000.000000 s remaining + --> D (configured as T4 100 custom-unit) rc=0; state=D T=4, 100.000000 s remaining diff --git a/tests/tdef/tdef_vty_test_config_root.c b/tests/tdef/tdef_vty_test_config_root.c index 138ac00a..d69e0285 100644 --- a/tests/tdef/tdef_vty_test_config_root.c +++ b/tests/tdef/tdef_vty_test_config_root.c @@ -53,8 +53,8 @@ static struct osmo_tdef tdefs_test[] = { { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, - { .T=INT_MAX, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="Very large" }, - { .T=-23, .default_val=-15, .desc="Negative T number" }, + { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, + { .T=-23, .default_val=239471, .desc="Negative T number" }, {} // <-- important! last entry shall be zero }; diff --git a/tests/tdef/tdef_vty_test_config_root.vty b/tests/tdef/tdef_vty_test_config_root.vty index 12876a68..de2d48f9 100644 --- a/tests/tdef/tdef_vty_test_config_root.vty +++ b/tests/tdef/tdef_vty_test_config_root.vty @@ -20,8 +20,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) software: T1 = 30 m Write code (default: 30 m) software: T2 = 20 ms Hit segfault (default: 20 ms) software: T3 = 480 m Fix bugs (default: 480 m) @@ -36,8 +36,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) software: T1 = 30 m Write code (default: 30 m) software: T2 = 20 ms Hit segfault (default: 20 ms) software: T3 = 480 m Fix bugs (default: 480 m) @@ -81,8 +81,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) software: T1 = 30 m Write code (default: 30 m) software: T2 = 20 ms Hit segfault (default: 20 ms) software: T3 = 480 m Fix bugs (default: 480 m) @@ -120,8 +120,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test(config)# do show timer te tea: T1 = 50 s Water Boiling Timeout (default: 50 s) @@ -132,8 +132,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test(config)# do show timer te T2 tea: T2 = 300 s Tea brewing (default: 300 s) @@ -176,8 +176,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test(config)# timer te T2 tea: T2 = 300 s Tea brewing (default: 300 s) @@ -250,8 +250,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) software: T1 = 13 m Write code (default: 30 m) software: T2 = 0 ms Hit segfault (default: 20 ms) software: T3 = 480 m Fix bugs (default: 480 m) @@ -265,8 +265,8 @@ test: T1 = 100 s Testing a hundred seconds (default: 100 s) test: T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) test: T3 = 100 m Testing a hundred minutes (default: 100 m) test: T4 = 100 Testing a hundred potatoes (default: 100) -test: T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -test: T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +test: T2147483647 = 4294967295 m Very large (default: 4294967295 m) +test: T-23 = 239471 s Negative T number (default: 239471 s) software: T1 = 13 m Write code (default: 30 m) software: T2 = 0 ms Hit segfault (default: 20 ms) software: T3 = 480 m Fix bugs (default: 480 m) diff --git a/tests/tdef/tdef_vty_test_config_subnode.c b/tests/tdef/tdef_vty_test_config_subnode.c index c371c8d6..ce851f50 100644 --- a/tests/tdef/tdef_vty_test_config_subnode.c +++ b/tests/tdef/tdef_vty_test_config_subnode.c @@ -54,8 +54,8 @@ static struct osmo_tdef global_tdefs[] = { { .T=2, .default_val=100, .unit=OSMO_TDEF_MS, .desc="Testing a hundred milliseconds" }, { .T=3, .default_val=100, .unit=OSMO_TDEF_M, .desc="Testing a hundred minutes" }, { .T=4, .default_val=100, .unit=OSMO_TDEF_CUSTOM, .desc="Testing a hundred potatoes" }, - { .T=INT_MAX, .default_val=ULONG_MAX, .unit=OSMO_TDEF_M, .desc="Very large" }, - { .T=-23, .default_val=-15, .desc="Negative T number" }, + { .T=0x7fffffff, .default_val=0xffffffff, .unit=OSMO_TDEF_M, .desc="Very large" }, + { .T=-23, .default_val=239471, .desc="Negative T number" }, {} // <-- important! last entry shall be zero }; diff --git a/tests/tdef/tdef_vty_test_config_subnode.vty b/tests/tdef/tdef_vty_test_config_subnode.vty index 6cfd3bf3..50e5f590 100644 --- a/tests/tdef/tdef_vty_test_config_subnode.vty +++ b/tests/tdef/tdef_vty_test_config_subnode.vty @@ -11,8 +11,8 @@ T1 = 100 s Testing a hundred seconds (default: 100 s) T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) T3 = 100 m Testing a hundred minutes (default: 100 m) T4 = 100 Testing a hundred potatoes (default: 100) -T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +T2147483647 = 4294967295 m Very large (default: 4294967295 m) +T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test> enable tdef_vty_test# show timer @@ -20,8 +20,8 @@ T1 = 100 s Testing a hundred seconds (default: 100 s) T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) T3 = 100 m Testing a hundred minutes (default: 100 m) T4 = 100 Testing a hundred potatoes (default: 100) -T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +T2147483647 = 4294967295 m Very large (default: 4294967295 m) +T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test# configure terminal tdef_vty_test(config)# show running-config @@ -34,8 +34,8 @@ T1 = 100 s Testing a hundred seconds (default: 100 s) T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) T3 = 100 m Testing a hundred minutes (default: 100 m) T4 = 100 Testing a hundred potatoes (default: 100) -T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -T-23 = 18446744073709551601 s Negative T number (default: 18446744073709551601 s) +T2147483647 = 4294967295 m Very large (default: 4294967295 m) +T-23 = 239471 s Negative T number (default: 239471 s) tdef_vty_test(config-net)# do show timer T3 T3 = 100 m Testing a hundred minutes (default: 100 m) @@ -75,23 +75,23 @@ tdef_vty_test(config-net)# timer T666 5 tdef_vty_test(config-net)# timer T-23 42 tdef_vty_test(config-net)# timer T-23 -T-23 = 42 s Negative T number (default: 18446744073709551601 s) +T-23 = 42 s Negative T number (default: 239471 s) tdef_vty_test(config-net)# timer t-23 43 tdef_vty_test(config-net)# timer T-23 -T-23 = 43 s Negative T number (default: 18446744073709551601 s) +T-23 = 43 s Negative T number (default: 239471 s) tdef_vty_test(config-net)# timer -23 44 tdef_vty_test(config-net)# timer T-23 -T-23 = 44 s Negative T number (default: 18446744073709551601 s) +T-23 = 44 s Negative T number (default: 239471 s) tdef_vty_test(config-net)# do show timer T1 = 9012345 s Testing a hundred seconds (default: 100 s) T2 = 100 ms Testing a hundred milliseconds (default: 100 ms) T3 = 100 m Testing a hundred minutes (default: 100 m) T4 = 100 Testing a hundred potatoes (default: 100) -T2147483647 = 18446744073709551615 m Very large (default: 18446744073709551615 m) -T-23 = 44 s Negative T number (default: 18446744073709551601 s) +T2147483647 = 4294967295 m Very large (default: 4294967295 m) +T-23 = 44 s Negative T number (default: 239471 s) tdef_vty_test(config-net)# show running-config ... !timer -- cgit v1.2.3