Skip to content

Commit

Permalink
tests: bsim: Use the pre_init_f instead of post_init_f
Browse files Browse the repository at this point in the history
When using the post_init_f to initialize the `bst_result`,
it is not possible to mark the test as
passed immediately as the `bst_result` will be
initialized after the test completes.

This change should overcome this limitation.

Bluetooth mesh tests are kept as is as we are not
sure if this will change the behavior.

(cherry picked from commit 1aa33fe)

Original-Signed-off-by: Rubin Gerritsen <rubin.gerritsen@nordicsemi.no>
GitOrigin-RevId: 1aa33fe
Change-Id: I7ed5a0bd08f9d8b4583e3bf4ce85bf01544b8fa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5585169
Commit-Queue: Tristan Honscheid <honscheid@google.com>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Tristan Honscheid <honscheid@google.com>
  • Loading branch information
rugeGerritsen authored and Chromeos LUCI committed May 30, 2024
1 parent 5a7adbb commit 06e029f
Show file tree
Hide file tree
Showing 107 changed files with 237 additions and 237 deletions.
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/audio/src/bap_bass_broadcaster_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void test_main(void)
static const struct bst_test_instance test_bass_broadcaster[] = {
{
.test_id = "bass_broadcaster",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
},
Expand Down
6 changes: 3 additions & 3 deletions tests/bsim/bluetooth/audio/src/bap_broadcast_assistant_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,19 +622,19 @@ static void test_main_server_sync_server_rem(void)
static const struct bst_test_instance test_bass[] = {
{
.test_id = "bap_broadcast_assistant_client_sync",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_client_sync,
},
{
.test_id = "bap_broadcast_assistant_server_sync_client_rem",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_server_sync_client_rem,
},
{
.test_id = "bap_broadcast_assistant_server_sync_server_rem",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_server_sync_server_rem,
},
Expand Down
6 changes: 3 additions & 3 deletions tests/bsim/bluetooth/audio/src/bap_broadcast_sink_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,19 +1041,19 @@ static void broadcast_sink_with_assistant(void)
static const struct bst_test_instance test_broadcast_sink[] = {
{
.test_id = "broadcast_sink",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
},
{
.test_id = "broadcast_sink_disconnect",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_sink_disconnect,
},
{
.test_id = "broadcast_sink_with_assistant",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = broadcast_sink_with_assistant,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/audio/src/bap_broadcast_source_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ static void test_main(void)
static const struct bst_test_instance test_broadcast_source[] = {
{
.test_id = "broadcast_source",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main
},
Expand Down
6 changes: 3 additions & 3 deletions tests/bsim/bluetooth/audio/src/bap_scan_delegator_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -808,19 +808,19 @@ static void test_main_server_sync_server_rem(void)
static const struct bst_test_instance test_scan_delegator[] = {
{
.test_id = "bap_scan_delegator_client_sync",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_client_sync,
},
{
.test_id = "bap_scan_delegator_server_sync_client_rem",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_server_sync_client_rem,
},
{
.test_id = "bap_scan_delegator_server_sync_server_rem",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_server_sync_server_rem,
},
Expand Down
4 changes: 2 additions & 2 deletions tests/bsim/bluetooth/audio/src/bap_unicast_client_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1129,13 +1129,13 @@ static void test_main_acl_disconnect(void)
static const struct bst_test_instance test_unicast_client[] = {
{
.test_id = "unicast_client",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
},
{
.test_id = "unicast_client_acl_disconnect",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_acl_disconnect,
},
Expand Down
4 changes: 2 additions & 2 deletions tests/bsim/bluetooth/audio/src/bap_unicast_server_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,13 @@ static void test_main_acl_disconnect(void)
static const struct bst_test_instance test_unicast_server[] = {
{
.test_id = "unicast_server",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
},
{
.test_id = "unicast_server_acl_disconnect",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_acl_disconnect,
},
Expand Down
8 changes: 4 additions & 4 deletions tests/bsim/bluetooth/audio/src/cap_acceptor_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -889,25 +889,25 @@ static void test_cap_acceptor_capture_and_render(void)
static const struct bst_test_instance test_cap_acceptor[] = {
{
.test_id = "cap_acceptor_unicast",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_acceptor_unicast,
},
{
.test_id = "cap_acceptor_unicast_timeout",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_acceptor_unicast_timeout,
},
{
.test_id = "cap_acceptor_broadcast",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_acceptor_broadcast,
},
{
.test_id = "cap_acceptor_capture_and_render",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_acceptor_capture_and_render,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/audio/src/cap_commander_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ static void test_main_cap_commander_capture_and_render(void)
static const struct bst_test_instance test_cap_commander[] = {
{
.test_id = "cap_commander_capture_and_render",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_cap_commander_capture_and_render,
},
Expand Down
8 changes: 4 additions & 4 deletions tests/bsim/bluetooth/audio/src/cap_initiator_broadcast_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,29 +841,29 @@ static void test_args(int argc, char *argv[])
static const struct bst_test_instance test_cap_initiator_broadcast[] = {
{
.test_id = "cap_initiator_broadcast",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_cap_initiator_broadcast,
},
{
.test_id = "cap_initiator_ac_12",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_12,
.test_args_f = test_args,
},
#if BROADCAST_STREMT_CNT >= CAP_AC_MAX_STREAM
{
.test_id = "cap_initiator_ac_13",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_13,
.test_args_f = test_args,
},
#endif /* BROADCAST_STREMT_CNT >= CAP_AC_MAX_STREAM */
{
.test_id = "cap_initiator_ac_14",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_14,
.test_args_f = test_args,
Expand Down
38 changes: 19 additions & 19 deletions tests/bsim/bluetooth/audio/src/cap_initiator_unicast_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1632,130 +1632,130 @@ static void test_args(int argc, char *argv[])
static const struct bst_test_instance test_cap_initiator_unicast[] = {
{
.test_id = "cap_initiator_unicast",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_cap_initiator_unicast,
},
{
.test_id = "cap_initiator_unicast_timeout",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_unicast_timeout,
},
{
.test_id = "cap_initiator_unicast_inval",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main_cap_initiator_unicast_inval,
},
{
.test_id = "cap_initiator_ac_1",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_1,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_2",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_2,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_3",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_3,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_4",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_4,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_5",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_5,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_6_i",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_6_i,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_6_ii",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_6_ii,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_7_i",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_7_i,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_7_ii",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_7_ii,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_8_i",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_8_i,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_8_ii",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_8_ii,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_9_i",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_9_i,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_9_ii",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_9_ii,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_10",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_10,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_11_i",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_11_i,
.test_args_f = test_args,
},
{
.test_id = "cap_initiator_ac_11_ii",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_cap_initiator_ac_11_ii,
.test_args_f = test_args,
Expand Down
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/audio/src/csip_notify_client_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static void test_main(void)
static const struct bst_test_instance test_csip_notify_client[] = {
{
.test_id = "csip_notify_client",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
},
Expand Down
2 changes: 1 addition & 1 deletion tests/bsim/bluetooth/audio/src/csip_notify_server_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static void test_main(void)
static const struct bst_test_instance test_csip_notify_server[] = {
{
.test_id = "csip_notify_server",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
},
Expand Down
4 changes: 2 additions & 2 deletions tests/bsim/bluetooth/audio/src/csip_set_coordinator_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,14 @@ static void test_args(int argc, char *argv[])
static const struct bst_test_instance test_connect[] = {
{
.test_id = "csip_set_coordinator",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_main,
.test_args_f = test_args,
},
{
.test_id = "csip_set_coordinator_new_sirk",
.test_post_init_f = test_init,
.test_pre_init_f = test_init,
.test_tick_f = test_tick,
.test_main_f = test_new_sirk,
.test_args_f = test_args,
Expand Down
Loading

0 comments on commit 06e029f

Please sign in to comment.