Skip to content

Commit 24edc6b

Browse files
committed
Merge pull request #1091 from pguyot/w09/fix-esp32-networking-test-isolation
Fix isolation of esp32 networking tests Move assert of result of erlang test code after tearing down networking. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 168d236 + 671393e commit 24edc6b

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/platforms/esp32/test/main/test_main.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static esp_netif_t *eth_start(void)
9090
.stack = ESP_NETIF_NETSTACK_DEFAULT_ETH
9191
};
9292
esp_netif_t *netif = esp_netif_new(&netif_config);
93-
assert(netif);
93+
TEST_ASSERT(netif != NULL);
9494
free(desc);
9595

9696
eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG();
@@ -208,10 +208,11 @@ TEST_CASE("test_file", "[test_run]")
208208
sdmmc_card_print_info(stdout, card);
209209

210210
term ret_value = avm_test_case("test_file.beam");
211-
TEST_ASSERT(ret_value == OK_ATOM);
212211

213212
esp_vfs_fat_sdcard_unmount(mount_point, card);
214213
ESP_LOGI(TAG, "Card unmounted");
214+
215+
TEST_ASSERT(ret_value == OK_ATOM);
215216
}
216217

217218
TEST_CASE("test_list_to_binary", "[test_run]")
@@ -390,9 +391,10 @@ TEST_CASE("test_select", "[test_run]")
390391
ESP_ERROR_CHECK(esp_vfs_register("/pipe", &pipefs, NULL));
391392

392393
term ret_value = avm_test_case("test_select.beam");
393-
TEST_ASSERT(ret_value == OK_ATOM);
394394

395395
esp_vfs_unregister("/pipe");
396+
397+
TEST_ASSERT(ret_value == OK_ATOM);
396398
}
397399

398400
TEST_CASE("test_time_and_processes", "[test_run]")
@@ -438,10 +440,11 @@ TEST_CASE("test_net", "[test_run]")
438440
}
439441

440442
term ret_value = avm_test_case("test_net.beam");
441-
TEST_ASSERT(ret_value == OK_ATOM);
442443

443444
ESP_LOGI(TAG, "Stopping network\n");
444445
eth_stop(eth_netif);
446+
447+
TEST_ASSERT(ret_value == OK_ATOM);
445448
}
446449

447450
TEST_CASE("test_socket", "[test_run]")
@@ -458,10 +461,11 @@ TEST_CASE("test_socket", "[test_run]")
458461
}
459462

460463
term ret_value = avm_test_case("test_socket.beam");
461-
TEST_ASSERT(term_to_int(ret_value) == 0);
462464

463465
ESP_LOGI(TAG, "Stopping network\n");
464466
eth_stop(eth_netif);
467+
468+
TEST_ASSERT(term_to_int(ret_value) == 0);
465469
}
466470

467471
TEST_CASE("test_ssl", "[test_run]")
@@ -478,10 +482,11 @@ TEST_CASE("test_ssl", "[test_run]")
478482
}
479483

480484
term ret_value = avm_test_case("test_ssl.beam");
481-
TEST_ASSERT(ret_value == OK_ATOM);
482485

483486
ESP_LOGI(TAG, "Stopping network\n");
484487
eth_stop(eth_netif);
488+
489+
TEST_ASSERT(ret_value == OK_ATOM);
485490
}
486491

487492
TEST_CASE("test_rtc_slow", "[test_run]")

0 commit comments

Comments
 (0)