meson: separate directory for entity-manager tests

Since entity-manager is now built with a static library, the sources do
not have to be compiled twice for testing. Link with the static library
instead.

Move the test file for entity-manager into a separate directory to split
it in later patches.

Tested: Unit Tests Pass

Change-Id: I04e03f8a29aacab0482e75de43a2a45d97d32e01
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/test/entity_manager/meson.build b/test/entity_manager/meson.build
new file mode 100644
index 0000000..d0ac54c
--- /dev/null
+++ b/test/entity_manager/meson.build
@@ -0,0 +1,18 @@
+test(
+    'test_entity_manager',
+    executable(
+        'test_entity_manager',
+        'test_entity-manager.cpp',
+        cpp_args: test_boost_args,
+        dependencies: [
+            boost,
+            gtest,
+            nlohmann_json_dep,
+            phosphor_logging_dep,
+            sdbusplus,
+            valijson,
+        ],
+        link_with: entity_manager_lib,
+        include_directories: test_include_dir,
+    ),
+)
diff --git a/test/test_entity-manager.cpp b/test/entity_manager/test_entity-manager.cpp
similarity index 100%
rename from test/test_entity-manager.cpp
rename to test/entity_manager/test_entity-manager.cpp
diff --git a/test/meson.build b/test/meson.build
index 8acb384..c2ba0a6 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -12,28 +12,9 @@
 
 endif
 
-test_include_dir = '../src'
+test_include_dir = include_directories('../src')
 
-test(
-    'test_entity_manager',
-    executable(
-        'test_entity_manager',
-        'test_entity-manager.cpp',
-        '../src/entity_manager/expression.cpp',
-        '../src/utils.cpp',
-        '../src/entity_manager/utils.cpp',
-        cpp_args: test_boost_args,
-        dependencies: [
-            boost,
-            gtest,
-            nlohmann_json_dep,
-            phosphor_logging_dep,
-            sdbusplus,
-            valijson,
-        ],
-        include_directories: test_include_dir,
-    ),
-)
+subdir('entity_manager')
 
 test(
     'test_fru_utils',