test: Move tests to a separate Makefile fragment
Change-Id: I46d5b165ed668ace67ae237b16d65a24586dd87d
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/Makefile.am b/Makefile.am
index f182f1a..b1d86aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,183 +34,6 @@
@CODE_COVERAGE_RULES@
-AM_LIBS = $(CODE_COVERAGE_LIBS)
-AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
-AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
-AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS)
-
-test_sanity_SOURCES = test/sanity.c
-
-test_copy_flash_SOURCES = \
- test/copy_flash.c \
- mboxd_flash_physical.c \
- common.c mtd.c \
- test/tmpf.c
-
-test_erase_flash_SOURCES = \
- test/erase_flash.c \
- mboxd_flash_physical.c \
- common.c \
- test/tmpf.c
-
-test_write_flash_SOURCES = \
- test/write_flash.c \
- mboxd_flash_physical.c \
- common.c \
- test/tmpf.c
-
-TEST_MBOX_SRCS = \
- mboxd_msg.c \
- mboxd_windows.c \
- mboxd_lpc.c \
- mboxd_lpc_physical.c \
- common.c \
- mboxd_flash_physical.c
-
-TEST_MOCK_SRCS = test/tmpf.c test/mbox.c test/system.c
-
-test_get_mbox_info_v2_SOURCES = test/get_mbox_info_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_reset_state_SOURCES = test/reset_state.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_get_flash_info_v2_SOURCES = test/get_flash_info_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_create_read_window_v2_SOURCES = test/create_read_window_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_create_write_window_v2_SOURCES = test/create_write_window_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_close_window_v2_SOURCES = test/close_window_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_mark_write_dirty_v2_SOURCES = test/mark_write_dirty_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_write_flush_v2_SOURCES = test/write_flush_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_mark_write_erased_v2_SOURCES = test/mark_write_erased_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_bmc_event_ack_v2_SOURCES = test/bmc_event_ack_v2.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_create_oversize_window_SOURCES = test/create_oversize_window.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_create_zero_size_window_SOURCES = test/create_zero_size_window.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_implicit_flush_SOURCES = test/implicit_flush.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_request_high_version_SOURCES = test/request_high_version.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_request_low_version_SOURCES = test/request_low_version.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_mark_read_dirty_SOURCES = test/mark_read_dirty.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_read_window_write_flush_SOURCES = test/read_window_write_flush.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_read_window_mark_write_erased_SOURCES = test/read_window_mark_write_erased.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_write_window_dirty_erase_SOURCES = test/write_window_dirty_erase.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_invalid_command_SOURCES = test/invalid_command.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_read_window_cycle_SOURCES = test/read_window_cycle.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_sequence_numbers_SOURCES = test/sequence_numbers.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-test_get_mbox_info_v2_timeout_SOURCES = test/get_mbox_info_v2_timeout.c \
- $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
-
-TEST_MBOX_VPNOR_SRCS = common.c pnor_partition_table.cpp
-
-test_create_pnor_partition_table_SOURCES = \
- $(TEST_MBOX_VPNOR_SRCS) \
- test/create_pnor_partition_table.cpp
-test_create_pnor_partition_table_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
-test_create_pnor_partition_table_LDADD = -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS)
-
-test_create_read_window_vpnor_SOURCES = \
- $(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
- mboxd_msg.c \
- mboxd_windows.c \
- mboxd_lpc.c \
- mboxd_lpc_virtual.cpp \
- mboxd_pnor_partition_table.cpp \
- mboxd_flash_virtual.cpp \
- pnor_partition.cpp \
- test/create_read_window_vpnor.cpp
-test_create_read_window_vpnor_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
-test_create_read_window_vpnor_LDADD = -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS)
-
-test_write_flash_vpnor_SOURCES = \
- $(TEST_MBOX_VPNOR_SRCS) \
- mboxd_pnor_partition_table.cpp \
- mboxd_flash_virtual.cpp \
- mtd.c \
- pnor_partition.cpp \
- test/write_flash_vpnor.cpp
-test_write_flash_vpnor_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
-test_write_flash_vpnor_LDADD = -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(PHOSPHOR_DBUS_INTERFACES_LIBS)
-
-check_PROGRAMS = test/sanity \
- test/copy_flash \
- test/erase_flash \
- test/write_flash \
- test/get_mbox_info_v2 \
- test/reset_state \
- test/get_flash_info_v2 \
- test/create_read_window_v2 \
- test/create_write_window_v2 \
- test/close_window_v2 \
- test/mark_write_dirty_v2 \
- test/write_flush_v2 \
- test/mark_write_erased_v2 \
- test/bmc_event_ack_v2 \
- test/create_oversize_window \
- test/create_zero_size_window \
- test/implicit_flush \
- test/request_high_version \
- test/request_low_version \
- test/mark_read_dirty \
- test/read_window_write_flush \
- test/read_window_mark_write_erased \
- test/write_window_dirty_erase \
- test/invalid_command \
- test/read_window_cycle \
- test/sequence_numbers \
- test/get_mbox_info_v2_timeout
-
-if VIRTUAL_PNOR_ENABLED
-check_PROGRAMS += \
- test/create_pnor_partition_table \
- test/create_read_window_vpnor \
- test/write_flash_vpnor
-endif
+include test/Makefile.am.include
TESTS = $(check_PROGRAMS)
diff --git a/test/Makefile.am.include b/test/Makefile.am.include
new file mode 100644
index 0000000..045421d
--- /dev/null
+++ b/test/Makefile.am.include
@@ -0,0 +1,178 @@
+AM_LIBS = $(CODE_COVERAGE_LIBS)
+AM_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
+AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
+AM_CXXFLAGS = $(CODE_COVERAGE_CXXFLAGS)
+
+test_sanity_SOURCES = %reldir%/sanity.c
+
+test_copy_flash_SOURCES = \
+ %reldir%/copy_flash.c \
+ mboxd_flash_physical.c \
+ common.c mtd.c \
+ %reldir%/tmpf.c
+
+test_erase_flash_SOURCES = \
+ %reldir%/erase_flash.c \
+ mboxd_flash_physical.c \
+ common.c \
+ %reldir%/tmpf.c
+
+test_write_flash_SOURCES = \
+ %reldir%/write_flash.c \
+ mboxd_flash_physical.c \
+ common.c \
+ %reldir%/tmpf.c
+
+TEST_MBOX_SRCS = \
+ mboxd_msg.c \
+ mboxd_windows.c \
+ mboxd_lpc.c \
+ mboxd_lpc_physical.c \
+ common.c \
+ mboxd_flash_physical.c
+
+TEST_MOCK_SRCS = %reldir%/tmpf.c %reldir%/mbox.c %reldir%/system.c
+
+test_get_mbox_info_v2_SOURCES = %reldir%/get_mbox_info_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_reset_state_SOURCES = %reldir%/reset_state.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_get_flash_info_v2_SOURCES = %reldir%/get_flash_info_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_create_read_window_v2_SOURCES = %reldir%/create_read_window_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_create_write_window_v2_SOURCES = %reldir%/create_write_window_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_close_window_v2_SOURCES = %reldir%/close_window_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_mark_write_dirty_v2_SOURCES = %reldir%/mark_write_dirty_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_write_flush_v2_SOURCES = %reldir%/write_flush_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_mark_write_erased_v2_SOURCES = %reldir%/mark_write_erased_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_bmc_event_ack_v2_SOURCES = %reldir%/bmc_event_ack_v2.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_create_oversize_window_SOURCES = %reldir%/create_oversize_window.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_create_zero_size_window_SOURCES = %reldir%/create_zero_size_window.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_implicit_flush_SOURCES = %reldir%/implicit_flush.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_request_high_version_SOURCES = %reldir%/request_high_version.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_request_low_version_SOURCES = %reldir%/request_low_version.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_mark_read_dirty_SOURCES = %reldir%/mark_read_dirty.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_read_window_write_flush_SOURCES = %reldir%/read_window_write_flush.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_read_window_mark_write_erased_SOURCES = %reldir%/read_window_mark_write_erased.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_write_window_dirty_erase_SOURCES = %reldir%/write_window_dirty_erase.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_invalid_command_SOURCES = %reldir%/invalid_command.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_read_window_cycle_SOURCES = %reldir%/read_window_cycle.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_sequence_numbers_SOURCES = %reldir%/sequence_numbers.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+test_get_mbox_info_v2_timeout_SOURCES = %reldir%/get_mbox_info_v2_timeout.c \
+ $(TEST_MBOX_SRCS) $(TEST_MOCK_SRCS)
+
+TEST_MBOX_VPNOR_SRCS = common.c pnor_partition_table.cpp
+
+test_create_pnor_partition_table_SOURCES = \
+ $(TEST_MBOX_VPNOR_SRCS) \
+ %reldir%/create_pnor_partition_table.cpp
+test_create_pnor_partition_table_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
+test_create_pnor_partition_table_LDADD = -lstdc++fs \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+
+test_create_read_window_vpnor_SOURCES = \
+ $(TEST_MBOX_VPNOR_SRCS) $(TEST_MOCK_SRCS) \
+ mboxd_msg.c \
+ mboxd_windows.c \
+ mboxd_lpc.c \
+ mboxd_lpc_virtual.cpp \
+ mboxd_pnor_partition_table.cpp \
+ mboxd_flash_virtual.cpp \
+ pnor_partition.cpp \
+ %reldir%/create_read_window_vpnor.cpp
+test_create_read_window_vpnor_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
+test_create_read_window_vpnor_LDADD = -lstdc++fs \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+
+test_write_flash_vpnor_SOURCES = \
+ $(TEST_MBOX_VPNOR_SRCS) \
+ mboxd_pnor_partition_table.cpp \
+ mboxd_flash_virtual.cpp \
+ mtd.c \
+ pnor_partition.cpp \
+ %reldir%/write_flash_vpnor.cpp
+test_write_flash_vpnor_LDFLAGS = $(OESDK_TESTCASE_FLAGS)
+test_write_flash_vpnor_LDADD = -lstdc++fs \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+
+check_PROGRAMS = %reldir%/sanity \
+ %reldir%/copy_flash \
+ %reldir%/erase_flash \
+ %reldir%/write_flash \
+ %reldir%/get_mbox_info_v2 \
+ %reldir%/reset_state \
+ %reldir%/get_flash_info_v2 \
+ %reldir%/create_read_window_v2 \
+ %reldir%/create_write_window_v2 \
+ %reldir%/close_window_v2 \
+ %reldir%/mark_write_dirty_v2 \
+ %reldir%/write_flush_v2 \
+ %reldir%/mark_write_erased_v2 \
+ %reldir%/bmc_event_ack_v2 \
+ %reldir%/create_oversize_window \
+ %reldir%/create_zero_size_window \
+ %reldir%/implicit_flush \
+ %reldir%/request_high_version \
+ %reldir%/request_low_version \
+ %reldir%/mark_read_dirty \
+ %reldir%/read_window_write_flush \
+ %reldir%/read_window_mark_write_erased \
+ %reldir%/write_window_dirty_erase \
+ %reldir%/invalid_command \
+ %reldir%/read_window_cycle \
+ %reldir%/sequence_numbers \
+ %reldir%/get_mbox_info_v2_timeout
+
+if VIRTUAL_PNOR_ENABLED
+check_PROGRAMS += \
+ %reldir%/create_pnor_partition_table \
+ %reldir%/create_read_window_vpnor \
+ %reldir%/write_flash_vpnor
+endif