[Test] ml-agent install prefix
authorJaeyun Jung <jy1210.jung@samsung.com>
Wed, 3 Apr 2024 03:17:05 +0000 (12:17 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Wed, 3 Apr 2024 04:37:56 +0000 (13:37 +0900)
Add definition to get the install prefix to run the ml-agent for unittest.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
meson.build
tests/capi/unittest_capi_remote_service.cc
tests/capi/unittest_capi_service_agent_client.cc
tests/capi/unittest_capi_service_extension.cc

index d5d2948..03bcac1 100644 (file)
@@ -167,6 +167,9 @@ api_install_bindir = join_paths(api_install_prefix, get_option('bindir'))
 api_install_includedir = join_paths(api_install_prefix, get_option('includedir'))
 api_install_inidir = get_option('sysconfdir')
 
+# Declare path to bin directory to run mlops-agent for unittest.
+add_project_arguments('-DEXEC_PREFIX="' + api_install_bindir + '"', language: ['c', 'cpp'])
+
 # Set default configuration
 api_conf = configuration_data()
 api_conf.set('VERSION', api_version)
index a4b2aa7..bfc27a5 100644 (file)
@@ -35,7 +35,8 @@ class MLRemoteService : public ::testing::Test
    */
   void SetUp () override
   {
-    g_autofree gchar *services_dir = g_build_filename ("/usr/bin/ml-test/services", NULL);
+    g_autofree gchar *services_dir
+        = g_build_filename (EXEC_PREFIX, "ml-test", "services", NULL);
 
     dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
     ASSERT_NE (nullptr, dbus);
index 9ad825b..ac00f33 100644 (file)
@@ -31,7 +31,8 @@ class MLServiceAgentTest : public ::testing::Test
    */
   void SetUp () override
   {
-    g_autofree gchar *services_dir = g_build_filename ("/usr/bin/ml-test/services", NULL);
+    g_autofree gchar *services_dir
+        = g_build_filename (EXEC_PREFIX, "ml-test", "services", NULL);
 
     dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
     ASSERT_NE (nullptr, dbus);
index 9b60a3d..d696a3b 100755 (executable)
@@ -50,7 +50,8 @@ class MLServiceExtensionTest : public ::testing::Test
    */
   static void SetUpTestSuite ()
   {
-    g_autofree gchar *services_dir = g_build_filename ("/usr/bin/ml-test/services", NULL);
+    g_autofree gchar *services_dir
+        = g_build_filename (EXEC_PREFIX, "ml-test", "services", NULL);
 
     dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
     ASSERT_NE (nullptr, dbus);