test: cleanup by moving tool tests into subfolder

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I15b3514d095d9fc770a1b0fe125eb48d96ada2c8
diff --git a/configure.ac b/configure.ac
index 53815f5..8db7aa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,5 +330,5 @@
 )
 
 # Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile cleanup/Makefile cleanup/test/Makefile])
+AC_CONFIG_FILES([Makefile test/Makefile tools/Makefile tools/test/Makefile cleanup/Makefile cleanup/test/Makefile])
 AC_OUTPUT
diff --git a/test/Makefile.am b/test/Makefile.am
index 6a2983f..523d8d5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -41,13 +41,6 @@
 	firmware_state_updatecompleted_unittest \
 	firmware_state_notyetstarted_tarball_unittest
 
-if BUILD_HOST_TOOL
-check_PROGRAMS += \
-	tools_bt_unittest \
-	tools_lpc_unittest \
-	tools_updater_unittest
-endif
-
 TESTS = $(check_PROGRAMS)
 
 firmware_createhandler_unittest_SOURCES = firmware_createhandler_unittest.cpp
@@ -106,14 +99,3 @@
 
 firmware_state_notyetstarted_tarball_unittest_SOURCES = firmware_state_notyetstarted_tarball_unittest.cpp
 firmware_state_notyetstarted_tarball_unittest_LDADD = $(top_builddir)/libfirmwareblob_common.la
-
-if BUILD_HOST_TOOL
-tools_bt_unittest_SOURCES = tools_bt_unittest.cpp
-tools_bt_unittest_LDADD = $(top_builddir)/tools/libupdater.la
-
-tools_lpc_unittest_SOURCES = tools_lpc_unittest.cpp
-tools_lpc_unittest_LDADD = $(top_builddir)/tools/libupdater.la
-
-tools_updater_unittest_SOURCES = tools_updater_unittest.cpp
-tools_updater_unittest_LDADD = $(top_builddir)/tools/libupdater.la
-endif
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f8879b0..c85ffeb 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -16,3 +16,5 @@
 	pci.cpp \
 	p2a.cpp \
 	$(top_srcdir)/internal/sys.cpp
+
+SUBDIRS = . test
diff --git a/tools/test/Makefile.am b/tools/test/Makefile.am
new file mode 100644
index 0000000..26de6c5
--- /dev/null
+++ b/tools/test/Makefile.am
@@ -0,0 +1,32 @@
+@VALGRIND_CHECK_RULES@
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/ \
+	-I$(top_srcdir)/tools/ \
+	$(GTEST_CFLAGS) \
+	$(GMOCK_CFLAGS) \
+	$(CODE_COVERAGE_CPPFLAGS)
+AM_CXXFLAGS = \
+	$(CODE_COVERAGE_CXXFLAGS)
+AM_LDFLAGS = \
+	$(GTEST_LIBS) \
+	$(GMOCK_LIBS) \
+	-lgmock_main \
+	$(OESDK_TESTCASE_FLAGS) \
+	$(CODE_COVERAGE_LIBS)
+
+check_PROGRAMS = \
+	tools_bt_unittest \
+	tools_lpc_unittest \
+	tools_updater_unittest
+
+TESTS = $(check_PROGRAMS)
+
+tools_bt_unittest_SOURCES = tools_bt_unittest.cpp
+tools_bt_unittest_LDADD = $(top_builddir)/tools/libupdater.la
+
+tools_lpc_unittest_SOURCES = tools_lpc_unittest.cpp
+tools_lpc_unittest_LDADD = $(top_builddir)/tools/libupdater.la
+
+tools_updater_unittest_SOURCES = tools_updater_unittest.cpp
+tools_updater_unittest_LDADD = $(top_builddir)/tools/libupdater.la
diff --git a/test/data_interface_mock.hpp b/tools/test/data_interface_mock.hpp
similarity index 100%
rename from test/data_interface_mock.hpp
rename to tools/test/data_interface_mock.hpp
diff --git a/test/internal_sys_mock.hpp b/tools/test/internal_sys_mock.hpp
similarity index 100%
rename from test/internal_sys_mock.hpp
rename to tools/test/internal_sys_mock.hpp
diff --git a/test/io_mock.hpp b/tools/test/io_mock.hpp
similarity index 100%
rename from test/io_mock.hpp
rename to tools/test/io_mock.hpp
diff --git a/test/tools_bt_unittest.cpp b/tools/test/tools_bt_unittest.cpp
similarity index 100%
rename from test/tools_bt_unittest.cpp
rename to tools/test/tools_bt_unittest.cpp
diff --git a/test/tools_lpc_unittest.cpp b/tools/test/tools_lpc_unittest.cpp
similarity index 100%
rename from test/tools_lpc_unittest.cpp
rename to tools/test/tools_lpc_unittest.cpp
diff --git a/test/tools_updater_unittest.cpp b/tools/test/tools_updater_unittest.cpp
similarity index 100%
rename from test/tools_updater_unittest.cpp
rename to tools/test/tools_updater_unittest.cpp
diff --git a/test/updater_mock.hpp b/tools/test/updater_mock.hpp
similarity index 100%
rename from test/updater_mock.hpp
rename to tools/test/updater_mock.hpp