Rearrange meson file and remove redundant tests

Currently, we build several test binaries.  This gives a pattern that
every time we add a new test suite, we add a new binary, which doesn't
scale all that well as we start getting more unit tests.

This commit moves all unit tests into a single binary called
"bmcweb_unit_tests", which also allows simplifying some logic around
dependencies and src files.

Tested:
Code builds as it did before, unit tests run and pass, and show the same
number of atoms tested.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I95aba1a351ee6a94d7ecc6e1401e35ce2c696e49
diff --git a/meson.build b/meson.build
index 9618203..a0b9bc9 100644
--- a/meson.build
+++ b/meson.build
@@ -344,31 +344,6 @@
   gmock = gmock.as_system('system')
 endif
 
-# Source files
-
-srcfiles_bmcweb = [
-  'src/webserver_main.cpp',
-  'redfish-core/src/error_messages.cpp',
-  'redfish-core/src/utils/json_utils.cpp',
-  'src/boost_url.cpp',
-  'src/boost_beast.cpp',
-  'src/boost_asio.cpp',
-  'src/boost_asio_ssl.cpp',
-]
-
-srcfiles_unittest = [
-  'include/ut/dbus_utility_test.cpp',
-  'include/ut/http_utility_test.cpp',
-  'include/ut/human_sort_test.cpp',
-  'redfish-core/ut/privileges_test.cpp',
-  'redfish-core/ut/lock_test.cpp',
-  'redfish-core/ut/configfile_test.cpp',
-  'redfish-core/ut/time_utils_test.cpp',
-  'redfish-core/ut/stl_utils_test.cpp',
-  'redfish-core/ut/hex_utils_test.cpp',
-  'http/ut/utility_test.cpp'
-]
-
 # Gather the Configuration data
 
 conf_data = configuration_data()
@@ -414,35 +389,52 @@
 
 install_subdir('static', install_dir : 'share/www', strip_directory : true)
 
-# Generate the bmcweb executable and the test binary
+# Source files
 
-executable('bmcweb',srcfiles_bmcweb,
-            include_directories : incdir,
-            dependencies: bmcweb_dependencies,
-            link_args: '-Wl,--gc-sections',
-            install: true,
-            install_dir:bindir)
+srcfiles_bmcweb = [
+  'redfish-core/src/error_messages.cpp',
+  'redfish-core/src/utils/json_utils.cpp',
+  'src/boost_url.cpp',
+  'src/boost_beast.cpp',
+  'src/boost_asio.cpp',
+  'src/boost_asio_ssl.cpp',
+]
+
+# Generate the bmcweb executable
+executable(
+  'bmcweb',
+  srcfiles_bmcweb + ['src/webserver_main.cpp'],
+  include_directories : incdir,
+  dependencies: bmcweb_dependencies,
+  link_args: '-Wl,--gc-sections',
+  install: true,
+  install_dir:bindir
+)
+
+srcfiles_unittest = [
+  'include/ut/dbus_utility_test.cpp',
+  'include/ut/http_utility_test.cpp',
+  'include/ut/human_sort_test.cpp',
+  'redfish-core/ut/privileges_test.cpp',
+  'redfish-core/ut/lock_test.cpp',
+  'redfish-core/ut/configfile_test.cpp',
+  'redfish-core/ut/time_utils_test.cpp',
+  'redfish-core/ut/stl_utils_test.cpp',
+  'redfish-core/ut/hex_utils_test.cpp',
+  'http/ut/utility_test.cpp'
+]
 
 if(get_option('tests').enabled())
-  foreach src_test : srcfiles_unittest
-    testname = src_test.split('/')[-1].split('.')[0]
-    test(testname,executable(testname,
-        [src_test,
-        'src/boost_url.cpp',
-        'src/boost_beast.cpp',
-        'src/boost_asio.cpp',
-        'src/boost_asio_ssl.cpp',],
-                include_directories : incdir,
-                install_dir: bindir,
-                dependencies: [
-                                boost,
-                                boost_url,
-                                gtest,
-                                openssl,
-                                gmock,
-                                nlohmann_json,
-                                sdbusplus,
-                                pam
-                              ]))
-  endforeach
+    # generate the test executable
+    ut_bin = executable(
+      'bmcweb_unit_test',
+      srcfiles_unittest + srcfiles_bmcweb,
+      include_directories : incdir,
+      install_dir: bindir,
+      dependencies: bmcweb_dependencies + [
+        gtest,
+        gmock,
+      ]
+    )
+    test('bmcweb_unit_test', ut_bin)
 endif