Re-enabling unit tests for EFR32 which had been disabled due to flash limitations (#35456)

* Removed as many efr32 checks as possible without having to make code modifications

* Updated comments to show error message

* Restyled by clang-format

* Comment updates

* ci testing 1

* Re-added suites

* .

* .

* comment icd tests

* removed 5 tests from line 112

* re-enable app/tests in the main tests group

* reverted to original (with inconsequential mods)

* (addendum) Now actually reverted back to original state (with inconsequential mods)

* moved 4 dirs up into the main tests lists

* enabled 3-test-set for efr32

* moved tracing tests out of the if

* enable platform tests for efr32

* enabled controller and datamodel tests but not the stuff in controller

* enabled all tests in controller

* add transport tests back in

* enabled data_model Test[Commands,Read,Write]

* commands is in, read/write is out

* added TestRead

* Added TestWrite, removed TestRead

* src/app/tests remains disabled

* changed c-style cast to static_cast

* Added TestTLVVectorWriter.cpp back in

* comment update

* restyle fixes

* restyle fixes

---------

Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/BUILD.gn b/src/BUILD.gn
index e700251..722e0c8 100644
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -50,21 +50,25 @@
   chip_test_group("tests") {
     deps = []
     tests = [
+      "${chip_root}/src/access/tests",
       "${chip_root}/src/app/data-model/tests",
       "${chip_root}/src/app/cluster-building-blocks/tests",
       "${chip_root}/src/app/data-model-provider/tests",
-      "${chip_root}/src/access/tests",
+      "${chip_root}/src/app/icd/server/tests",
       "${chip_root}/src/crypto/tests",
       "${chip_root}/src/inet/tests",
       "${chip_root}/src/lib/address_resolve/tests",
       "${chip_root}/src/lib/asn1/tests",
       "${chip_root}/src/lib/core/tests",
+      "${chip_root}/src/lib/format/tests",
       "${chip_root}/src/messaging/tests",
       "${chip_root}/src/protocols/bdx/tests",
       "${chip_root}/src/protocols/interaction_model/tests",
+      "${chip_root}/src/protocols/secure_channel/tests",
       "${chip_root}/src/protocols/user_directed_commissioning/tests",
+      "${chip_root}/src/system/tests",
       "${chip_root}/src/transport/retransmit/tests",
-      "${chip_root}/src/app/icd/server/tests",
+      "${chip_root}/src/transport/tests",
     ]
 
     # Skip DNSSD tests for Mbed platform due to flash memory size limitations
@@ -81,14 +85,12 @@
       tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/records/tests" ]
     }
 
-    if (current_os != "zephyr" && current_os != "mbed" &&
-        chip_device_platform != "efr32") {
+    if (current_os != "zephyr" && current_os != "mbed") {
       # Avoid these items from "one single binary" test executions. Once tests
-      # are split, we can re-visit this (and likely many others)
+      # are split, we can re-visit this (and likely many others).
       #
-      # In particular:
-      #   "app/codegen-data-model-provider/tests" contains symbols for ember mocks which
-      #                                  are used by other tests
+      # In particular: "app/codegen-data-model-provider/tests" contains
+      # symbols for ember mocks which are used by other tests.
 
       tests += [
         "${chip_root}/src/app/codegen-data-model-provider/tests",
@@ -97,30 +99,27 @@
       ]
     }
 
-    # Skip on efr32 due to flash and/or ram limitations.
     if (chip_device_platform != "efr32") {
-      tests += [
-        "${chip_root}/src/app/tests",
-        "${chip_root}/src/credentials/tests",
-        "${chip_root}/src/lib/format/tests",
-        "${chip_root}/src/lib/support/tests",
-        "${chip_root}/src/protocols/secure_channel/tests",
-        "${chip_root}/src/system/tests",
-        "${chip_root}/src/transport/tests",
-      ]
+      tests += [ "${chip_root}/src/app/tests" ]
 
-      if (matter_enable_tracing_support &&
-          matter_trace_config == "${chip_root}/src/tracing/multiplexed") {
-        tests += [ "${chip_root}/src/tracing/tests" ]
-      }
+      # Disabled for EFR32 because _open is not implemented.
+      # https://github.com/project-chip/connectedhomeip/issues/35624
+      tests += [
+        "${chip_root}/src/credentials/tests",
+        "${chip_root}/src/lib/support/tests",
+      ]
+    }
+
+    if (matter_enable_tracing_support &&
+        matter_trace_config == "${chip_root}/src/tracing/multiplexed") {
+      tests += [ "${chip_root}/src/tracing/tests" ]
     }
 
     if (chip_device_platform != "none") {
       tests += [ "${chip_root}/src/lib/dnssd/minimal_mdns/tests" ]
     }
 
-    if (chip_device_platform != "esp32" && chip_device_platform != "efr32" &&
-        chip_device_platform != "ameba") {
+    if (chip_device_platform != "esp32" && chip_device_platform != "ameba") {
       tests += [ "${chip_root}/src/platform/tests" ]
     }
 
@@ -130,9 +129,7 @@
 
     # On nrfconnect, the controller tests run into
     # https://github.com/project-chip/connectedhomeip/issues/9630
-    if (chip_device_platform != "nrfconnect" &&
-        chip_device_platform != "efr32") {
-      # Doesn't compile on ef32. Multiple definitions issues with attribute storage and overflows flash memory.
+    if (chip_device_platform != "nrfconnect") {
       tests += [ "${chip_root}/src/controller/tests/data_model" ]
 
       # Skip controller test for Open IoT SDK
diff --git a/src/controller/tests/BUILD.gn b/src/controller/tests/BUILD.gn
index a1d7b94..a7389c5 100644
--- a/src/controller/tests/BUILD.gn
+++ b/src/controller/tests/BUILD.gn
@@ -21,17 +21,27 @@
 chip_test_suite("tests") {
   output_name = "libControllerTests"
 
-  test_sources = [ "TestCommissionableNodeController.cpp" ]
+  test_sources = []
 
-  if (chip_device_platform != "mbed" && chip_device_platform != "efr32" &&
-      chip_device_platform != "esp32") {
-    test_sources += [ "TestServerCommandDispatch.cpp" ]
-    test_sources += [ "TestEventChunking.cpp" ]
-    test_sources += [ "TestEventCaching.cpp" ]
-    test_sources += [ "TestReadChunking.cpp" ]
-    test_sources += [ "TestWriteChunking.cpp" ]
-    test_sources += [ "TestEventNumberCaching.cpp" ]
-    test_sources += [ "TestCommissioningWindowOpener.cpp" ]
+  # Not supported on efr32.
+  if (chip_device_platform != "efr32") {
+    test_sources += [ "TestCommissionableNodeController.cpp" ]
+  }
+
+  if (chip_device_platform != "mbed" && chip_device_platform != "esp32") {
+    test_sources += [
+      "TestEventCaching.cpp",
+      "TestEventChunking.cpp",
+      "TestEventNumberCaching.cpp",
+      "TestReadChunking.cpp",
+      "TestServerCommandDispatch.cpp",
+      "TestWriteChunking.cpp",
+    ]
+
+    # Not supported on efr32.
+    if (chip_device_platform != "efr32") {
+      test_sources += [ "TestCommissioningWindowOpener.cpp" ]
+    }
   }
 
   cflags = [ "-Wconversion" ]
diff --git a/src/controller/tests/TestReadChunking.cpp b/src/controller/tests/TestReadChunking.cpp
index 4f2251b..989d910 100644
--- a/src/controller/tests/TestReadChunking.cpp
+++ b/src/controller/tests/TestReadChunking.cpp
@@ -576,7 +576,7 @@
     {
         TestReadCallback readCallback;
 
-        ChipLogDetail(DataManagement, "Running iteration %d\n", packetSize);
+        ChipLogDetail(DataManagement, "Running iteration %d\n", static_cast<int>(packetSize));
 
         gIterationCount = packetSize;
 
diff --git a/src/controller/tests/TestWriteChunking.cpp b/src/controller/tests/TestWriteChunking.cpp
index 5bb7ef9..4efc098 100644
--- a/src/controller/tests/TestWriteChunking.cpp
+++ b/src/controller/tests/TestWriteChunking.cpp
@@ -231,7 +231,7 @@
         CHIP_ERROR err = CHIP_NO_ERROR;
         TestWriteCallback writeCallback;
 
-        ChipLogDetail(DataManagement, "Running iteration %d\n", i);
+        ChipLogDetail(DataManagement, "Running iteration %d\n", static_cast<int>(i));
 
         gIterationCount = i;
 
diff --git a/src/controller/tests/data_model/BUILD.gn b/src/controller/tests/data_model/BUILD.gn
index 9bf2eac..ca0f8a3 100644
--- a/src/controller/tests/data_model/BUILD.gn
+++ b/src/controller/tests/data_model/BUILD.gn
@@ -29,13 +29,15 @@
   ]
 
   test_sources = []
-  if (chip_device_platform != "mbed" && chip_device_platform != "efr32" &&
-      chip_device_platform != "esp32" && chip_device_platform != "fake") {
+  if (chip_device_platform != "mbed" && chip_device_platform != "esp32" &&
+      chip_device_platform != "fake") {
     test_sources += [
       "TestCommands.cpp",
-      "TestRead.cpp",
       "TestWrite.cpp",
     ]
+    if (chip_device_platform != "efr32") {
+      test_sources += [ "TestRead.cpp" ]
+    }
   }
 
   public_deps = [
diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn
index 264de2c..fd00915 100644
--- a/src/lib/core/tests/BUILD.gn
+++ b/src/lib/core/tests/BUILD.gn
@@ -31,14 +31,9 @@
     "TestOptional.cpp",
     "TestReferenceCounted.cpp",
     "TestTLV.cpp",
+    "TestTLVVectorWriter.cpp",
   ]
 
-  # requires large amount of heap for multiple unfragmented 10k buffers
-  # skip for efr32 to allow flash space for other tests
-  if (chip_device_platform != "efr32") {
-    test_sources += [ "TestTLVVectorWriter.cpp" ]
-  }
-
   cflags = [ "-Wconversion" ]
 
   public_deps = [
diff --git a/src/transport/tests/BUILD.gn b/src/transport/tests/BUILD.gn
index f0be95f..3736f8b 100644
--- a/src/transport/tests/BUILD.gn
+++ b/src/transport/tests/BUILD.gn
@@ -44,9 +44,8 @@
     "TestSessionManagerDispatch.cpp",
   ]
 
-  if (chip_device_platform != "mbed" && chip_device_platform != "efr32" &&
-      chip_device_platform != "esp32" && chip_device_platform != "nrfconnect" &&
-      chip_device_platform != "nxp") {
+  if (chip_device_platform != "mbed" && chip_device_platform != "esp32" &&
+      chip_device_platform != "nrfconnect" && chip_device_platform != "nxp") {
     test_sources += [ "TestSecureSessionTable.cpp" ]
   }