pw_kvs: Set KVS test to use any flash partition

Break out EmptyInitializedKvs to a seperate file and setup to use a
flash partition that is give by a getter method. The getter is defined
seperatly to allow reuse of the test file in other tests.

Add several test flash partitions and setup KVS and flash tests to use
them.

Change-Id: I8e28d71b3528b471c79518e658cb30c33d2b30c6
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13620
Commit-Queue: David Rogers <davidrogers@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_kvs/BUILD b/pw_kvs/BUILD
index dcf7f66..ac6038e 100644
--- a/pw_kvs/BUILD
+++ b/pw_kvs/BUILD
@@ -94,21 +94,50 @@
 )
 
 pw_cc_library(
-    name = "flash_partition_test",
+    name = "fake_flash_small_partition",
     srcs = [
-        "flash_partition_test.cc",
+        "fake_flash_test_partition.cc",
     ],
     hdrs = [
-        "public/pw_kvs/flash_partition_test.h",
+        "public/pw_kvs/flash_test_partition.h",
     ],
     deps = [
         ":pw_kvs",
-        "//pw_log",
-        "//pw_span",
+        ":fake_flash",
     ],
 )
 
 pw_cc_library(
+    name = "fake_flash_64_aligned_partition",
+    srcs = [
+        "fake_flash_test_partition.cc",
+    ],
+    hdrs = [
+        "public/pw_kvs/flash_test_partition.h",
+    ],
+    deps = [
+        ":pw_kvs",
+        ":fake_flash",
+    ],
+  defines = [ "PW_FLASH_TEST_ALIGNMENT=64" ],
+)
+
+pw_cc_library(
+    name = "fake_flash_256_aligned_partition",
+    srcs = [
+        "fake_flash_test_partition.cc",
+    ],
+    hdrs = [
+        "public/pw_kvs/flash_test_partition.h",
+    ],
+    deps = [
+        ":pw_kvs",
+        ":fake_flash",
+    ],
+  defines = [ "PW_FLASH_TEST_ALIGNMENT=256" ],
+)
+
+pw_cc_library(
     name = "test_utils",
     hdrs = [
         "pw_kvs_private/byte_utils.h",
@@ -186,14 +215,39 @@
 )
 
 pw_cc_test(
-    name = "fake_flash_partition_test",
-    srcs = ["fake_flash_partition_test.cc"],
+    name = "flash_partition_small_test",
+    srcs = ["flash_partition_test.cc"],
     deps = [
         ":pw_kvs",
-        ":flash_partition_test",
+        ":fake_flash_small_partition",
         "//pw_log:backend",
         "//pw_unit_test",
     ],
+    defines = [ "PW_FLASH_TEST_ITERATIONS=100" ],
+)
+
+pw_cc_test(
+    name = "flash_partition_64_alignment_test",
+    srcs = ["flash_partition_test.cc"],
+    deps = [
+        ":pw_kvs",
+        ":fake_flash_64_aligned_partition",
+        "//pw_log:backend",
+        "//pw_unit_test",
+    ],
+    defines = [ "PW_FLASH_TEST_ITERATIONS=100" ],
+)
+
+pw_cc_test(
+    name = "flash_partition_256_alignment_test",
+    srcs = ["flash_partition_test.cc"],
+    deps = [
+        ":pw_kvs",
+        ":fake_flash_256_aligned_partition",
+        "//pw_log:backend",
+        "//pw_unit_test",
+    ],
+    defines = [ "PW_FLASH_TEST_ITERATIONS=100" ],
 )
 
 pw_cc_test(
@@ -214,6 +268,60 @@
 )
 
 pw_cc_test(
+    name = "key_value_store_small_flash_test",
+    srcs = ["key_value_store_initialized_test.cc"],
+    deps = [
+        ":crc16",
+        ":pw_kvs",
+        ":fake_flash_small_partition",
+        ":test_utils",
+        "//pw_checksum",
+        "//pw_log:backend",
+        "//pw_log:facade",
+        "//pw_span",
+        "//pw_status",
+        "//pw_string",
+        "//pw_unit_test",
+    ],
+)
+
+pw_cc_test(
+    name = "key_value_store_64_alignment_flash_test",
+    srcs = ["key_value_store_initialized_test.cc"],
+    deps = [
+        ":crc16",
+        ":pw_kvs",
+        ":fake_flash_64_aligned_partition",
+        ":test_utils",
+        "//pw_checksum",
+        "//pw_log:backend",
+        "//pw_log:facade",
+        "//pw_span",
+        "//pw_status",
+        "//pw_string",
+        "//pw_unit_test",
+    ],
+)
+
+pw_cc_test(
+    name = "key_value_store_256_alignment_flash_test",
+    srcs = ["key_value_store_initialized_test.cc"],
+    deps = [
+        ":crc16",
+        ":pw_kvs",
+        ":fake_flash_256_aligned_partition",
+        ":test_utils",
+        "//pw_checksum",
+        "//pw_log:backend",
+        "//pw_log:facade",
+        "//pw_span",
+        "//pw_status",
+        "//pw_string",
+        "//pw_unit_test",
+    ],
+)
+
+pw_cc_test(
     name = "key_value_store_binary_format_test",
     srcs = [
         "key_value_store_binary_format_test.cc",