[Test] delete unnecessary test
authorJaeyun Jung <jy1210.jung@samsung.com>
Mon, 8 Jan 2024 08:37:54 +0000 (17:37 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Fri, 12 Jan 2024 00:36:06 +0000 (09:36 +0900)
Delete unnecessary test-dbus and update spec file to install tc.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
packaging/machine-learning-agent.spec
tests/daemon/meson.build
tests/daemon/unittest_gdbus_util.cc
tests/dbus/meson.build [deleted file]
tests/dbus/test-dbus-impl.c [deleted file]
tests/dbus/test-dbus-interface.h [deleted file]
tests/dbus/test-dbus.xml [deleted file]
tests/meson.build

index d4ed09f44819e7f91e8cd38f867d2f85256b3aa0..23d838dc97c78cde52e7941c27e14213ee548f13 100644 (file)
@@ -271,7 +271,6 @@ install -m 0755 packaging/run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests
 %{_bindir}/unittest-ml
 %{_libdir}/libml-agent-test.a
 %{_libdir}/libml-agent-test.so*
-%{_libdir}/libunittest_mock.so*
 %if 0%{?gcov:1}
 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
 %endif
index 9bb0f12545eaadc6e9738b36c3723371233383a5..a9dcb4795a39aa656db5935189377154ad2c40db 100644 (file)
@@ -19,7 +19,7 @@ test('unittest_service_db', unittest_service_db, env: testenv, timeout: 100)
 
 unittest_gdbus_util = executable('unittest_gdbus_util',
   'unittest_gdbus_util.cc',
-  dependencies: [gtest_dep, ml_agent_test_dep, gdbus_gen_test_dep],
+  dependencies: [gtest_dep, ml_agent_test_dep],
   link_with: ml_agent_lib,
   install: get_option('install-test'),
   install_dir: unittest_install_dir,
index 35e4b75ec252d10d85b10ae8f0ccc08fafebd537..775424f905eb4f4c479da2536374fb1e9d4d0389 100755 (executable)
@@ -9,11 +9,9 @@
 
 #include <gtest/gtest.h>
 
-#include "../dbus/test-dbus-interface.h"
 #include "dbus-interface.h"
 #include "gdbus-util.h"
 #include "log.h"
-#include "test-dbus.h"
 
 /**
  * @brief Test base class for GDbus.
@@ -52,39 +50,6 @@ class GDbusTest : public ::testing::Test
   }
 };
 
-/**
- * @brief Call the 'get_state' DBus method and check the result.
- */
-TEST_F (GDbusTest, call_method)
-{
-  MachinelearningServiceTest *proxy = NULL;
-  GError *error = NULL;
-  int status = 0;
-  int result = 0;
-
-  /* Test : Connect to the DBus interface */
-  proxy = machinelearning_service_test_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
-      G_DBUS_PROXY_FLAGS_NONE, DBUS_ML_BUS_NAME, DBUS_TEST_PATH, NULL, &error);
-  if (error != NULL) {
-    g_error_free (error);
-    FAIL ();
-  }
-
-  /* Test: Call the DBus method */
-  machinelearning_service_test_call_get_state_sync (proxy, &status, &result, NULL, &error);
-  if (error != NULL) {
-    ml_loge ("Error : %s", error->message);
-    g_error_free (error);
-    FAIL ();
-  }
-
-  /* Check the return value */
-  EXPECT_EQ (result, 0);
-  EXPECT_EQ (status, 1);
-
-  g_object_unref (proxy);
-}
-
 /**
  * @brief Negative test for the gdbus helper function, gdbus_export_interface().
  */
diff --git a/tests/dbus/meson.build b/tests/dbus/meson.build
deleted file mode 100755 (executable)
index b67f64f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-test_dbus_impl_srcs = files('test-dbus-impl.c')
-test_dbus_input = files('test-dbus.xml')
-
-gdbus_gen_test_src = custom_target('gdbus-gencode-test',
-    input: test_dbus_input,
-    output: ['test-dbus.h', 'test-dbus.c'],
-    command: [gdbus_prog, '--interface-prefix', 'org.tizen',
-            '--generate-c-code', 'test-dbus',
-            '--output-directory', meson.current_build_dir(),
-            '@INPUT@'])
-
-gdbus_gen_test_dep = declare_dependency(sources: gdbus_gen_test_src,
-    dependencies: gdbus_gen_header_dep)
diff --git a/tests/dbus/test-dbus-impl.c b/tests/dbus/test-dbus-impl.c
deleted file mode 100755 (executable)
index 0a4bedc..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/* SPDX-License-Identifier: Apache-2.0 */
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
- *
- * @file    test-dbus-impl.c
- * @date    16 Jul 2022
- * @brief   DBus implementation for test interface
- * @see     https://github.com/nnstreamer/deviceMLOps.MLAgent
- * @author  Sangjung Woo <sangjung.woo@samsung.com>
- * @bug     No known bugs except for NYI items
- */
-
-#include <glib.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <common.h>
-#include <modules.h>
-#include <gdbus-util.h>
-#include <log.h>
-
-#include "test-dbus-interface.h"
-#include "test-dbus.h"
-
-static MachinelearningServiceTest *g_gdbus_instance = NULL;
-
-/**
- * @brief DBus handler for 'get_state' method of test interface.
- */
-static gboolean
-dbus_cb_service_get_status (MachinelearningServiceTest * obj,
-    GDBusMethodInvocation * invoc)
-{
-  int ret = 0;
-  int status = 1;
-
-  machinelearning_service_test_complete_get_state (obj, invoc, status, ret);
-  return TRUE;
-}
-
-static struct gdbus_signal_info g_gdbus_signal_infos[] = {
-  {
-    .signal_name = DBUS_TEST_I_GET_STATE_HANDLER,
-    .cb = G_CALLBACK (dbus_cb_service_get_status),
-    .cb_data = NULL,
-    .handler_id = 0,
-  },
-};
-
-/**
- * @brief Utility function to get the DBus proxy of test interface.
- */
-static MachinelearningServiceTest *
-gdbus_get_instance_test (void)
-{
-  return machinelearning_service_test_skeleton_new ();
-}
-
-/**
- * @brief Utility function to release DBus proxy.
- */
-static void
-gdbus_put_instance_test (MachinelearningServiceTest ** instance)
-{
-  g_clear_object (instance);
-}
-
-/**
- * @brief The callback function for initializing test module.
- */
-static void
-init_test (void *data)
-{
-  ml_logd ("init_test module");
-
-  gdbus_initialize ();
-}
-
-/**
- * @brief The callback function for exiting test module.
- */
-static void
-exit_test (void *data)
-{
-  gdbus_disconnect_signal (g_gdbus_instance,
-      ARRAY_SIZE (g_gdbus_signal_infos), g_gdbus_signal_infos);
-  gdbus_put_instance_test (&g_gdbus_instance);
-}
-
-/**
- * @brief The callback function for proving test module.
- */
-static int
-probe_test (void *data)
-{
-  int ret = 0;
-
-  ml_logd ("probe_test");
-
-  g_gdbus_instance = gdbus_get_instance_test ();
-  if (g_gdbus_instance == NULL) {
-    ml_loge ("Cannot get the dbus instance for the %s interface.",
-        DBUS_TEST_INTERFACE);
-    return -ENOSYS;
-  }
-
-  ret = gdbus_connect_signal (g_gdbus_instance,
-      ARRAY_SIZE (g_gdbus_signal_infos), g_gdbus_signal_infos);
-  if (ret < 0) {
-    ml_loge ("Cannot register callbacks as the dbus method invocation handlers (ret: %d).",
-        ret);
-    ret = -ENOSYS;
-    goto out;
-  }
-
-  ret = gdbus_export_interface (g_gdbus_instance, DBUS_TEST_PATH);
-  if (ret < 0) {
-    ml_loge ("Cannot export the dbus interface '%s' at the object path '%s'.",
-        DBUS_TEST_INTERFACE, DBUS_TEST_PATH);
-    ret = -ENOSYS;
-    goto out_disconnect;
-  }
-  return 0;
-
-out_disconnect:
-  gdbus_disconnect_signal (g_gdbus_instance,
-      ARRAY_SIZE (g_gdbus_signal_infos), g_gdbus_signal_infos);
-out:
-  gdbus_put_instance_test (&g_gdbus_instance);
-
-  return ret;
-}
-
-static const struct module_ops test_ops = {
-  .name = "ml-agent-test",
-  .probe = probe_test,
-  .init = init_test,
-  .exit = exit_test,
-};
-
-MODULE_OPS_REGISTER (&test_ops)
diff --git a/tests/dbus/test-dbus-interface.h b/tests/dbus/test-dbus-interface.h
deleted file mode 100755 (executable)
index dcff24e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: Apache-2.0 */
-/**
- * NNStreamer API / Machine Learning Agent Daemon
- * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
- */
-
-/**
- * @file    test-dbus-interface.h
- * @date    16 Jul 2022
- * @brief   Test header for the definition of DBus node and interfaces.
- * @see     https://github.com/nnstreamer/deviceMLOps.MLAgent
- * @author  Sangjung Woo <sangjung.woo@samsung.com>
- * @bug     No known bugs except for NYI items
- *
- * @details
- *    This defines the machine learning agent's bus, interface, and method names for test.
- */
-
-#ifndef __TEST_DBUS_INTERFACE_H__
-#define __TEST_DBUS_INTERFACE_H__
-
-#define DBUS_TEST_INTERFACE          "org.tizen.machinelearning.service.test"
-#define DBUS_TEST_PATH               "/Org/Tizen/MachineLearning/Service/Test"
-
-#define DBUS_TEST_I_GET_STATE_HANDLER       "handle-get-state"
-
-#endif /* __TEST_DBUS_INTERFACE_H__ */
diff --git a/tests/dbus/test-dbus.xml b/tests/dbus/test-dbus.xml
deleted file mode 100755 (executable)
index b2b1d57..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<node name="/Org/Tizen/MachineLearning/Service">
-  <interface name="org.tizen.machinelearning.service.test">
-    <method name="get_state">
-      <arg type="i" name="state" direction="out" />
-      <arg type="i" name="result" direction="out" />      
-    </method>
-  </interface>
-</node>
index f380ef4b80c4bc8106ae27fab0289ff9e6a58352..b3dd19e18f582e73836f19b2cdadde515b07a120 100644 (file)
@@ -30,12 +30,9 @@ ml_agent_test_dep = declare_dependency(
   link_with: ml_agent_test_lib
 )
 
-subdir('dbus')
-
 ml_agent_main_objs = ml_agent_executable.extract_objects(ml_agent_main_file)
 executable('machine-learning-agent-test',
-  test_dbus_impl_srcs,
-  dependencies: [ml_agent_test_dep, gdbus_gen_test_dep],
+  dependencies: ml_agent_test_dep,
   install: get_option('install-test'),
   install_dir: unittest_base_dir,
   objects: ml_agent_main_objs