| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /* | ||
| 2 | * FpiSsm Unit tests | ||
| 3 | * Copyright (C) 2019 Marco Trevisan <marco.trevisan@canonical.com> | ||
| 4 | * | ||
| 5 | * This library is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU Lesser General Public | ||
| 7 | * License as published by the Free Software Foundation; either | ||
| 8 | * version 2.1 of the License, or (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This library is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 13 | * Lesser General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||
| 16 | * License along with this library; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include "fp-device.h" | ||
| 21 | #define FP_COMPONENT "SSM" | ||
| 22 | |||
| 23 | #include "drivers_api.h" | ||
| 24 | #include "test-device-fake.h" | ||
| 25 | #include "fpi-log.h" | ||
| 26 | |||
| 27 | /* Utility functions and shared data */ | ||
| 28 | |||
| 29 | static FpDevice *fake_device = NULL; | ||
| 30 | |||
| 31 | typedef struct | ||
| 32 | { | ||
| 33 | volatile int ref_count; | ||
| 34 | int handler_state; | ||
| 35 | GSList *handlers_chain; | ||
| 36 | gboolean completed; | ||
| 37 | GError *error; | ||
| 38 | gboolean ssm_destroyed; | ||
| 39 | gboolean expected_last_state; | ||
| 40 | } FpiSsmTestData; | ||
| 41 | |||
| 42 | static gboolean | ||
| 43 | 9 | fpi_ssm_test_nullify_pointer (gpointer * nullify_location) | |
| 44 | { | ||
| 45 | 9 | *nullify_location = NULL; | |
| 46 | |||
| 47 | 9 | return G_SOURCE_REMOVE; | |
| 48 | } | ||
| 49 | |||
| 50 | static FpiSsmTestData * | ||
| 51 | 42 | fpi_ssm_test_data_new (void) | |
| 52 | { | ||
| 53 | 84 | FpiSsmTestData *data = g_new0 (FpiSsmTestData, 1); | |
| 54 | |||
| 55 | 42 | data->ref_count = 1; | |
| 56 | 42 | data->handler_state = -1; | |
| 57 | |||
| 58 | 42 | return data; | |
| 59 | } | ||
| 60 | |||
| 61 | static FpiSsmTestData * | ||
| 62 | 19 | fpi_ssm_test_data_ref (FpiSsmTestData *data) | |
| 63 | { | ||
| 64 | 19 | g_atomic_int_inc (&data->ref_count); | |
| 65 | 19 | return data; | |
| 66 | } | ||
| 67 | |||
| 68 | static void | ||
| 69 | 61 | fpi_ssm_test_data_unref (FpiSsmTestData *data) | |
| 70 | { | ||
| 71 |
2/2✓ Branch 0 (2→3) taken 42 times.
✓ Branch 1 (2→6) taken 19 times.
|
61 | if (g_atomic_int_dec_and_test (&data->ref_count)) |
| 72 | { | ||
| 73 | 42 | g_clear_error (&data->error); | |
| 74 | 42 | g_slist_free (data->handlers_chain); | |
| 75 | 42 | g_free (data); | |
| 76 | } | ||
| 77 | 61 | } | |
| 78 | 37 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpiSsmTestData, fpi_ssm_test_data_unref) | |
| 79 | |||
| 80 | static void | ||
| 81 | 42 | fpi_ssm_test_data_unref_by_ssm (FpiSsmTestData *data) | |
| 82 | { | ||
| 83 | 42 | data->ssm_destroyed = TRUE; | |
| 84 | |||
| 85 | 42 | fpi_ssm_test_data_unref (data); | |
| 86 | 42 | } | |
| 87 | |||
| 88 | enum { | ||
| 89 | FPI_TEST_SSM_STATE_0, | ||
| 90 | FPI_TEST_SSM_STATE_1, | ||
| 91 | FPI_TEST_SSM_STATE_2, | ||
| 92 | FPI_TEST_SSM_STATE_3, | ||
| 93 | FPI_TEST_SSM_STATE_NUM | ||
| 94 | }; | ||
| 95 | |||
| 96 | static void | ||
| 97 | 66 | test_ssm_handler (FpiSsm *ssm, | |
| 98 | FpDevice *dev) | ||
| 99 | { | ||
| 100 | 66 | FpiSsmTestData *data; | |
| 101 | |||
| 102 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 66 times.
|
66 | g_assert (dev == fake_device); |
| 103 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 66 times.
|
66 | g_assert_true (FP_IS_DEVICE (dev)); |
| 104 | |||
| 105 | 66 | data = fpi_ssm_get_data (ssm); | |
| 106 | 66 | data->handler_state = fpi_ssm_get_cur_state (ssm); | |
| 107 | 198 | data->handlers_chain = g_slist_append (data->handlers_chain, | |
| 108 | 66 | GINT_TO_POINTER (fpi_ssm_get_cur_state (ssm))); | |
| 109 | 66 | } | |
| 110 | |||
| 111 | static void | ||
| 112 | 11 | test_ssm_completed_callback (FpiSsm *ssm, | |
| 113 | FpDevice *dev, | ||
| 114 | GError *error) | ||
| 115 | { | ||
| 116 | 11 | FpiSsmTestData *data; | |
| 117 | |||
| 118 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 11 times.
|
11 | g_assert (dev == fake_device); |
| 119 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 11 times.
|
11 | g_assert_true (FP_IS_DEVICE (dev)); |
| 120 | |||
| 121 | 11 | data = fpi_ssm_get_data (ssm); | |
| 122 | 11 | data->completed = TRUE; | |
| 123 | 33 | data->handlers_chain = g_slist_append (data->handlers_chain, | |
| 124 | 11 | GINT_TO_POINTER (fpi_ssm_get_cur_state (ssm))); | |
| 125 | 11 | g_clear_error (&data->error); | |
| 126 | 11 | data->error = error; | |
| 127 | |||
| 128 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 11 times.
|
11 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, data->expected_last_state); |
| 129 | 11 | } | |
| 130 | |||
| 131 | static FpiSsm * | ||
| 132 | 42 | ssm_test_new_full (int nr_states, int cleanup_state, const char *name) | |
| 133 | { | ||
| 134 | 42 | FpiSsm *ssm; | |
| 135 | 42 | FpiSsmTestData *data; | |
| 136 | |||
| 137 | 42 | ssm = fpi_ssm_new_full (fake_device, test_ssm_handler, nr_states, cleanup_state, name); | |
| 138 | 42 | data = fpi_ssm_test_data_new (); | |
| 139 | 42 | data->expected_last_state = nr_states; | |
| 140 | 42 | fpi_ssm_set_data (ssm, data, (GDestroyNotify) fpi_ssm_test_data_unref_by_ssm); | |
| 141 | |||
| 142 | 42 | return ssm; | |
| 143 | } | ||
| 144 | |||
| 145 | static FpiSsm * | ||
| 146 | 35 | ssm_test_new (void) | |
| 147 | { | ||
| 148 | 35 | return ssm_test_new_full (FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, "FPI_TEST_SSM"); | |
| 149 | } | ||
| 150 | |||
| 151 | static gboolean | ||
| 152 | 3 | test_ssm_cancel_delayed_action_delayed (gpointer data) | |
| 153 | { | ||
| 154 | 3 | FpiSsm *ssm = data; | |
| 155 | |||
| 156 | 3 | fpi_ssm_cancel_delayed_state_change (ssm); | |
| 157 | |||
| 158 | 3 | return G_SOURCE_REMOVE; | |
| 159 | } | ||
| 160 | |||
| 161 | /* Tests */ | ||
| 162 | |||
| 163 | static void | ||
| 164 | 1 | test_ssm_new (void) | |
| 165 | { | ||
| 166 | 1 | FpiSsm *ssm; | |
| 167 | |||
| 168 | 1 | ssm = fpi_ssm_new (fake_device, test_ssm_handler, FPI_TEST_SSM_STATE_NUM); | |
| 169 | |||
| 170 |
1/2✗ Branch 0 (4→5) not taken.
✓ Branch 1 (4→6) taken 1 times.
|
1 | g_assert_null (fpi_ssm_get_data (ssm)); |
| 171 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→10) taken 1 times.
|
1 | g_assert_no_error (fpi_ssm_get_error (ssm)); |
| 172 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 173 | |||
| 174 | 1 | fpi_ssm_free (ssm); | |
| 175 | 1 | } | |
| 176 | |||
| 177 | static void | ||
| 178 | 1 | test_ssm_new_full (void) | |
| 179 | { | ||
| 180 | 1 | FpiSsm *ssm; | |
| 181 | |||
| 182 | 1 | ssm = fpi_ssm_new_full (fake_device, test_ssm_handler, | |
| 183 | FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, | ||
| 184 | "Test SSM Name"); | ||
| 185 | |||
| 186 |
1/2✗ Branch 0 (4→5) not taken.
✓ Branch 1 (4→6) taken 1 times.
|
1 | g_assert_null (fpi_ssm_get_data (ssm)); |
| 187 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→10) taken 1 times.
|
1 | g_assert_no_error (fpi_ssm_get_error (ssm)); |
| 188 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 189 | |||
| 190 | 1 | fpi_ssm_free (ssm); | |
| 191 | 1 | } | |
| 192 | |||
| 193 | static void | ||
| 194 | 1 | test_ssm_new_no_handler (void) | |
| 195 | { | ||
| 196 | 2 | G_GNUC_UNUSED g_autoptr(FpiSsm) ssm = NULL; | |
| 197 | |||
| 198 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, | |
| 199 | "*BUG:*handler*"); | ||
| 200 | 1 | ssm = fpi_ssm_new (fake_device, NULL, FPI_TEST_SSM_STATE_NUM); | |
| 201 |
1/2✓ Branch 0 (5→6) taken 1 times.
✗ Branch 1 (5→7) not taken.
|
1 | g_test_assert_expected_messages (); |
| 202 | 1 | } | |
| 203 | |||
| 204 | static void | ||
| 205 | 1 | test_ssm_new_wrong_states (void) | |
| 206 | { | ||
| 207 | 2 | G_GNUC_UNUSED g_autoptr(FpiSsm) ssm = NULL; | |
| 208 | |||
| 209 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, | |
| 210 | "*BUG:*nr_states*"); | ||
| 211 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, | |
| 212 | "*BUG:*start_cleanup*"); | ||
| 213 | 1 | ssm = fpi_ssm_new (fake_device, test_ssm_handler, -1); | |
| 214 |
1/2✓ Branch 0 (6→7) taken 1 times.
✗ Branch 1 (6→8) not taken.
|
1 | g_test_assert_expected_messages (); |
| 215 | 1 | } | |
| 216 | |||
| 217 | static void | ||
| 218 | 1 | test_ssm_set_data (void) | |
| 219 | { | ||
| 220 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 221 | 1 | GObject *object = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL); | |
| 222 | |||
| 223 | 1 | g_object_add_weak_pointer (object, (gpointer) & object); | |
| 224 | |||
| 225 | 1 | fpi_ssm_set_data (ssm, object, g_object_unref); | |
| 226 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert (fpi_ssm_get_data (ssm) == object); |
| 227 | |||
| 228 | 1 | fpi_ssm_set_data (ssm, (gpointer) 0xdeadbeef, NULL); | |
| 229 |
1/2✓ Branch 0 (12→13) taken 1 times.
✗ Branch 1 (12→14) not taken.
|
1 | g_assert (fpi_ssm_get_data (ssm) == (gpointer) 0xdeadbeef); |
| 230 |
2/4✗ Branch 0 (13→15) not taken.
✓ Branch 1 (13→16) taken 1 times.
✓ Branch 2 (16→17) taken 1 times.
✗ Branch 3 (16→18) not taken.
|
1 | g_assert_null (object); |
| 231 | 1 | } | |
| 232 | |||
| 233 | static void | ||
| 234 | 1 | test_ssm_set_data_cleanup (void) | |
| 235 | { | ||
| 236 | 1 | FpiSsm *ssm = ssm_test_new (); | |
| 237 | 1 | GObject *object = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL); | |
| 238 | |||
| 239 | 1 | g_object_add_weak_pointer (object, (gpointer) & object); | |
| 240 | |||
| 241 | 1 | fpi_ssm_set_data (ssm, object, g_object_unref); | |
| 242 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert (fpi_ssm_get_data (ssm) == object); |
| 243 | |||
| 244 | 1 | fpi_ssm_free (ssm); | |
| 245 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_null (object); |
| 246 | 1 | } | |
| 247 | |||
| 248 | static void | ||
| 249 | 1 | test_ssm_start (void) | |
| 250 | { | ||
| 251 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 252 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 253 | |||
| 254 |
1/2✗ Branch 0 (4→5) not taken.
✓ Branch 1 (4→6) taken 1 times.
|
1 | g_assert_null (data->handlers_chain); |
| 255 | |||
| 256 | 1 | fpi_ssm_start (ssm, NULL); | |
| 257 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 258 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 259 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 260 |
2/4✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
✓ Branch 2 (16→17) taken 1 times.
✗ Branch 3 (16→18) not taken.
|
1 | g_assert_false (data->ssm_destroyed); |
| 261 | 1 | } | |
| 262 | |||
| 263 | static void | ||
| 264 | 1 | test_ssm_start_single (void) | |
| 265 | { | ||
| 266 | 2 | g_autoptr(FpiSsmTestData) data = NULL; | |
| 267 | 1 | FpiSsm *ssm; | |
| 268 | |||
| 269 | 1 | ssm = ssm_test_new_full (1, 1, "FPI_TEST_SSM_SINGLE_STATE"); | |
| 270 | 1 | data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 271 | |||
| 272 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 273 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, 0); |
| 274 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, 0); |
| 275 | |||
| 276 | 1 | fpi_ssm_next_state (ssm); | |
| 277 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, 0); |
| 278 | |||
| 279 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 280 |
1/2✗ Branch 0 (15→16) not taken.
✓ Branch 1 (15→17) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 281 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 282 | 1 | } | |
| 283 | |||
| 284 | static void | ||
| 285 | 1 | test_ssm_next (void) | |
| 286 | { | ||
| 287 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 288 |
1/2✓ Branch 0 (27→28) taken 1 times.
✗ Branch 1 (27→29) not taken.
|
2 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); |
| 289 | |||
| 290 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 291 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 292 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 293 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 294 | |||
| 295 | 1 | fpi_ssm_next_state (ssm); | |
| 296 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 297 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 298 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 299 | |||
| 300 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 301 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 302 | 1 | } | |
| 303 | |||
| 304 | static void | ||
| 305 | 1 | test_ssm_next_not_started (void) | |
| 306 | { | ||
| 307 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 308 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 309 | |||
| 310 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 311 | 1 | fpi_ssm_next_state (ssm); | |
| 312 | 1 | g_test_assert_expected_messages (); | |
| 313 | |||
| 314 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 315 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 316 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 317 | |||
| 318 |
1/2✗ Branch 0 (15→16) not taken.
✓ Branch 1 (15→17) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 319 |
2/4✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
✓ Branch 2 (19→20) taken 1 times.
✗ Branch 3 (19→21) not taken.
|
1 | g_assert_no_error (data->error); |
| 320 | 1 | } | |
| 321 | |||
| 322 | static void | ||
| 323 | 1 | test_ssm_next_with_delayed (void) | |
| 324 | { | ||
| 325 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 326 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 327 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 328 | |||
| 329 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 330 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 331 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 332 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 333 | |||
| 334 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 335 | |||
| 336 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 337 | 1 | fpi_ssm_next_state (ssm); | |
| 338 | 1 | g_test_assert_expected_messages (); | |
| 339 | |||
| 340 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 341 |
2/2✓ Branch 0 (20→19) taken 2 times.
✓ Branch 1 (20→21) taken 1 times.
|
3 | while (timeout_tracker) |
| 342 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 343 | |||
| 344 |
1/2✗ Branch 0 (21→22) not taken.
✓ Branch 1 (21→23) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 345 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 346 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 347 | |||
| 348 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 349 |
2/4✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
✓ Branch 2 (33→34) taken 1 times.
✗ Branch 3 (33→35) not taken.
|
1 | g_assert_no_error (data->error); |
| 350 | 1 | } | |
| 351 | |||
| 352 | static void | ||
| 353 | 1 | test_ssm_next_complete (void) | |
| 354 | { | ||
| 355 | 1 | FpiSsm *ssm = ssm_test_new (); | |
| 356 | |||
| 357 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 358 | |||
| 359 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 360 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 361 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 362 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 363 | |||
| 364 | 1 | fpi_ssm_next_state (ssm); | |
| 365 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 366 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 367 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 368 | |||
| 369 | 1 | fpi_ssm_next_state (ssm); | |
| 370 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 371 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 372 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 373 | |||
| 374 | 1 | fpi_ssm_next_state (ssm); | |
| 375 |
1/2✗ Branch 0 (32→33) not taken.
✓ Branch 1 (32→34) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 376 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_3); |
| 377 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 4); |
| 378 | |||
| 379 | 1 | fpi_ssm_next_state (ssm); | |
| 380 |
1/2✗ Branch 0 (41→42) not taken.
✓ Branch 1 (41→43) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 381 |
1/2✗ Branch 0 (44→45) not taken.
✓ Branch 1 (44→46) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 5); |
| 382 | |||
| 383 |
1/2✗ Branch 0 (46→47) not taken.
✓ Branch 1 (46→48) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 384 |
1/2✗ Branch 0 (48→49) not taken.
✓ Branch 1 (48→50) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 385 | 1 | } | |
| 386 | |||
| 387 | static void | ||
| 388 | 1 | test_ssm_jump_to_state (void) | |
| 389 | { | ||
| 390 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 391 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 392 | |||
| 393 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 394 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 395 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 396 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 397 | |||
| 398 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_2); | |
| 399 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 400 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 401 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 402 | |||
| 403 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_1); | |
| 404 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 405 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 406 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 407 | |||
| 408 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 409 |
2/4✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
✓ Branch 2 (35→36) taken 1 times.
✗ Branch 3 (35→37) not taken.
|
1 | g_assert_no_error (data->error); |
| 410 | 1 | } | |
| 411 | |||
| 412 | static void | ||
| 413 | 1 | test_ssm_jump_to_state_not_started (void) | |
| 414 | { | ||
| 415 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 416 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 417 | |||
| 418 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 419 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_2); | |
| 420 | 1 | g_test_assert_expected_messages (); | |
| 421 | |||
| 422 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 423 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 424 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 425 | |||
| 426 |
1/2✗ Branch 0 (15→16) not taken.
✓ Branch 1 (15→17) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 427 |
2/4✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
✓ Branch 2 (19→20) taken 1 times.
✗ Branch 3 (19→21) not taken.
|
1 | g_assert_no_error (data->error); |
| 428 | 1 | } | |
| 429 | |||
| 430 | static void | ||
| 431 | 1 | test_ssm_jump_to_state_with_delayed (void) | |
| 432 | { | ||
| 433 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 434 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 435 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 436 | |||
| 437 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 438 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 439 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 440 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 441 | |||
| 442 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_2, 10); | |
| 443 | |||
| 444 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 445 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_2); | |
| 446 | 1 | g_test_assert_expected_messages (); | |
| 447 | |||
| 448 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 449 |
2/2✓ Branch 0 (20→19) taken 2 times.
✓ Branch 1 (20→21) taken 1 times.
|
3 | while (timeout_tracker) |
| 450 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 451 | |||
| 452 |
1/2✗ Branch 0 (21→22) not taken.
✓ Branch 1 (21→23) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 453 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 454 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 455 | |||
| 456 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 457 |
2/4✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
✓ Branch 2 (33→34) taken 1 times.
✗ Branch 3 (33→35) not taken.
|
1 | g_assert_no_error (data->error); |
| 458 | 1 | } | |
| 459 | |||
| 460 | static void | ||
| 461 | 1 | test_ssm_jump_to_state_last (void) | |
| 462 | { | ||
| 463 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 464 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 465 | |||
| 466 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 467 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 468 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 469 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 470 | |||
| 471 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_3); | |
| 472 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 473 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_3); |
| 474 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 475 | |||
| 476 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 477 |
2/4✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
✓ Branch 2 (26→27) taken 1 times.
✗ Branch 3 (26→28) not taken.
|
1 | g_assert_no_error (data->error); |
| 478 | 1 | } | |
| 479 | |||
| 480 | static void | ||
| 481 | 1 | test_ssm_jump_to_state_wrong (void) | |
| 482 | { | ||
| 483 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 484 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 485 | |||
| 486 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 487 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 488 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 489 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 490 | |||
| 491 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*nr_states*"); | |
| 492 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_NUM + 10); | |
| 493 | 1 | g_test_assert_expected_messages (); | |
| 494 | |||
| 495 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 496 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 497 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 498 | |||
| 499 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*state*"); | |
| 500 | 1 | fpi_ssm_jump_to_state (ssm, FPI_TEST_SSM_STATE_0 - 10); | |
| 501 | 1 | g_test_assert_expected_messages (); | |
| 502 | |||
| 503 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0 - 10); |
| 504 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0 - 10); |
| 505 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 506 | |||
| 507 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 508 |
2/4✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
✓ Branch 2 (39→40) taken 1 times.
✗ Branch 3 (39→41) not taken.
|
1 | g_assert_no_error (data->error); |
| 509 | 1 | } | |
| 510 | |||
| 511 | static void | ||
| 512 | 1 | test_ssm_mark_completed (void) | |
| 513 | { | ||
| 514 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 515 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 516 | |||
| 517 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 518 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 519 | |||
| 520 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 521 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&ssm)); | |
| 522 | |||
| 523 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→11) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 524 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 525 | |||
| 526 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 527 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 528 |
1/2✗ Branch 0 (18→19) not taken.
✓ Branch 1 (18→20) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 529 | 1 | } | |
| 530 | |||
| 531 | static void | ||
| 532 | 1 | test_ssm_mark_completed_not_started (void) | |
| 533 | { | ||
| 534 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 535 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 536 | |||
| 537 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 538 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&ssm)); | |
| 539 | 1 | g_test_assert_expected_messages (); | |
| 540 | |||
| 541 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, -1); |
| 542 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 0); |
| 543 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 544 | 1 | } | |
| 545 | |||
| 546 | static void | ||
| 547 | 1 | test_ssm_mark_completed_with_delayed (void) | |
| 548 | { | ||
| 549 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 550 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 551 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 552 | |||
| 553 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 554 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 555 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 556 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 557 | |||
| 558 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 559 | 1 | fpi_ssm_mark_completed_delayed (ssm, 10); | |
| 560 | |||
| 561 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 562 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&ssm)); | |
| 563 | 1 | g_test_assert_expected_messages (); | |
| 564 | |||
| 565 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 566 |
2/2✓ Branch 0 (20→19) taken 2 times.
✓ Branch 1 (20→21) taken 1 times.
|
3 | while (timeout_tracker) |
| 567 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 568 | |||
| 569 |
1/2✗ Branch 0 (21→22) not taken.
✓ Branch 1 (21→23) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 570 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 571 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 572 | 1 | } | |
| 573 | |||
| 574 | static void | ||
| 575 | 1 | test_ssm_mark_failed (void) | |
| 576 | { | ||
| 577 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 578 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 579 | |||
| 580 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 581 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 582 | |||
| 583 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 584 | 1 | fpi_ssm_mark_failed (g_steal_pointer (&ssm), | |
| 585 | fpi_device_error_new (FP_DEVICE_ERROR_PROTO)); | ||
| 586 | |||
| 587 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 588 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 589 | |||
| 590 |
1/2✗ Branch 0 (15→16) not taken.
✓ Branch 1 (15→17) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 591 |
3/6✓ Branch 0 (17→18) taken 1 times.
✗ Branch 1 (17→21) not taken.
✓ Branch 2 (19→20) taken 1 times.
✗ Branch 3 (19→21) not taken.
✗ Branch 4 (20→21) not taken.
✓ Branch 5 (20→23) taken 1 times.
|
1 | g_assert_error (data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_PROTO); |
| 592 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 593 | 1 | } | |
| 594 | |||
| 595 | static void | ||
| 596 | 1 | test_ssm_mark_failed_not_started (void) | |
| 597 | { | ||
| 598 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 599 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 600 | |||
| 601 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 602 | 1 | fpi_ssm_mark_failed (g_steal_pointer (&ssm), | |
| 603 | fpi_device_error_new (FP_DEVICE_ERROR_PROTO)); | ||
| 604 | 1 | g_test_assert_expected_messages (); | |
| 605 | |||
| 606 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, -1); |
| 607 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 0); |
| 608 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 609 | 1 | } | |
| 610 | |||
| 611 | static void | ||
| 612 | 1 | test_ssm_mark_failed_with_delayed (void) | |
| 613 | { | ||
| 614 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 615 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 616 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 617 | |||
| 618 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 619 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 620 | |||
| 621 | 1 | fpi_ssm_mark_completed_delayed (ssm, 10); | |
| 622 | |||
| 623 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 624 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 625 | 1 | fpi_ssm_mark_failed (g_steal_pointer (&ssm), | |
| 626 | fpi_device_error_new (FP_DEVICE_ERROR_PROTO)); | ||
| 627 | 1 | g_test_assert_expected_messages (); | |
| 628 | |||
| 629 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 630 |
2/2✓ Branch 0 (16→15) taken 2 times.
✓ Branch 1 (16→17) taken 1 times.
|
3 | while (timeout_tracker) |
| 631 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 632 | |||
| 633 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 634 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 635 | |||
| 636 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 637 |
3/6✓ Branch 0 (24→25) taken 1 times.
✗ Branch 1 (24→28) not taken.
✓ Branch 2 (26→27) taken 1 times.
✗ Branch 3 (26→28) not taken.
✗ Branch 4 (27→28) not taken.
✓ Branch 5 (27→30) taken 1 times.
|
1 | g_assert_error (data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_PROTO); |
| 638 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 639 | 1 | } | |
| 640 | |||
| 641 | static void | ||
| 642 | 1 | test_ssm_delayed_next (void) | |
| 643 | { | ||
| 644 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 645 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 646 | |||
| 647 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 648 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 649 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 650 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 651 | |||
| 652 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 653 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 654 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 655 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 656 | |||
| 657 |
2/2✓ Branch 0 (24→23) taken 2 times.
✓ Branch 1 (24→25) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_0) |
| 658 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 659 | |||
| 660 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 661 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 662 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 663 | |||
| 664 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 665 |
2/4✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
✓ Branch 2 (37→38) taken 1 times.
✗ Branch 3 (37→39) not taken.
|
1 | g_assert_no_error (data->error); |
| 666 | 1 | } | |
| 667 | |||
| 668 | static void | ||
| 669 | 1 | test_ssm_delayed_next_cancel (void) | |
| 670 | { | ||
| 671 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 672 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 673 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 674 | |||
| 675 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 676 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 677 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 678 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 679 | |||
| 680 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 681 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 682 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 683 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 684 | |||
| 685 | 1 | g_idle_add_full (G_PRIORITY_HIGH, test_ssm_cancel_delayed_action_delayed, ssm, NULL); | |
| 686 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 687 | |||
| 688 |
2/2✓ Branch 0 (26→25) taken 3 times.
✓ Branch 1 (26→27) taken 1 times.
|
4 | while (timeout_tracker) |
| 689 | 3 | g_main_context_iteration (NULL, TRUE); | |
| 690 | |||
| 691 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 692 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 693 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 694 | |||
| 695 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 696 |
2/4✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
✓ Branch 2 (39→40) taken 1 times.
✗ Branch 3 (39→41) not taken.
|
1 | g_assert_no_error (data->error); |
| 697 | 1 | } | |
| 698 | |||
| 699 | static void | ||
| 700 | 1 | test_ssm_delayed_next_not_started (void) | |
| 701 | { | ||
| 702 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 703 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 704 | |||
| 705 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 706 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 707 | 1 | g_test_assert_expected_messages (); | |
| 708 | |||
| 709 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, -1); |
| 710 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 0); |
| 711 | |||
| 712 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 713 |
2/2✓ Branch 0 (15→14) taken 2 times.
✓ Branch 1 (15→16) taken 1 times.
|
3 | while (data->handler_state == -1) |
| 714 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 715 | 1 | g_test_assert_expected_messages (); | |
| 716 | |||
| 717 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 718 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 719 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 720 | |||
| 721 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 722 |
2/4✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
✓ Branch 2 (29→30) taken 1 times.
✗ Branch 3 (29→31) not taken.
|
1 | g_assert_no_error (data->error); |
| 723 | 1 | } | |
| 724 | |||
| 725 | static void | ||
| 726 | 1 | test_ssm_delayed_next_complete (void) | |
| 727 | { | ||
| 728 | 1 | FpiSsm *ssm = ssm_test_new (); | |
| 729 | |||
| 730 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 731 | |||
| 732 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 733 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 734 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 735 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 736 | |||
| 737 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 738 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 739 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 740 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 741 | |||
| 742 |
2/2✓ Branch 0 (24→23) taken 2 times.
✓ Branch 1 (24→25) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_0) |
| 743 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 744 | |||
| 745 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 746 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 747 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 748 | |||
| 749 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 750 |
1/2✗ Branch 0 (34→35) not taken.
✓ Branch 1 (34→36) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 751 |
1/2✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 752 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 753 | |||
| 754 |
2/2✓ Branch 0 (44→43) taken 2 times.
✓ Branch 1 (44→45) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_1) |
| 755 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 756 | |||
| 757 |
1/2✗ Branch 0 (45→46) not taken.
✓ Branch 1 (45→47) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 758 |
1/2✗ Branch 0 (48→49) not taken.
✓ Branch 1 (48→50) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 759 |
1/2✗ Branch 0 (51→52) not taken.
✓ Branch 1 (51→53) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 760 | |||
| 761 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 762 |
1/2✗ Branch 0 (54→55) not taken.
✓ Branch 1 (54→56) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 763 |
1/2✗ Branch 0 (57→58) not taken.
✓ Branch 1 (57→59) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 764 |
1/2✗ Branch 0 (60→61) not taken.
✓ Branch 1 (60→62) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 765 | |||
| 766 |
2/2✓ Branch 0 (64→63) taken 2 times.
✓ Branch 1 (64→65) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_2) |
| 767 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 768 | |||
| 769 |
1/2✗ Branch 0 (65→66) not taken.
✓ Branch 1 (65→67) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 770 |
1/2✗ Branch 0 (68→69) not taken.
✓ Branch 1 (68→70) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_3); |
| 771 |
1/2✗ Branch 0 (71→72) not taken.
✓ Branch 1 (71→73) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 4); |
| 772 | |||
| 773 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 774 |
1/2✗ Branch 0 (74→75) not taken.
✓ Branch 1 (74→76) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 775 |
1/2✗ Branch 0 (77→78) not taken.
✓ Branch 1 (77→79) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_3); |
| 776 |
1/2✗ Branch 0 (80→81) not taken.
✓ Branch 1 (80→82) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 4); |
| 777 | |||
| 778 |
2/2✓ Branch 0 (84→83) taken 2 times.
✓ Branch 1 (84→85) taken 1 times.
|
3 | while (!data->completed) |
| 779 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 780 | |||
| 781 |
1/2✗ Branch 0 (85→86) not taken.
✓ Branch 1 (85→87) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 782 |
1/2✗ Branch 0 (88→89) not taken.
✓ Branch 1 (88→90) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 5); |
| 783 | |||
| 784 |
1/2✗ Branch 0 (90→91) not taken.
✓ Branch 1 (90→92) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 785 |
1/2✗ Branch 0 (92→93) not taken.
✓ Branch 1 (92→94) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 786 | 1 | } | |
| 787 | |||
| 788 | static void | ||
| 789 | 1 | test_ssm_delayed_jump_to_state (void) | |
| 790 | { | ||
| 791 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 792 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 793 | |||
| 794 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 795 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 796 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 797 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 798 | |||
| 799 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_2, 10); | |
| 800 | |||
| 801 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 802 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 803 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 804 | |||
| 805 |
2/2✓ Branch 0 (24→23) taken 2 times.
✓ Branch 1 (24→25) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_0) |
| 806 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 807 | |||
| 808 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 809 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 810 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 811 | |||
| 812 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_1, 10); | |
| 813 | |||
| 814 |
1/2✗ Branch 0 (34→35) not taken.
✓ Branch 1 (34→36) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 815 |
1/2✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 816 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 817 | |||
| 818 |
2/2✓ Branch 0 (44→43) taken 2 times.
✓ Branch 1 (44→45) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_2) |
| 819 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 820 | |||
| 821 |
1/2✗ Branch 0 (45→46) not taken.
✓ Branch 1 (45→47) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 822 |
1/2✗ Branch 0 (48→49) not taken.
✓ Branch 1 (48→50) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 823 |
1/2✗ Branch 0 (51→52) not taken.
✓ Branch 1 (51→53) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 824 | |||
| 825 |
1/2✗ Branch 0 (53→54) not taken.
✓ Branch 1 (53→55) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 826 |
2/4✗ Branch 0 (55→56) not taken.
✓ Branch 1 (55→57) taken 1 times.
✓ Branch 2 (57→58) taken 1 times.
✗ Branch 3 (57→59) not taken.
|
1 | g_assert_no_error (data->error); |
| 827 | 1 | } | |
| 828 | |||
| 829 | static void | ||
| 830 | 1 | test_ssm_delayed_jump_to_state_cancel (void) | |
| 831 | { | ||
| 832 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 833 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 834 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 835 | |||
| 836 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 837 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 838 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 839 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 840 | |||
| 841 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_2, 10); | |
| 842 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 843 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 844 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 845 | |||
| 846 | 1 | g_idle_add_full (G_PRIORITY_HIGH, test_ssm_cancel_delayed_action_delayed, ssm, NULL); | |
| 847 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 848 | |||
| 849 |
2/2✓ Branch 0 (26→25) taken 3 times.
✓ Branch 1 (26→27) taken 1 times.
|
4 | while (timeout_tracker) |
| 850 | 3 | g_main_context_iteration (NULL, TRUE); | |
| 851 | |||
| 852 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 853 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 854 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 855 | |||
| 856 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 857 |
2/4✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
✓ Branch 2 (39→40) taken 1 times.
✗ Branch 3 (39→41) not taken.
|
1 | g_assert_no_error (data->error); |
| 858 | 1 | } | |
| 859 | |||
| 860 | static void | ||
| 861 | 1 | test_ssm_delayed_jump_to_state_not_started (void) | |
| 862 | { | ||
| 863 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 864 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 865 | |||
| 866 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 867 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_2, 10); | |
| 868 | 1 | g_test_assert_expected_messages (); | |
| 869 | |||
| 870 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, -1); |
| 871 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→11) taken 1 times.
|
1 | g_assert_null (data->handlers_chain); |
| 872 | |||
| 873 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 874 |
2/2✓ Branch 0 (14→13) taken 2 times.
✓ Branch 1 (14→15) taken 1 times.
|
3 | while (data->handler_state == -1) |
| 875 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 876 | 1 | g_test_assert_expected_messages (); | |
| 877 | |||
| 878 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 879 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_2); |
| 880 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 881 | |||
| 882 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 883 |
2/4✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
✓ Branch 2 (28→29) taken 1 times.
✗ Branch 3 (28→30) not taken.
|
1 | g_assert_no_error (data->error); |
| 884 | 1 | } | |
| 885 | |||
| 886 | static void | ||
| 887 | 1 | test_ssm_delayed_jump_to_state_last (void) | |
| 888 | { | ||
| 889 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 890 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 891 | |||
| 892 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 893 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 894 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 895 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 896 | |||
| 897 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_3, 10); | |
| 898 | |||
| 899 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 900 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 901 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 902 | |||
| 903 |
2/2✓ Branch 0 (24→23) taken 2 times.
✓ Branch 1 (24→25) taken 1 times.
|
3 | while (data->handler_state == FPI_TEST_SSM_STATE_0) |
| 904 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 905 | |||
| 906 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 907 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_3); |
| 908 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 909 | |||
| 910 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 911 |
2/4✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
✓ Branch 2 (37→38) taken 1 times.
✗ Branch 3 (37→39) not taken.
|
1 | g_assert_no_error (data->error); |
| 912 | 1 | } | |
| 913 | |||
| 914 | static void | ||
| 915 | 1 | test_ssm_delayed_jump_to_state_wrong (void) | |
| 916 | { | ||
| 917 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 918 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 919 | |||
| 920 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 921 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 922 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 923 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 924 | |||
| 925 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*nr_states*"); | |
| 926 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_NUM + 10, 10); | |
| 927 | 1 | g_test_assert_expected_messages (); | |
| 928 | |||
| 929 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 930 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 931 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 932 | |||
| 933 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*nr_states*"); | |
| 934 |
2/2✓ Branch 0 (28→26) taken 2 times.
✓ Branch 1 (28→29) taken 1 times.
|
3 | while (g_slist_length (data->handlers_chain) == 1) |
| 935 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 936 | 1 | g_test_assert_expected_messages (); | |
| 937 | |||
| 938 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 939 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 940 |
1/2✗ Branch 0 (36→37) not taken.
✓ Branch 1 (36→38) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 941 | |||
| 942 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*state*"); | |
| 943 | 1 | fpi_ssm_jump_to_state_delayed (ssm, FPI_TEST_SSM_STATE_0 - 10, 10); | |
| 944 | 1 | g_test_assert_expected_messages (); | |
| 945 | |||
| 946 |
1/2✗ Branch 0 (41→42) not taken.
✓ Branch 1 (41→43) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 947 |
1/2✗ Branch 0 (44→45) not taken.
✓ Branch 1 (44→46) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_NUM + 10); |
| 948 |
1/2✗ Branch 0 (47→48) not taken.
✓ Branch 1 (47→49) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 949 | |||
| 950 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*state*"); | |
| 951 |
2/2✓ Branch 0 (53→51) taken 2 times.
✓ Branch 1 (53→54) taken 1 times.
|
3 | while (g_slist_length (data->handlers_chain) == 2) |
| 952 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 953 | 1 | g_test_assert_expected_messages (); | |
| 954 | |||
| 955 |
1/2✗ Branch 0 (55→56) not taken.
✓ Branch 1 (55→57) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0 - 10); |
| 956 |
1/2✗ Branch 0 (58→59) not taken.
✓ Branch 1 (58→60) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0 - 10); |
| 957 |
1/2✗ Branch 0 (61→62) not taken.
✓ Branch 1 (61→63) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 958 | |||
| 959 |
1/2✗ Branch 0 (63→64) not taken.
✓ Branch 1 (63→65) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 960 |
2/4✗ Branch 0 (65→66) not taken.
✓ Branch 1 (65→67) taken 1 times.
✓ Branch 2 (67→68) taken 1 times.
✗ Branch 3 (67→69) not taken.
|
1 | g_assert_no_error (data->error); |
| 961 | 1 | } | |
| 962 | |||
| 963 | static void | ||
| 964 | 1 | test_ssm_delayed_mark_completed (void) | |
| 965 | { | ||
| 966 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 967 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 968 | |||
| 969 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 970 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 971 | |||
| 972 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 973 | 1 | fpi_ssm_mark_completed_delayed (g_steal_pointer (&ssm), 10); | |
| 974 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 975 | |||
| 976 |
2/2✓ Branch 0 (15→13) taken 2 times.
✓ Branch 1 (15→16) taken 1 times.
|
3 | while (g_slist_length (data->handlers_chain) == 1) |
| 977 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 978 | |||
| 979 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 980 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 981 |
1/2✗ Branch 0 (21→22) not taken.
✓ Branch 1 (21→23) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 982 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 983 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 984 | 1 | } | |
| 985 | |||
| 986 | static void | ||
| 987 | 1 | test_ssm_delayed_mark_completed_not_started (void) | |
| 988 | { | ||
| 989 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 990 |
1/2✗ Branch 0 (21→22) not taken.
✓ Branch 1 (21→23) taken 1 times.
|
2 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); |
| 991 | |||
| 992 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 993 | 1 | fpi_ssm_mark_completed_delayed (ssm, 10); | |
| 994 | 1 | g_test_assert_expected_messages (); | |
| 995 | |||
| 996 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &ssm); | |
| 997 | |||
| 998 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 999 |
2/2✓ Branch 0 (11→10) taken 3 times.
✓ Branch 1 (11→12) taken 1 times.
|
4 | while (ssm != NULL) |
| 1000 | 3 | g_main_context_iteration (NULL, TRUE); | |
| 1001 | 1 | g_test_assert_expected_messages (); | |
| 1002 | |||
| 1003 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, -1); |
| 1004 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 0); |
| 1005 |
1/2✗ Branch 0 (18→19) not taken.
✓ Branch 1 (18→20) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 1006 | 1 | } | |
| 1007 | |||
| 1008 | static void | ||
| 1009 | 1 | test_ssm_delayed_mark_completed_cancel (void) | |
| 1010 | { | ||
| 1011 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1012 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 1013 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 1014 | |||
| 1015 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1016 |
1/2✗ Branch 0 (5→6) not taken.
✓ Branch 1 (5→7) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1017 |
1/2✗ Branch 0 (8→9) not taken.
✓ Branch 1 (8→10) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1018 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1019 | |||
| 1020 | 1 | fpi_ssm_mark_completed_delayed (ssm, 10); | |
| 1021 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1022 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1023 |
1/2✗ Branch 0 (20→21) not taken.
✓ Branch 1 (20→22) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1024 | |||
| 1025 | 1 | g_idle_add_full (G_PRIORITY_HIGH, test_ssm_cancel_delayed_action_delayed, ssm, NULL); | |
| 1026 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 1027 | |||
| 1028 |
2/2✓ Branch 0 (26→25) taken 3 times.
✓ Branch 1 (26→27) taken 1 times.
|
4 | while (timeout_tracker) |
| 1029 | 3 | g_main_context_iteration (NULL, TRUE); | |
| 1030 | |||
| 1031 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1032 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1033 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1034 | |||
| 1035 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1036 |
1/2✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 1037 |
2/4✗ Branch 0 (39→40) not taken.
✓ Branch 1 (39→41) taken 1 times.
✓ Branch 2 (41→42) taken 1 times.
✗ Branch 3 (41→43) not taken.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1038 | 1 | } | |
| 1039 | |||
| 1040 | static void | ||
| 1041 | 1 | test_ssm_delayed_cancel_error (void) | |
| 1042 | { | ||
| 1043 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1044 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 1045 | |||
| 1046 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 1047 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 1048 | 1 | fpi_ssm_cancel_delayed_state_change (ssm); | |
| 1049 | 1 | g_test_assert_expected_messages (); | |
| 1050 | |||
| 1051 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1052 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→11) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1053 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1054 |
1/2✗ Branch 0 (15→16) not taken.
✓ Branch 1 (15→17) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1055 | |||
| 1056 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 1057 | 1 | fpi_ssm_cancel_delayed_state_change (ssm); | |
| 1058 |
1/2✓ Branch 0 (20→21) taken 1 times.
✗ Branch 1 (20→22) not taken.
|
1 | g_test_assert_expected_messages (); |
| 1059 | 1 | } | |
| 1060 | |||
| 1061 | static void | ||
| 1062 | 1 | test_ssm_subssm_start (void) | |
| 1063 | { | ||
| 1064 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1065 |
1/2✓ Branch 0 (73→74) taken 1 times.
✗ Branch 1 (73→75) not taken.
|
1 | g_autoptr(FpiSsm) subssm = |
| 1066 | 1 | ssm_test_new_full (FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, "FPI_TEST_SUB_SSM"); | |
| 1067 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 1068 | |||
| 1069 |
1/2✓ Branch 0 (73→74) taken 1 times.
✗ Branch 1 (73→75) not taken.
|
1 | g_autoptr(FpiSsmTestData) subdata = |
| 1070 | 1 | fpi_ssm_test_data_ref (fpi_ssm_get_data (subssm)); | |
| 1071 | |||
| 1072 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1073 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1074 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1075 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1076 | |||
| 1077 | 1 | fpi_ssm_start_subsm (ssm, subssm); | |
| 1078 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1079 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (subssm), ==, FPI_TEST_SSM_STATE_0); |
| 1080 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1081 | |||
| 1082 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1083 |
1/2✗ Branch 0 (27→28) not taken.
✓ Branch 1 (27→29) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1084 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1085 | |||
| 1086 | 1 | fpi_ssm_next_state (subssm); | |
| 1087 | |||
| 1088 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 1089 |
1/2✗ Branch 0 (36→37) not taken.
✓ Branch 1 (36→38) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 2); |
| 1090 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_no_error (subdata->error); |
| 1091 | |||
| 1092 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1093 |
1/2✗ Branch 0 (43→44) not taken.
✓ Branch 1 (43→45) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1094 |
1/2✗ Branch 0 (46→47) not taken.
✓ Branch 1 (46→48) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1095 | |||
| 1096 | 1 | subdata->expected_last_state = FPI_TEST_SSM_STATE_1; | |
| 1097 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&subssm)); | |
| 1098 | |||
| 1099 |
1/2✗ Branch 0 (49→50) not taken.
✓ Branch 1 (49→51) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 1100 |
1/2✗ Branch 0 (52→53) not taken.
✓ Branch 1 (52→54) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 2); |
| 1101 |
1/2✗ Branch 0 (54→55) not taken.
✓ Branch 1 (54→56) taken 1 times.
|
1 | g_assert_true (subdata->ssm_destroyed); |
| 1102 |
1/2✗ Branch 0 (56→57) not taken.
✓ Branch 1 (56→58) taken 1 times.
|
1 | g_assert_no_error (subdata->error); |
| 1103 | |||
| 1104 |
1/2✗ Branch 0 (58→59) not taken.
✓ Branch 1 (58→60) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 1105 |
1/2✗ Branch 0 (61→62) not taken.
✓ Branch 1 (61→63) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 1106 |
1/2✗ Branch 0 (64→65) not taken.
✓ Branch 1 (64→66) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1107 | |||
| 1108 |
1/2✗ Branch 0 (66→67) not taken.
✓ Branch 1 (66→68) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1109 |
1/2✗ Branch 0 (68→69) not taken.
✓ Branch 1 (68→70) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1110 |
1/2✗ Branch 0 (70→71) not taken.
✓ Branch 1 (70→72) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 1111 | 1 | } | |
| 1112 | |||
| 1113 | static void | ||
| 1114 | 1 | test_ssm_subssm_mark_failed (void) | |
| 1115 | { | ||
| 1116 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1117 | 3 | g_autoptr(FpiSsm) subssm = | |
| 1118 | 1 | ssm_test_new_full (FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, "FPI_TEST_SUB_SSM"); | |
| 1119 | 3 | g_autoptr(FpiSsmTestData) data = | |
| 1120 | 1 | fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 1121 | 1 | g_autoptr(FpiSsmTestData) subdata = | |
| 1122 | 1 | fpi_ssm_test_data_ref (fpi_ssm_get_data (subssm)); | |
| 1123 | |||
| 1124 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1125 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1126 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1127 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1128 | |||
| 1129 | 1 | fpi_ssm_start_subsm (g_steal_pointer (&ssm), subssm); | |
| 1130 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1131 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (subssm), ==, FPI_TEST_SSM_STATE_0); |
| 1132 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1133 | |||
| 1134 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 1135 | 1 | subdata->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 1136 | 1 | fpi_ssm_mark_failed (g_steal_pointer (&subssm), | |
| 1137 | fpi_device_error_new (FP_DEVICE_ERROR_BUSY)); | ||
| 1138 | |||
| 1139 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1140 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1141 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_true (subdata->ssm_destroyed); |
| 1142 |
1/2✗ Branch 0 (33→34) not taken.
✓ Branch 1 (33→35) taken 1 times.
|
1 | g_assert_no_error (subdata->error); |
| 1143 | |||
| 1144 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1145 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1146 | |||
| 1147 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 1148 |
1/2✗ Branch 0 (42→43) not taken.
✓ Branch 1 (42→44) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 1149 |
3/6✓ Branch 0 (44→45) taken 1 times.
✗ Branch 1 (44→48) not taken.
✓ Branch 2 (46→47) taken 1 times.
✗ Branch 3 (46→48) not taken.
✗ Branch 4 (47→48) not taken.
✓ Branch 5 (47→50) taken 1 times.
|
1 | g_assert_error (data->error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_BUSY); |
| 1150 | 1 | } | |
| 1151 | |||
| 1152 | static void | ||
| 1153 | 1 | test_ssm_subssm_start_with_started (void) | |
| 1154 | { | ||
| 1155 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1156 |
1/2✓ Branch 0 (55→56) taken 1 times.
✗ Branch 1 (55→57) not taken.
|
1 | g_autoptr(FpiSsm) subssm = |
| 1157 | 1 | ssm_test_new_full (FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, "FPI_TEST_SUB_SSM"); | |
| 1158 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 1159 | |||
| 1160 |
1/2✓ Branch 0 (55→56) taken 1 times.
✗ Branch 1 (55→57) not taken.
|
1 | g_autoptr(FpiSsmTestData) subdata = |
| 1161 | 1 | fpi_ssm_test_data_ref (fpi_ssm_get_data (subssm)); | |
| 1162 | |||
| 1163 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1164 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1165 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1166 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1167 | |||
| 1168 | 1 | fpi_ssm_start (subssm, test_ssm_completed_callback); | |
| 1169 |
1/2✗ Branch 0 (17→18) not taken.
✓ Branch 1 (17→19) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1170 | |||
| 1171 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*completed*"); | |
| 1172 | 1 | fpi_ssm_start_subsm (ssm, subssm); | |
| 1173 | 1 | g_test_assert_expected_messages (); | |
| 1174 | |||
| 1175 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1176 |
1/2✗ Branch 0 (25→26) not taken.
✓ Branch 1 (25→27) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (subssm), ==, FPI_TEST_SSM_STATE_0); |
| 1177 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 2); |
| 1178 | |||
| 1179 | 1 | subdata->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 1180 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&subssm)); | |
| 1181 | |||
| 1182 |
1/2✗ Branch 0 (31→32) not taken.
✓ Branch 1 (31→33) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1183 |
1/2✗ Branch 0 (34→35) not taken.
✓ Branch 1 (34→36) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 2); |
| 1184 |
1/2✗ Branch 0 (36→37) not taken.
✓ Branch 1 (36→38) taken 1 times.
|
1 | g_assert_true (subdata->ssm_destroyed); |
| 1185 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_no_error (subdata->error); |
| 1186 | |||
| 1187 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 1188 |
1/2✗ Branch 0 (43→44) not taken.
✓ Branch 1 (43→45) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 1189 |
1/2✗ Branch 0 (46→47) not taken.
✓ Branch 1 (46→48) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1190 | |||
| 1191 |
1/2✗ Branch 0 (48→49) not taken.
✓ Branch 1 (48→50) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1192 |
1/2✗ Branch 0 (50→51) not taken.
✓ Branch 1 (50→52) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1193 |
1/2✗ Branch 0 (52→53) not taken.
✓ Branch 1 (52→54) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 1194 | 1 | } | |
| 1195 | |||
| 1196 | static void | ||
| 1197 | 1 | test_ssm_subssm_start_with_delayed (void) | |
| 1198 | { | ||
| 1199 | 1 | g_autoptr(FpiSsm) ssm = ssm_test_new (); | |
| 1200 |
1/2✓ Branch 0 (56→57) taken 1 times.
✗ Branch 1 (56→58) not taken.
|
1 | g_autoptr(FpiSsm) subssm = |
| 1201 | 1 | ssm_test_new_full (FPI_TEST_SSM_STATE_NUM, FPI_TEST_SSM_STATE_NUM, "FPI_TEST_SUB_SSM"); | |
| 1202 | 1 | FpiSsmTestData *data = fpi_ssm_get_data (ssm); | |
| 1203 | |||
| 1204 |
1/2✓ Branch 0 (56→57) taken 1 times.
✗ Branch 1 (56→58) not taken.
|
1 | g_autoptr(FpiSsmTestData) subdata = |
| 1205 | 1 | fpi_ssm_test_data_ref (fpi_ssm_get_data (subssm)); | |
| 1206 | 1 | gpointer timeout_tracker = GUINT_TO_POINTER (TRUE); | |
| 1207 | |||
| 1208 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1209 |
1/2✗ Branch 0 (7→8) not taken.
✓ Branch 1 (7→9) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1210 |
1/2✗ Branch 0 (10→11) not taken.
✓ Branch 1 (10→12) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_0); |
| 1211 |
1/2✗ Branch 0 (13→14) not taken.
✓ Branch 1 (13→15) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1212 | |||
| 1213 | 1 | fpi_ssm_next_state_delayed (ssm, 10); | |
| 1214 | |||
| 1215 | 1 | g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, "*BUG:*timeout*"); | |
| 1216 | 1 | fpi_ssm_start_subsm (ssm, subssm); | |
| 1217 | 1 | g_test_assert_expected_messages (); | |
| 1218 | |||
| 1219 | 1 | g_timeout_add (100, G_SOURCE_FUNC (fpi_ssm_test_nullify_pointer), &timeout_tracker); | |
| 1220 |
2/2✓ Branch 0 (22→21) taken 2 times.
✓ Branch 1 (22→23) taken 1 times.
|
3 | while (timeout_tracker) |
| 1221 | 2 | g_main_context_iteration (NULL, TRUE); | |
| 1222 | |||
| 1223 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1224 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (subssm), ==, FPI_TEST_SSM_STATE_0); |
| 1225 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1226 | |||
| 1227 | 1 | subdata->expected_last_state = FPI_TEST_SSM_STATE_0; | |
| 1228 | 1 | fpi_ssm_mark_completed (g_steal_pointer (&subssm)); | |
| 1229 | |||
| 1230 |
1/2✗ Branch 0 (32→33) not taken.
✓ Branch 1 (32→34) taken 1 times.
|
1 | g_assert_cmpint (subdata->handler_state, ==, FPI_TEST_SSM_STATE_0); |
| 1231 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (subdata->handlers_chain), ==, 1); |
| 1232 |
1/2✗ Branch 0 (37→38) not taken.
✓ Branch 1 (37→39) taken 1 times.
|
1 | g_assert_true (subdata->ssm_destroyed); |
| 1233 |
1/2✗ Branch 0 (39→40) not taken.
✓ Branch 1 (39→41) taken 1 times.
|
1 | g_assert_no_error (subdata->error); |
| 1234 | |||
| 1235 |
1/2✗ Branch 0 (41→42) not taken.
✓ Branch 1 (41→43) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_1); |
| 1236 |
1/2✗ Branch 0 (44→45) not taken.
✓ Branch 1 (44→46) taken 1 times.
|
1 | g_assert_cmpint (fpi_ssm_get_cur_state (ssm), ==, FPI_TEST_SSM_STATE_1); |
| 1237 |
1/2✗ Branch 0 (47→48) not taken.
✓ Branch 1 (47→49) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1238 | |||
| 1239 |
1/2✗ Branch 0 (49→50) not taken.
✓ Branch 1 (49→51) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1240 |
1/2✗ Branch 0 (51→52) not taken.
✓ Branch 1 (51→53) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1241 |
1/2✗ Branch 0 (53→54) not taken.
✓ Branch 1 (53→55) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 1242 | 1 | } | |
| 1243 | |||
| 1244 | static void | ||
| 1245 | 1 | test_ssm_cleanup_complete (void) | |
| 1246 | { | ||
| 1247 | 1 | FpiSsm *ssm = ssm_test_new_full (4, FPI_TEST_SSM_STATE_2, "FPI_TEST_SSM"); | |
| 1248 | |||
| 1249 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 1250 | |||
| 1251 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1252 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1253 | |||
| 1254 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_3; | |
| 1255 | |||
| 1256 | /* Completing jumps to the cleanup state */ | ||
| 1257 | 1 | fpi_ssm_mark_completed (ssm); | |
| 1258 |
1/2✗ Branch 0 (9→10) not taken.
✓ Branch 1 (9→11) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 1259 |
1/2✗ Branch 0 (12→13) not taken.
✓ Branch 1 (12→14) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1260 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1261 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1262 | |||
| 1263 | /* Completing again jumps to the next cleanup state */ | ||
| 1264 | 1 | fpi_ssm_mark_completed (ssm); | |
| 1265 |
1/2✗ Branch 0 (19→20) not taken.
✓ Branch 1 (19→21) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 1266 |
1/2✗ Branch 0 (22→23) not taken.
✓ Branch 1 (22→24) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 1267 |
1/2✗ Branch 0 (24→25) not taken.
✓ Branch 1 (24→26) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1268 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1269 | |||
| 1270 | /* Completing again finalizes everything */ | ||
| 1271 | 1 | fpi_ssm_mark_completed (ssm); | |
| 1272 |
1/2✗ Branch 0 (29→30) not taken.
✓ Branch 1 (29→31) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 1273 |
1/2✗ Branch 0 (32→33) not taken.
✓ Branch 1 (32→34) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 4); |
| 1274 |
1/2✗ Branch 0 (34→35) not taken.
✓ Branch 1 (34→36) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 1275 |
1/2✗ Branch 0 (36→37) not taken.
✓ Branch 1 (36→38) taken 1 times.
|
1 | g_assert_no_error (data->error); |
| 1276 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 1277 | 1 | } | |
| 1278 | |||
| 1279 | static void | ||
| 1280 | 1 | test_ssm_cleanup_fail (void) | |
| 1281 | { | ||
| 1282 | 1 | FpiSsm *ssm = ssm_test_new_full (4, FPI_TEST_SSM_STATE_2, "FPI_TEST_SSM"); | |
| 1283 | |||
| 1284 | 1 | g_autoptr(FpiSsmTestData) data = fpi_ssm_test_data_ref (fpi_ssm_get_data (ssm)); | |
| 1285 | |||
| 1286 | 1 | fpi_ssm_start (ssm, test_ssm_completed_callback); | |
| 1287 |
1/2✗ Branch 0 (6→7) not taken.
✓ Branch 1 (6→8) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 1); |
| 1288 | |||
| 1289 | 1 | data->expected_last_state = FPI_TEST_SSM_STATE_3; | |
| 1290 | |||
| 1291 | /* Failing jumps to the cleanup state */ | ||
| 1292 | 1 | fpi_ssm_mark_failed (ssm, g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED, "non-cleanup")); | |
| 1293 |
1/2✗ Branch 0 (11→12) not taken.
✓ Branch 1 (11→13) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_2); |
| 1294 |
1/2✗ Branch 0 (14→15) not taken.
✓ Branch 1 (14→16) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 2); |
| 1295 |
1/2✗ Branch 0 (16→17) not taken.
✓ Branch 1 (16→18) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1296 |
1/2✗ Branch 0 (18→19) not taken.
✓ Branch 1 (18→20) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1297 | |||
| 1298 | /* Failing again jumps to the next cleanup state */ | ||
| 1299 | 1 | fpi_ssm_mark_failed (ssm, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "cleanup 1")); | |
| 1300 |
1/2✗ Branch 0 (23→24) not taken.
✓ Branch 1 (23→25) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 1301 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 3); |
| 1302 |
1/2✗ Branch 0 (28→29) not taken.
✓ Branch 1 (28→30) taken 1 times.
|
1 | g_assert_false (data->completed); |
| 1303 |
1/2✗ Branch 0 (30→31) not taken.
✓ Branch 1 (30→32) taken 1 times.
|
1 | g_assert_false (data->ssm_destroyed); |
| 1304 | |||
| 1305 | /* Failing again finalizes everything */ | ||
| 1306 | 1 | fpi_ssm_mark_failed (ssm, g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "cleanup 2")); | |
| 1307 |
1/2✗ Branch 0 (35→36) not taken.
✓ Branch 1 (35→37) taken 1 times.
|
1 | g_assert_cmpint (data->handler_state, ==, FPI_TEST_SSM_STATE_3); |
| 1308 |
1/2✗ Branch 0 (38→39) not taken.
✓ Branch 1 (38→40) taken 1 times.
|
1 | g_assert_cmpuint (g_slist_length (data->handlers_chain), ==, 4); |
| 1309 |
1/2✗ Branch 0 (40→41) not taken.
✓ Branch 1 (40→42) taken 1 times.
|
1 | g_assert_true (data->completed); |
| 1310 |
3/6✓ Branch 0 (42→43) taken 1 times.
✗ Branch 1 (42→46) not taken.
✓ Branch 2 (44→45) taken 1 times.
✗ Branch 3 (44→46) not taken.
✗ Branch 4 (45→46) not taken.
✓ Branch 5 (45→48) taken 1 times.
|
1 | g_assert_error (data->error, G_IO_ERROR, G_IO_ERROR_CANCELLED); |
| 1311 |
1/2✗ Branch 0 (48→49) not taken.
✓ Branch 1 (48→50) taken 1 times.
|
1 | g_assert_true (data->ssm_destroyed); |
| 1312 | 1 | } | |
| 1313 | |||
| 1314 | int | ||
| 1315 | 1 | main (int argc, char *argv[]) | |
| 1316 | { | ||
| 1317 | 2 | g_autoptr(FpDevice) device = NULL; | |
| 1318 | |||
| 1319 | 1 | g_test_init (&argc, &argv, NULL); | |
| 1320 | |||
| 1321 | 1 | device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL); | |
| 1322 | 1 | fake_device = device; | |
| 1323 | 1 | g_object_add_weak_pointer (G_OBJECT (device), (gpointer) & fake_device); | |
| 1324 | |||
| 1325 | 1 | g_test_add_func ("/ssm/new", test_ssm_new); | |
| 1326 | 1 | g_test_add_func ("/ssm/new/full", test_ssm_new_full); | |
| 1327 | 1 | g_test_add_func ("/ssm/new/no_handler", test_ssm_new_no_handler); | |
| 1328 | 1 | g_test_add_func ("/ssm/new/wrong_states", test_ssm_new_wrong_states); | |
| 1329 | 1 | g_test_add_func ("/ssm/set_data", test_ssm_set_data); | |
| 1330 | 1 | g_test_add_func ("/ssm/set_data/cleanup", test_ssm_set_data_cleanup); | |
| 1331 | 1 | g_test_add_func ("/ssm/start", test_ssm_start); | |
| 1332 | 1 | g_test_add_func ("/ssm/start/single", test_ssm_start_single); | |
| 1333 | 1 | g_test_add_func ("/ssm/next", test_ssm_next); | |
| 1334 | 1 | g_test_add_func ("/ssm/next/complete", test_ssm_next_complete); | |
| 1335 | 1 | g_test_add_func ("/ssm/next/not_started", test_ssm_next_not_started); | |
| 1336 | 1 | g_test_add_func ("/ssm/next/with_delayed", test_ssm_next_with_delayed); | |
| 1337 | 1 | g_test_add_func ("/ssm/jump_to_state", test_ssm_jump_to_state); | |
| 1338 | 1 | g_test_add_func ("/ssm/jump_to_state/not_started", test_ssm_jump_to_state_not_started); | |
| 1339 | 1 | g_test_add_func ("/ssm/jump_to_state/with_delayed", test_ssm_jump_to_state_with_delayed); | |
| 1340 | 1 | g_test_add_func ("/ssm/jump_to_state/last", test_ssm_jump_to_state_last); | |
| 1341 | 1 | g_test_add_func ("/ssm/jump_to_state/wrong", test_ssm_jump_to_state_wrong); | |
| 1342 | 1 | g_test_add_func ("/ssm/mark_completed", test_ssm_mark_completed); | |
| 1343 | 1 | g_test_add_func ("/ssm/mark_completed/not_started", test_ssm_mark_completed_not_started); | |
| 1344 | 1 | g_test_add_func ("/ssm/mark_completed/with_delayed", test_ssm_mark_completed_with_delayed); | |
| 1345 | 1 | g_test_add_func ("/ssm/mark_failed", test_ssm_mark_failed); | |
| 1346 | 1 | g_test_add_func ("/ssm/mark_failed/not_started", test_ssm_mark_failed_not_started); | |
| 1347 | 1 | g_test_add_func ("/ssm/mark_failed/with_delayed", test_ssm_mark_failed_with_delayed); | |
| 1348 | 1 | g_test_add_func ("/ssm/delayed/next", test_ssm_delayed_next); | |
| 1349 | 1 | g_test_add_func ("/ssm/delayed/next/cancel", test_ssm_delayed_next_cancel); | |
| 1350 | 1 | g_test_add_func ("/ssm/delayed/next/not_started", test_ssm_delayed_next_not_started); | |
| 1351 | 1 | g_test_add_func ("/ssm/delayed/next/complete", test_ssm_delayed_next_complete); | |
| 1352 | 1 | g_test_add_func ("/ssm/delayed/jump_to_state", test_ssm_delayed_jump_to_state); | |
| 1353 | 1 | g_test_add_func ("/ssm/delayed/jump_to_state/cancel", test_ssm_delayed_jump_to_state_cancel); | |
| 1354 | 1 | g_test_add_func ("/ssm/delayed/jump_to_state/not_started", test_ssm_delayed_jump_to_state_not_started); | |
| 1355 | 1 | g_test_add_func ("/ssm/delayed/jump_to_state/last", test_ssm_delayed_jump_to_state_last); | |
| 1356 | 1 | g_test_add_func ("/ssm/delayed/jump_to_state/wrong", test_ssm_delayed_jump_to_state_wrong); | |
| 1357 | 1 | g_test_add_func ("/ssm/delayed/mark_completed", test_ssm_delayed_mark_completed); | |
| 1358 | 1 | g_test_add_func ("/ssm/delayed/mark_completed/cancel", test_ssm_delayed_mark_completed_cancel); | |
| 1359 | 1 | g_test_add_func ("/ssm/delayed/mark_completed/not_started", test_ssm_delayed_mark_completed_not_started); | |
| 1360 | 1 | g_test_add_func ("/ssm/delayed/cancel/error", test_ssm_delayed_cancel_error); | |
| 1361 | 1 | g_test_add_func ("/ssm/subssm/start", test_ssm_subssm_start); | |
| 1362 | 1 | g_test_add_func ("/ssm/subssm/start/with_started", test_ssm_subssm_start_with_started); | |
| 1363 | 1 | g_test_add_func ("/ssm/subssm/start/with_delayed", test_ssm_subssm_start_with_delayed); | |
| 1364 | 1 | g_test_add_func ("/ssm/subssm/mark_failed", test_ssm_subssm_mark_failed); | |
| 1365 | 1 | g_test_add_func ("/ssm/cleanup/complete", test_ssm_cleanup_complete); | |
| 1366 | 1 | g_test_add_func ("/ssm/cleanup/fail", test_ssm_cleanup_fail); | |
| 1367 | |||
| 1368 |
1/2✓ Branch 0 (49→50) taken 1 times.
✗ Branch 1 (49→51) not taken.
|
1 | return g_test_run (); |
| 1369 | } | ||
| 1370 |