tests: Organize the test code to make it modular

The unit test code for libpldmresponder, host-bmc and common is
in a shared test directory. This patch separates the test code
to the respective directory.

Tested: Ran the unit test and tests passed.

Signed-off-by: Tom Joseph <rushtotom@gmail.com>
Change-Id: I31d53681fa6c0d8bc6eb7c4e3341aaff4bc341ee
diff --git a/common/test/meson.build b/common/test/meson.build
new file mode 100644
index 0000000..4c909c0
--- /dev/null
+++ b/common/test/meson.build
@@ -0,0 +1,21 @@
+common_test_src = declare_dependency(
+          sources: [
+            '../utils.cpp'])
+
+tests = [
+  'pldm_utils_test',
+]
+
+foreach t : tests
+  test(t, executable(t.underscorify(), t + '.cpp',
+                     implicit_include_directories: false,
+                     link_args: dynamic_linker,
+                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+                     dependencies: [
+                         common_test_src,
+                         gtest,
+                         libpldm_dep,
+                         phosphor_dbus_interfaces,
+                         sdbusplus]),
+       workdir: meson.current_source_dir())
+endforeach
diff --git a/test/mocked_utils.hpp b/common/test/mocked_utils.hpp
similarity index 100%
rename from test/mocked_utils.hpp
rename to common/test/mocked_utils.hpp
diff --git a/test/pldm_utils_test.cpp b/common/test/pldm_utils_test.cpp
similarity index 100%
rename from test/pldm_utils_test.cpp
rename to common/test/pldm_utils_test.cpp
diff --git a/test/libpldmresponder_dbus_to_host_effecter_test.cpp b/host-bmc/test/dbus_to_host_effecter_test.cpp
similarity index 98%
rename from test/libpldmresponder_dbus_to_host_effecter_test.cpp
rename to host-bmc/test/dbus_to_host_effecter_test.cpp
index 0cc963a..72b820d 100644
--- a/test/libpldmresponder_dbus_to_host_effecter_test.cpp
+++ b/host-bmc/test/dbus_to_host_effecter_test.cpp
@@ -1,6 +1,6 @@
+#include "common/test/mocked_utils.hpp"
 #include "common/utils.hpp"
 #include "host-bmc/dbus_to_host_effecters.hpp"
-#include "mocked_utils.hpp"
 
 #include <nlohmann/json.hpp>
 
diff --git a/test/host_effecter_jsons/good/dbus_to_host_effecter.json b/host-bmc/test/host_effecter_jsons/good/dbus_to_host_effecter.json
similarity index 100%
rename from test/host_effecter_jsons/good/dbus_to_host_effecter.json
rename to host-bmc/test/host_effecter_jsons/good/dbus_to_host_effecter.json
diff --git a/test/host_effecter_jsons/malformed/dbus_to_host_effecter.json b/host-bmc/test/host_effecter_jsons/malformed/dbus_to_host_effecter.json
similarity index 100%
rename from test/host_effecter_jsons/malformed/dbus_to_host_effecter.json
rename to host-bmc/test/host_effecter_jsons/malformed/dbus_to_host_effecter.json
diff --git a/test/host_effecter_jsons/no_json/dummy.json b/host-bmc/test/host_effecter_jsons/no_json/dummy.json
similarity index 100%
rename from test/host_effecter_jsons/no_json/dummy.json
rename to host-bmc/test/host_effecter_jsons/no_json/dummy.json
diff --git a/host-bmc/test/meson.build b/host-bmc/test/meson.build
new file mode 100644
index 0000000..2254a3a
--- /dev/null
+++ b/host-bmc/test/meson.build
@@ -0,0 +1,25 @@
+host_bmc_test_src = declare_dependency(
+          sources: [
+            '../dbus_to_host_effecters.cpp',
+            '../../pldmd/dbus_impl_requester.cpp',
+            '../../pldmd/instance_id.cpp'])
+
+tests = [
+  'dbus_to_host_effecter_test',
+]
+
+foreach t : tests
+  test(t, executable(t.underscorify(), t + '.cpp',
+                     implicit_include_directories: false,
+                     link_args: dynamic_linker,
+                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+                     dependencies: [
+                         gtest,
+                         gmock,
+                         host_bmc_test_src,
+                         libpldm_dep,
+                         libpldmutils,
+                         phosphor_dbus_interfaces,
+                         sdbusplus]),
+       workdir: meson.current_source_dir())
+endforeach
diff --git a/libpldm/tests/meson.build b/libpldm/tests/meson.build
index a4fb1cc..607dd7d 100644
--- a/libpldm/tests/meson.build
+++ b/libpldm/tests/meson.build
@@ -1,20 +1,3 @@
-if get_option('oe-sdk').enabled()
-  # Setup OE SYSROOT
-  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
-  if OECORE_TARGET_SYSROOT == ''
-      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
-  endif
-  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
-  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
-  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
-  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
-else
-  dynamic_linker = []
-endif
-
-gtest = dependency('gtest', main: true, disabler: true, required: true)
-gmock = dependency('gmock', disabler: true, required: true)
-
 tests = [
   'libpldm_base_test',
   'libpldm_platform_test',
diff --git a/libpldmresponder/meson.build b/libpldmresponder/meson.build
index 7e52c3d..8436e14 100644
--- a/libpldmresponder/meson.build
+++ b/libpldmresponder/meson.build
@@ -52,3 +52,7 @@
 
 libpldmresponder = declare_dependency(
   link_with: libpldmresponder)
+
+if get_option('tests').enabled()
+  subdir('test')
+endif
diff --git a/test/bios_jsons/enum_attrs.json b/libpldmresponder/test/bios_jsons/enum_attrs.json
similarity index 100%
rename from test/bios_jsons/enum_attrs.json
rename to libpldmresponder/test/bios_jsons/enum_attrs.json
diff --git a/test/bios_jsons/integer_attrs.json b/libpldmresponder/test/bios_jsons/integer_attrs.json
similarity index 100%
rename from test/bios_jsons/integer_attrs.json
rename to libpldmresponder/test/bios_jsons/integer_attrs.json
diff --git a/test/bios_jsons/string_attrs.json b/libpldmresponder/test/bios_jsons/string_attrs.json
similarity index 100%
rename from test/bios_jsons/string_attrs.json
rename to libpldmresponder/test/bios_jsons/string_attrs.json
diff --git a/test/event_jsons/good/event_state_sensor.json b/libpldmresponder/test/event_jsons/good/event_state_sensor.json
similarity index 100%
rename from test/event_jsons/good/event_state_sensor.json
rename to libpldmresponder/test/event_jsons/good/event_state_sensor.json
diff --git a/test/files/NVRAM-IMAGE b/libpldmresponder/test/files/NVRAM-IMAGE
similarity index 100%
rename from test/files/NVRAM-IMAGE
rename to libpldmresponder/test/files/NVRAM-IMAGE
Binary files differ
diff --git a/test/files/NVRAM-IMAGE-CKSUM b/libpldmresponder/test/files/NVRAM-IMAGE-CKSUM
similarity index 100%
rename from test/files/NVRAM-IMAGE-CKSUM
rename to libpldmresponder/test/files/NVRAM-IMAGE-CKSUM
Binary files differ
diff --git a/test/fru_jsons/good/Board_General.json b/libpldmresponder/test/fru_jsons/good/Board_General.json
similarity index 100%
rename from test/fru_jsons/good/Board_General.json
rename to libpldmresponder/test/fru_jsons/good/Board_General.json
diff --git a/test/fru_jsons/good/Board_VINI.json b/libpldmresponder/test/fru_jsons/good/Board_VINI.json
similarity index 100%
rename from test/fru_jsons/good/Board_VINI.json
rename to libpldmresponder/test/fru_jsons/good/Board_VINI.json
diff --git a/test/fru_jsons/good/Cpu_General.json b/libpldmresponder/test/fru_jsons/good/Cpu_General.json
similarity index 100%
rename from test/fru_jsons/good/Cpu_General.json
rename to libpldmresponder/test/fru_jsons/good/Cpu_General.json
diff --git a/test/fru_jsons/good/FRU_Master.json b/libpldmresponder/test/fru_jsons/good/FRU_Master.json
similarity index 100%
rename from test/fru_jsons/good/FRU_Master.json
rename to libpldmresponder/test/fru_jsons/good/FRU_Master.json
diff --git a/test/libpldmresponder_base_test.cpp b/libpldmresponder/test/libpldmresponder_base_test.cpp
similarity index 100%
rename from test/libpldmresponder_base_test.cpp
rename to libpldmresponder/test/libpldmresponder_base_test.cpp
diff --git a/test/libpldmresponder_bios_attribute_test.cpp b/libpldmresponder/test/libpldmresponder_bios_attribute_test.cpp
similarity index 100%
rename from test/libpldmresponder_bios_attribute_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_attribute_test.cpp
diff --git a/test/libpldmresponder_bios_config_test.cpp b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
similarity index 99%
rename from test/libpldmresponder_bios_config_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_config_test.cpp
index 837da87..25300ca 100644
--- a/test/libpldmresponder_bios_config_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
@@ -1,8 +1,8 @@
 #include "common/bios_utils.hpp"
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/bios_config.hpp"
 #include "libpldmresponder/bios_string_attribute.hpp"
 #include "mocked_bios.hpp"
-#include "mocked_utils.hpp"
 
 #include <nlohmann/json.hpp>
 
diff --git a/test/libpldmresponder_bios_enum_attribute_test.cpp b/libpldmresponder/test/libpldmresponder_bios_enum_attribute_test.cpp
similarity index 99%
rename from test/libpldmresponder_bios_enum_attribute_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_enum_attribute_test.cpp
index b9a5277..08d960d 100644
--- a/test/libpldmresponder_bios_enum_attribute_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_enum_attribute_test.cpp
@@ -1,6 +1,6 @@
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/bios_enum_attribute.hpp"
 #include "mocked_bios.hpp"
-#include "mocked_utils.hpp"
 
 #include <nlohmann/json.hpp>
 
diff --git a/test/libpldmresponder_bios_integer_attribute_test.cpp b/libpldmresponder/test/libpldmresponder_bios_integer_attribute_test.cpp
similarity index 98%
rename from test/libpldmresponder_bios_integer_attribute_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_integer_attribute_test.cpp
index f0f5780..fe1d6a8 100644
--- a/test/libpldmresponder_bios_integer_attribute_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_integer_attribute_test.cpp
@@ -1,6 +1,6 @@
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/bios_integer_attribute.hpp"
 #include "mocked_bios.hpp"
-#include "mocked_utils.hpp"
 
 #include <nlohmann/json.hpp>
 
diff --git a/test/libpldmresponder_bios_string_attribute_test.cpp b/libpldmresponder/test/libpldmresponder_bios_string_attribute_test.cpp
similarity index 99%
rename from test/libpldmresponder_bios_string_attribute_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_string_attribute_test.cpp
index c086bbc..d1c1703 100644
--- a/test/libpldmresponder_bios_string_attribute_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_string_attribute_test.cpp
@@ -1,6 +1,6 @@
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/bios_string_attribute.hpp"
 #include "mocked_bios.hpp"
-#include "mocked_utils.hpp"
 
 #include <nlohmann/json.hpp>
 
diff --git a/test/libpldmresponder_bios_table_test.cpp b/libpldmresponder/test/libpldmresponder_bios_table_test.cpp
similarity index 100%
rename from test/libpldmresponder_bios_table_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_table_test.cpp
diff --git a/test/libpldmresponder_bios_test.cpp b/libpldmresponder/test/libpldmresponder_bios_test.cpp
similarity index 100%
rename from test/libpldmresponder_bios_test.cpp
rename to libpldmresponder/test/libpldmresponder_bios_test.cpp
diff --git a/test/libpldmresponder_fru_test.cpp b/libpldmresponder/test/libpldmresponder_fru_test.cpp
similarity index 100%
rename from test/libpldmresponder_fru_test.cpp
rename to libpldmresponder/test/libpldmresponder_fru_test.cpp
diff --git a/test/libpldmresponder_pdr_effecter_test.cpp b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
similarity index 99%
rename from test/libpldmresponder_pdr_effecter_test.cpp
rename to libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
index 107972c..4f3df87 100644
--- a/test/libpldmresponder_pdr_effecter_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
@@ -1,8 +1,8 @@
 #include "libpldm/platform.h"
 
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
 #include "libpldmresponder/platform.hpp"
-#include "mocked_utils.hpp"
 
 #include <sdbusplus/test/sdbus_mock.hpp>
 #include <sdeventplus/event.hpp>
diff --git a/test/libpldmresponder_pdr_sensor_test.cpp b/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
similarity index 98%
rename from test/libpldmresponder_pdr_sensor_test.cpp
rename to libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
index 700af67..f95df0c 100644
--- a/test/libpldmresponder_pdr_sensor_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
@@ -1,8 +1,8 @@
 #include "libpldm/platform.h"
 
+#include "common/test/mocked_utils.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
 #include "libpldmresponder/platform.hpp"
-#include "mocked_utils.hpp"
 
 #include <sdbusplus/test/sdbus_mock.hpp>
 #include <sdeventplus/event.hpp>
diff --git a/test/libpldmresponder_platform_test.cpp b/libpldmresponder/test/libpldmresponder_platform_test.cpp
similarity index 99%
rename from test/libpldmresponder_platform_test.cpp
rename to libpldmresponder/test/libpldmresponder_platform_test.cpp
index a759020..b8fe603 100644
--- a/test/libpldmresponder_platform_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_platform_test.cpp
@@ -1,3 +1,4 @@
+#include "common/test/mocked_utils.hpp"
 #include "common/utils.hpp"
 #include "libpldmresponder/event_parser.hpp"
 #include "libpldmresponder/pdr.hpp"
@@ -6,7 +7,6 @@
 #include "libpldmresponder/platform_numeric_effecter.hpp"
 #include "libpldmresponder/platform_state_effecter.hpp"
 #include "libpldmresponder/platform_state_sensor.hpp"
-#include "mocked_utils.hpp"
 
 #include <sdbusplus/test/sdbus_mock.hpp>
 #include <sdeventplus/event.hpp>
diff --git a/libpldmresponder/test/meson.build b/libpldmresponder/test/meson.build
new file mode 100644
index 0000000..623e28e
--- /dev/null
+++ b/libpldmresponder/test/meson.build
@@ -0,0 +1,46 @@
+tests = [
+  'libpldmresponder_base_test',
+  'libpldmresponder_bios_test',
+  'libpldmresponder_bios_attribute_test',
+  'libpldmresponder_bios_config_test',
+  'libpldmresponder_bios_enum_attribute_test',
+  'libpldmresponder_bios_integer_attribute_test',
+  'libpldmresponder_bios_string_attribute_test',
+  'libpldmresponder_bios_table_test',
+  'libpldmresponder_fru_test',
+  'libpldmresponder_platform_test',
+  'libpldmresponder_pdr_effecter_test',
+  'libpldmresponder_pdr_sensor_test',
+]
+
+if get_option('oem-ibm').enabled()
+  tests += [
+    '../../oem/ibm/test/libpldmresponder_fileio_test',
+    '../../oem/ibm/test/libpldmresponder_oem_platform_test'
+  ]
+endif
+
+  dep_src_files = [
+  '../../pldmd/instance_id.cpp',
+  '../../pldmd/dbus_impl_requester.cpp'
+  ]
+dep_src = declare_dependency(sources: dep_src_files)
+
+foreach t : tests
+  test(t, executable(t.underscorify(), t + '.cpp',
+                     implicit_include_directories: false,
+                     link_args: dynamic_linker,
+                     build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+                     dependencies: [
+                         dep_src,
+                         libpldm_dep,
+                         libpldmresponder,
+                         libpldmutils,
+                         gtest,
+                         gmock,
+                         nlohmann_json,
+                         phosphor_dbus_interfaces,
+                         sdeventplus,
+                         sdbusplus]),
+       workdir: meson.current_source_dir())
+endforeach
diff --git a/test/mocked_bios.hpp b/libpldmresponder/test/mocked_bios.hpp
similarity index 100%
rename from test/mocked_bios.hpp
rename to libpldmresponder/test/mocked_bios.hpp
diff --git a/test/pdr_jsons/state_effecter/good/effecter_pdr.json b/libpldmresponder/test/pdr_jsons/state_effecter/good/effecter_pdr.json
similarity index 100%
rename from test/pdr_jsons/state_effecter/good/effecter_pdr.json
rename to libpldmresponder/test/pdr_jsons/state_effecter/good/effecter_pdr.json
diff --git a/test/pdr_jsons/state_effecter/malformed/effecter_pdr.json b/libpldmresponder/test/pdr_jsons/state_effecter/malformed/effecter_pdr.json
similarity index 100%
rename from test/pdr_jsons/state_effecter/malformed/effecter_pdr.json
rename to libpldmresponder/test/pdr_jsons/state_effecter/malformed/effecter_pdr.json
diff --git a/test/pdr_jsons/state_sensor/good/sensor_pdr.json b/libpldmresponder/test/pdr_jsons/state_sensor/good/sensor_pdr.json
similarity index 100%
rename from test/pdr_jsons/state_sensor/good/sensor_pdr.json
rename to libpldmresponder/test/pdr_jsons/state_sensor/good/sensor_pdr.json
diff --git a/test/pdr_jsons/state_sensor/malformed/sensor_pdr.json b/libpldmresponder/test/pdr_jsons/state_sensor/malformed/sensor_pdr.json
similarity index 100%
rename from test/pdr_jsons/state_sensor/malformed/sensor_pdr.json
rename to libpldmresponder/test/pdr_jsons/state_sensor/malformed/sensor_pdr.json
diff --git a/meson.build b/meson.build
index fdef145..22b1938 100644
--- a/meson.build
+++ b/meson.build
@@ -85,6 +85,42 @@
   )
 endif
 
+if get_option('oe-sdk').enabled()
+  # Setup OE SYSROOT
+  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
+  if OECORE_TARGET_SYSROOT == ''
+      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
+  endif
+  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
+  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
+  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
+  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
+else
+  dynamic_linker = []
+endif
+
+if get_option('tests').enabled()
+    gtest = dependency('gtest', main: true, disabler: true, required: false)
+    gmock = dependency('gmock', disabler: true, required: false)
+    if not gtest.found() or not gmock.found()
+        gtest_proj = import('cmake').subproject('googletest', required: false)
+        if gtest_proj.found()
+            gtest = declare_dependency(
+                dependencies: [
+                    dependency('threads'),
+                    gtest_proj.dependency('gtest'),
+                    gtest_proj.dependency('gtest_main'),
+                ]
+            )
+            gmock = gtest_proj.dependency('gmock')
+        else
+            assert(
+                not get_option('tests').enabled(),
+                'Googletest is required if tests are enabled'
+            )
+        endif
+    endif
+endif
 
 subdir('libpldm')
 
@@ -160,10 +196,6 @@
 
 subdir('configurations')
 
-if get_option('tests').enabled()
-  subdir('test')
-endif
-
 if get_option('utilities').enabled()
   subdir('utilities')
 endif
@@ -172,4 +204,10 @@
   subdir('softoff')
 endif
 
+if get_option('tests').enabled()
+  subdir('common/test')
+  subdir('host-bmc/test')
+  subdir('test')
+endif
+
 endif # pldm-only
diff --git a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
index 62ca129..aa986f4 100644
--- a/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
+++ b/oem/ibm/test/libpldmresponder_oem_platform_test.cpp
@@ -1,5 +1,6 @@
 #include "libpldm/entity.h"
 
+#include "common/test/mocked_utils.hpp"
 #include "common/utils.hpp"
 #include "libpldmresponder/event_parser.hpp"
 #include "libpldmresponder/pdr.hpp"
@@ -7,7 +8,6 @@
 #include "libpldmresponder/platform.hpp"
 #include "oem/ibm/libpldmresponder/inband_code_update.hpp"
 #include "oem/ibm/libpldmresponder/oem_ibm_handler.hpp"
-#include "test/mocked_utils.hpp"
 
 #include <sdeventplus/event.hpp>
 
diff --git a/test/meson.build b/test/meson.build
index c218b5f..438ba19 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,71 +1,12 @@
-if get_option('oe-sdk').enabled()
-  # Setup OE SYSROOT
-  OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
-  if OECORE_TARGET_SYSROOT == ''
-      error('Unable to get $OECORE_TARGET_SYSROOT, check your environment.')
-  endif
-  message('OE_SYSROOT: ' + OECORE_TARGET_SYSROOT)
-  rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
-  ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
-  dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
-else
-  dynamic_linker = []
-endif
-
-gtest = dependency('gtest', main: true, disabler: true, required: false)
-gmock = dependency('gmock', disabler: true, required: false)
-if not gtest.found() or not gmock.found()
-    gtest_proj = import('cmake').subproject('googletest', required: false)
-    if gtest_proj.found()
-        gtest = declare_dependency(
-            dependencies: [
-                dependency('threads'),
-                gtest_proj.dependency('gtest'),
-                gtest_proj.dependency('gtest_main'),
-            ]
-        )
-        gmock = gtest_proj.dependency('gmock')
-    else
-        assert(
-            not get_option('tests').enabled(),
-            'Googletest is required if tests are enabled'
-        )
-    endif
-endif
-
-pldmd = declare_dependency(
+test_src = declare_dependency(
           sources: [
-            '../pldmd/instance_id.cpp',
-            '../pldmd/dbus_impl_requester.cpp',
-            '../host-bmc/host_pdr_handler.cpp',
-            '../host-bmc/dbus_to_host_effecters.cpp'])
+            '../pldmd/instance_id.cpp'])
 
 tests = [
-  'libpldmresponder_base_test',
-  'libpldmresponder_bios_test',
-  'libpldmresponder_bios_attribute_test',
-  'libpldmresponder_bios_string_attribute_test',
-  'libpldmresponder_bios_config_test',
-  'libpldmresponder_bios_integer_attribute_test',
-  'libpldmresponder_bios_enum_attribute_test',
-  'libpldmresponder_pdr_effecter_test',
-  'libpldmresponder_pdr_sensor_test',
-  'libpldmresponder_bios_table_test',
-  'libpldmresponder_platform_test',
   'pldmd_instanceid_test',
   'pldmd_registration_test',
-  'pldm_utils_test',
-  'libpldmresponder_fru_test',
-  'libpldmresponder_dbus_to_host_effecter_test',
 ]
 
-if get_option('oem-ibm').enabled()
-  tests += [
-    '../oem/ibm/test/libpldmresponder_fileio_test',
-    '../oem/ibm/test/libpldmresponder_oem_platform_test'
-  ]
-endif
-
 foreach t : tests
   test(t, executable(t.underscorify(), t + '.cpp',
                      implicit_include_directories: false,
@@ -73,14 +14,7 @@
                      build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
                      dependencies: [
                          libpldm_dep,
-                         libpldmresponder,
-                         libpldmutils,
                          gtest,
-                         gmock,
-                         nlohmann_json,
-                         pldmd,
-                         phosphor_dbus_interfaces,
-                         sdeventplus,
-                         sdbusplus]),
+                         test_src]),
        workdir: meson.current_source_dir())
 endforeach