vboot: remove vboot1 version of ARRAY_SIZE macro

Macro already exists in vboot2-style 2common.h.
Relocate tests accordingly.

BUG=b:124141368
TEST=make clean && make runtests
BRANCH=none

Change-Id: I6b96627a05e8c05ff49b8780fe4472890c2a2043
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1675869
Reviewed-by: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
diff --git a/firmware/lib/include/vboot_common.h b/firmware/lib/include/vboot_common.h
index a3d1851..b01ed3b 100644
--- a/firmware/lib/include/vboot_common.h
+++ b/firmware/lib/include/vboot_common.h
@@ -11,10 +11,6 @@
 #include "2api.h"
 #include "vboot_struct.h"
 
-#ifndef ARRAY_SIZE
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0]))
-#endif
-
 /* Test an important condition at compile time, not run time */
 #ifndef BUILD_ASSERT
 #define _BA1_(cond, line) \
diff --git a/host/lib/crossystem.c b/host/lib/crossystem.c
index 1eb540a..2b13258 100644
--- a/host/lib/crossystem.c
+++ b/host/lib/crossystem.c
@@ -18,6 +18,7 @@
 
 #include "2sysincludes.h"
 #include "2api.h"
+#include "2common.h"
 #include "2nvstorage.h"
 
 #include "host_common.h"
@@ -26,7 +27,6 @@
 #include "crossystem_arch.h"
 #include "crossystem_vbnv.h"
 #include "utility.h"
-#include "vboot_common.h"
 #include "vboot_struct.h"
 
 /* Filename for kernel command line */
diff --git a/tests/vb2_common_tests.c b/tests/vb2_common_tests.c
index 3bb24e3..acc904e 100644
--- a/tests/vb2_common_tests.c
+++ b/tests/vb2_common_tests.c
@@ -11,6 +11,20 @@
 #include "vboot_struct.h"  /* For old struct sizes */
 
 /*
+ * Test array size macro.
+ */
+static void test_array_size(void)
+{
+	uint8_t arr1[12];
+	uint32_t arr2[7];
+	uint64_t arr3[9];
+
+	TEST_EQ(ARRAY_SIZE(arr1), 12, "ARRAYSIZE(uint8_t)");
+	TEST_EQ(ARRAY_SIZE(arr2), 7, "ARRAYSIZE(uint32_t)");
+	TEST_EQ(ARRAY_SIZE(arr3), 9, "ARRAYSIZE(uint64_t)");
+}
+
+/*
  * Test struct packing for vboot_struct.h structs which are passed between
  * firmware and OS, or passed between different phases of firmware.
  */
@@ -218,6 +232,7 @@
 
 int main(int argc, char* argv[])
 {
+	test_array_size();
 	test_struct_packing();
 	test_memcmp();
 	test_align();
diff --git a/tests/vboot_api_kernel4_tests.c b/tests/vboot_api_kernel4_tests.c
index 5d4370c..d2f19fa 100644
--- a/tests/vboot_api_kernel4_tests.c
+++ b/tests/vboot_api_kernel4_tests.c
@@ -11,6 +11,7 @@
 
 #include "2sysincludes.h"
 #include "2api.h"
+#include "2common.h"
 #include "2misc.h"
 #include "2nvstorage.h"
 #include "ec_sync.h"
diff --git a/tests/vboot_common_tests.c b/tests/vboot_common_tests.c
index 04d3261..277a44a 100644
--- a/tests/vboot_common_tests.c
+++ b/tests/vboot_common_tests.c
@@ -40,18 +40,6 @@
 		"sizeof(VbSharedDataHeader) V2");
 }
 
-/* Test array size macro */
-static void ArraySizeTest(void)
-{
-	uint8_t arr1[12];
-	uint32_t arr2[7];
-	uint64_t arr3[9];
-
-	TEST_EQ(ARRAY_SIZE(arr1), 12, "ARRAYSIZE(uint8_t)");
-	TEST_EQ(ARRAY_SIZE(arr2), 7, "ARRAYSIZE(uint32_t)");
-	TEST_EQ(ARRAY_SIZE(arr3), 9, "ARRAYSIZE(uint64_t)");
-}
-
 /* Helper functions not dependent on specific key sizes */
 static void VerifyHelperFunctions(void)
 {
@@ -222,7 +210,6 @@
 int main(int argc, char* argv[])
 {
 	StructPackingTest();
-	ArraySizeTest();
 	VerifyHelperFunctions();
 	PublicKeyTest();
 	VbSharedDataTest();