Explorar el Código

nvs: deinit NVS in nvs_stats unit test

This fixes the failure when this test runs after another test which
leaves NVS initialized.
Ivan Grokhotkov hace 7 años
padre
commit
fa3bd16d75
Se han modificado 1 ficheros con 14 adiciones y 7 borrados
  1. 14 7
      components/nvs_flash/test_nvs_host/test_nvs.cpp

+ 14 - 7
components/nvs_flash/test_nvs_host/test_nvs.cpp

@@ -1267,16 +1267,10 @@ TEST_CASE("nvs page selection takes into account free entries also not just eras
     nvs_close(handle);
 }
 
-TEST_CASE("dump all performance data", "[nvs]")
-{
-    std::cout << "====================" << std::endl << "Dumping benchmarks" << std::endl;
-    std::cout << s_perf.str() << std::endl;
-    std::cout << "====================" << std::endl;
-}
-
 TEST_CASE("calculate used and free space", "[nvs]")
 {
     SpiFlashEmulator emu(6);
+    nvs_flash_deinit();
     TEST_ESP_ERR(nvs_get_stats(NULL, NULL), ESP_ERR_INVALID_ARG);
     nvs_stats_t stat1;
     nvs_stats_t stat2;
@@ -1407,3 +1401,16 @@ TEST_CASE("calculate used and free space", "[nvs]")
 
     nvs_close(handle_3);
 }
+
+
+
+
+/* Add new tests above */
+/* This test has to be the final one */
+
+TEST_CASE("dump all performance data", "[nvs]")
+{
+    std::cout << "====================" << std::endl << "Dumping benchmarks" << std::endl;
+    std::cout << s_perf.str() << std::endl;
+    std::cout << "====================" << std::endl;
+}