treewide: reorganize unit tests
Like other C++ projects, unit tests normally are in a separate repo and
respect the folder structure of the file under test.
This commit deleted all "ut" folder and move tests to a "test" folder.
The test folder also has similar structure as the main folder.
This commit also made neccessary include changes to make codes compile.
Unused tests are untouched.
Tested: unit test passed.
Reference:
[1] https://github.com/grpc/grpc/tree/master/test
[2] https://github.com/boostorg/core/tree/414dfb466878af427d33b36e6ccf84d21c0e081b/test
[3] Many other OpenBMC repos: https://github.com/openbmc/entity-manager/tree/master/test
[4] https://stackoverflow.com/questions/2360734/whats-a-good-directory-structure-for-larger-c-projects-using-makefile
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I4521c7ef5fa03c47cca5c146d322bbb51365ee96
diff --git a/meson.build b/meson.build
index b3425be..7e58791 100644
--- a/meson.build
+++ b/meson.build
@@ -391,29 +391,29 @@
)
srcfiles_unittest = [
- 'http/ut/utility_test.cpp',
- 'http/ut/router_test.cpp',
- 'include/google/google_service_root_test.cpp',
- 'include/ut/dbus_utility_test.cpp',
- 'include/ut/http_utility_test.cpp',
- 'include/ut/human_sort_test.cpp',
- 'include/ut/multipart_test.cpp',
- 'include/ut/openbmc_dbus_rest_test.cpp',
- 'redfish-core/include/utils/query_param_test.cpp',
- 'redfish-core/lib/ut/log_services_dump_test.cpp',
- 'redfish-core/lib/ut/service_root_test.cpp',
- 'redfish-core/lib/ut/thermal_subsystem_test.cpp',
- 'redfish-core/lib/chassis_test.cpp',
- 'redfish-core/ut/configfile_test.cpp',
- 'redfish-core/ut/hex_utils_test.cpp',
- 'redfish-core/ut/ip_utils_test.cpp',
- 'redfish-core/ut/json_utils_test.cpp',
- 'redfish-core/ut/lock_test.cpp',
- 'redfish-core/ut/privileges_test.cpp',
- 'redfish-core/ut/registries_test.cpp',
- 'redfish-core/ut/stl_utils_test.cpp',
- 'redfish-core/ut/time_utils_test.cpp',
- 'src/crow_getroutes_test.cpp',
+ 'test/http/crow_getroutes_test.cpp',
+ 'test/http/router_test.cpp',
+ 'test/http/utility_test.cpp',
+ 'test/include/dbus_utility_test.cpp',
+ 'test/include/google/google_service_root_test.cpp',
+ 'test/include/http_utility_test.cpp',
+ 'test/include/human_sort_test.cpp',
+ 'test/include/ibm/configfile_test.cpp',
+ 'test/include/ibm/lock_test.cpp',
+ 'test/include/multipart_test.cpp',
+ 'test/include/openbmc_dbus_rest_test.cpp',
+ 'test/redfish-core/include/privileges_test.cpp',
+ 'test/redfish-core/include/registries_test.cpp',
+ 'test/redfish-core/include/utils/hex_utils_test.cpp',
+ 'test/redfish-core/include/utils/ip_utils_test.cpp',
+ 'test/redfish-core/include/utils/json_utils_test.cpp',
+ 'test/redfish-core/include/utils/query_param_test.cpp',
+ 'test/redfish-core/include/utils/stl_utils_test.cpp',
+ 'test/redfish-core/include/utils/time_utils_test.cpp',
+ 'test/redfish-core/lib/chassis_test.cpp',
+ 'test/redfish-core/lib/log_services_dump_test.cpp',
+ 'test/redfish-core/lib/service_root_test.cpp',
+ 'test/redfish-core/lib/thermal_subsystem_test.cpp',
]
if(get_option('tests').enabled())
diff --git a/src/crow_getroutes_test.cpp b/test/http/crow_getroutes_test.cpp
similarity index 100%
rename from src/crow_getroutes_test.cpp
rename to test/http/crow_getroutes_test.cpp
diff --git a/http/ut/router_test.cpp b/test/http/router_test.cpp
similarity index 100%
rename from http/ut/router_test.cpp
rename to test/http/router_test.cpp
diff --git a/http/ut/utility_test.cpp b/test/http/utility_test.cpp
similarity index 100%
rename from http/ut/utility_test.cpp
rename to test/http/utility_test.cpp
diff --git a/include/ut/dbus_utility_test.cpp b/test/include/dbus_utility_test.cpp
similarity index 100%
rename from include/ut/dbus_utility_test.cpp
rename to test/include/dbus_utility_test.cpp
diff --git a/include/google/google_service_root_test.cpp b/test/include/google/google_service_root_test.cpp
similarity index 95%
rename from include/google/google_service_root_test.cpp
rename to test/include/google/google_service_root_test.cpp
index f979a42..32d4e52 100644
--- a/include/google/google_service_root_test.cpp
+++ b/test/include/google/google_service_root_test.cpp
@@ -1,5 +1,5 @@
#include "async_resp.hpp"
-#include "google_service_root.hpp"
+#include "google/google_service_root.hpp"
#include "http_request.hpp"
#include "nlohmann/json.hpp"
diff --git a/include/ut/http_utility_test.cpp b/test/include/http_utility_test.cpp
similarity index 100%
rename from include/ut/http_utility_test.cpp
rename to test/include/http_utility_test.cpp
diff --git a/include/ut/human_sort_test.cpp b/test/include/human_sort_test.cpp
similarity index 100%
rename from include/ut/human_sort_test.cpp
rename to test/include/human_sort_test.cpp
diff --git a/redfish-core/ut/configfile_test.cpp b/test/include/ibm/configfile_test.cpp
similarity index 100%
rename from redfish-core/ut/configfile_test.cpp
rename to test/include/ibm/configfile_test.cpp
diff --git a/redfish-core/ut/lock_test.cpp b/test/include/ibm/lock_test.cpp
similarity index 100%
rename from redfish-core/ut/lock_test.cpp
rename to test/include/ibm/lock_test.cpp
diff --git a/include/ut/multipart_test.cpp b/test/include/multipart_test.cpp
similarity index 100%
rename from include/ut/multipart_test.cpp
rename to test/include/multipart_test.cpp
diff --git a/include/ut/openbmc_dbus_rest_test.cpp b/test/include/openbmc_dbus_rest_test.cpp
similarity index 100%
rename from include/ut/openbmc_dbus_rest_test.cpp
rename to test/include/openbmc_dbus_rest_test.cpp
diff --git a/redfish-core/ut/privileges_test.cpp b/test/redfish-core/include/privileges_test.cpp
similarity index 100%
rename from redfish-core/ut/privileges_test.cpp
rename to test/redfish-core/include/privileges_test.cpp
diff --git a/redfish-core/ut/registries_test.cpp b/test/redfish-core/include/registries_test.cpp
similarity index 100%
rename from redfish-core/ut/registries_test.cpp
rename to test/redfish-core/include/registries_test.cpp
diff --git a/redfish-core/ut/hex_utils_test.cpp b/test/redfish-core/include/utils/hex_utils_test.cpp
similarity index 100%
rename from redfish-core/ut/hex_utils_test.cpp
rename to test/redfish-core/include/utils/hex_utils_test.cpp
diff --git a/redfish-core/ut/ip_utils_test.cpp b/test/redfish-core/include/utils/ip_utils_test.cpp
similarity index 100%
rename from redfish-core/ut/ip_utils_test.cpp
rename to test/redfish-core/include/utils/ip_utils_test.cpp
diff --git a/redfish-core/ut/json_utils_test.cpp b/test/redfish-core/include/utils/json_utils_test.cpp
similarity index 100%
rename from redfish-core/ut/json_utils_test.cpp
rename to test/redfish-core/include/utils/json_utils_test.cpp
diff --git a/redfish-core/include/utils/query_param_test.cpp b/test/redfish-core/include/utils/query_param_test.cpp
similarity index 99%
rename from redfish-core/include/utils/query_param_test.cpp
rename to test/redfish-core/include/utils/query_param_test.cpp
index 4b89b2e..51f0b71 100644
--- a/redfish-core/include/utils/query_param_test.cpp
+++ b/test/redfish-core/include/utils/query_param_test.cpp
@@ -1,6 +1,6 @@
#include "bmcweb_config.h"
-#include "query_param.hpp"
+#include "utils/query_param.hpp"
#include <boost/system/result.hpp>
#include <boost/url/url_view.hpp>
diff --git a/redfish-core/ut/stl_utils_test.cpp b/test/redfish-core/include/utils/stl_utils_test.cpp
similarity index 100%
rename from redfish-core/ut/stl_utils_test.cpp
rename to test/redfish-core/include/utils/stl_utils_test.cpp
diff --git a/redfish-core/ut/time_utils_test.cpp b/test/redfish-core/include/utils/time_utils_test.cpp
similarity index 100%
rename from redfish-core/ut/time_utils_test.cpp
rename to test/redfish-core/include/utils/time_utils_test.cpp
diff --git a/redfish-core/lib/chassis_test.cpp b/test/redfish-core/lib/chassis_test.cpp
similarity index 100%
rename from redfish-core/lib/chassis_test.cpp
rename to test/redfish-core/lib/chassis_test.cpp
diff --git a/redfish-core/lib/ut/log_services_dump_test.cpp b/test/redfish-core/lib/log_services_dump_test.cpp
similarity index 100%
rename from redfish-core/lib/ut/log_services_dump_test.cpp
rename to test/redfish-core/lib/log_services_dump_test.cpp
diff --git a/redfish-core/lib/ut/service_root_test.cpp b/test/redfish-core/lib/service_root_test.cpp
similarity index 100%
rename from redfish-core/lib/ut/service_root_test.cpp
rename to test/redfish-core/lib/service_root_test.cpp
diff --git a/redfish-core/lib/ut/thermal_subsystem_test.cpp b/test/redfish-core/lib/thermal_subsystem_test.cpp
similarity index 100%
rename from redfish-core/lib/ut/thermal_subsystem_test.cpp
rename to test/redfish-core/lib/thermal_subsystem_test.cpp