Code clean, rename macro and use predefined log util.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
gdbus_export_interface (gpointer instance, const char *obj_path)
{
if (g_dbus_sys_conn == NULL) {
- _E ("Cannot get the dbus connection to the system message bus");
+ ml_loge ("Cannot get the dbus connection to the system message bus");
return -ENOSYS;
}
g_dbus_sys_conn = g_bus_get_sync (bus_type, NULL, &err);
if (g_dbus_sys_conn == NULL) {
- _E ("Cannot connect to the system message bus: %s", err ? err->message : "Unknown error");
+ ml_loge ("Cannot connect to the system message bus: %s", err ? err->message : "Unknown error");
g_clear_error (&err);
return -ENOSYS;
}
GError *err = NULL;
if (!gst_init_check (NULL, NULL, &err))
- _E ("Failed to initialize GStreamer: %s", (err ? err->message : "Unknown error"));
+ ml_loge ("Failed to initialize GStreamer: %s", (err ? err->message : "Unknown error"));
g_clear_error (&err);
}
dlog_print(prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg);\
} while (0); })
-#define _D(fmt, arg...) LOG_V(DLOG_DEBUG, AGENT_LOG_TAG, fmt, ##arg)
-#define _I(fmt, arg...) LOG_V(DLOG_INFO, AGENT_LOG_TAG, fmt, ##arg)
-#define _W(fmt, arg...) LOG_V(DLOG_WARN, AGENT_LOG_TAG, fmt, ##arg)
-#define _E(fmt, arg...) LOG_V(DLOG_ERROR, AGENT_LOG_TAG, fmt, ##arg)
-#define _F(fmt, arg...) LOG_V(DLOG_FATAL, AGENT_LOG_TAG, fmt, ##arg)
+#define ml_logd(fmt, arg...) LOG_V(DLOG_DEBUG, AGENT_LOG_TAG, fmt, ##arg)
+#define ml_logi(fmt, arg...) LOG_V(DLOG_INFO, AGENT_LOG_TAG, fmt, ##arg)
+#define ml_logw(fmt, arg...) LOG_V(DLOG_WARN, AGENT_LOG_TAG, fmt, ##arg)
+#define ml_loge(fmt, arg...) LOG_V(DLOG_ERROR, AGENT_LOG_TAG, fmt, ##arg)
+#define ml_logf(fmt, arg...) LOG_V(DLOG_FATAL, AGENT_LOG_TAG, fmt, ##arg)
#else
#include <glib.h>
-#define _D g_debug
-#define _I g_info
-#define _W g_warning
-#define _E g_critical
-#define _F g_error
+#define ml_logd g_debug
+#define ml_logi g_info
+#define ml_logw g_warning
+#define ml_loge g_critical
+#define ml_logf g_error
#endif
#endif /* __LOG_H__ */
static void
handle_sigterm (int signo)
{
- _D ("received SIGTERM signal %d", signo);
+ ml_logd ("received SIGTERM signal %d", signo);
g_main_loop_quit (g_mainloop);
}
postinit (void)
{
int ret;
+
/** Register signal handler */
signal (SIGTERM, handle_sigterm);
static int
parse_args (gint *argc, gchar ***argv)
{
- GError *err;
+ GError *err = NULL;
GOptionContext *context = NULL;
gboolean ret;
context = g_option_context_new (NULL);
if (!context) {
- _E ("Failed to call g_option_context_new\n");
+ ml_loge ("Failed to call g_option_context_new\n");
return -ENOMEM;
}
g_option_context_set_help_enabled (context, TRUE);
g_option_context_set_ignore_unknown_options (context, TRUE);
- err = NULL;
ret = g_option_context_parse (context, argc, argv, &err);
g_option_context_free (context);
if (!ret) {
- _E ("Fail to option parsing: %s", err->message);
+ ml_loge ("Fail to option parsing: %s", err->message);
g_clear_error (&err);
return -EINVAL;
}
init_modules (NULL);
if (postinit () < 0)
- _E ("cannot init system");
+ ml_loge ("cannot init system");
/* Register package manager callback */
if (pkg_mgr_init () < 0) {
- _E ("cannot init package manager");
+ ml_loge ("cannot init package manager");
}
g_main_loop_run (g_mainloop);
g_mainloop = NULL;
if (pkg_mgr_deinit () < 0)
- _W ("cannot finalize package manager");
+ ml_logw ("cannot finalize package manager");
return 0;
}
db.connectDB ();
db.set_model (name, path, is_active, description, app_info, &version);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.update_model_description (name, version, description);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.activate_model (name, version);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.get_model (name, model_info, version);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.get_model (name, model_info, -1);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.get_model (name, all_model_list, 0);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.delete_model (name, version);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
probe_model_module (void *data)
{
int ret = 0;
- _D ("probe_model_module");
+
+ ml_logd ("probe_model_module");
g_gdbus_instance = gdbus_get_model_instance ();
if (NULL == g_gdbus_instance) {
- _E ("cannot get a dbus instance for the %s interface\n", DBUS_MODEL_INTERFACE);
+ ml_loge ("cannot get a dbus instance for the %s interface\n", DBUS_MODEL_INTERFACE);
return -ENOSYS;
}
ret = gdbus_connect_signal (g_gdbus_instance, ARRAY_SIZE (handler_infos), handler_infos);
if (ret < 0) {
- _E ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
+ ml_loge ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
ret = -ENOSYS;
goto out;
}
ret = gdbus_export_interface (g_gdbus_instance, DBUS_MODEL_PATH);
if (ret < 0) {
- _E ("cannot export the dbus interface '%s' at the object path '%s'\n",
+ ml_loge ("cannot export the dbus interface '%s' at the object path '%s'\n",
DBUS_MODEL_INTERFACE, DBUS_MODEL_PATH);
ret = -ENOSYS;
goto out_disconnect;
elem_n = elem->next;
if (module->probe && module->probe (data) != 0) {
- _E ("[%s] probe fail", module->name);
+ ml_loge ("[%s] probe fail", module->name);
module_head = g_list_remove (module_head, (gconstpointer) module);
elem = elem_n;
continue;
pipeline_s *p;
if (!data) {
- _E ("internal error, the data should not be NULL");
+ ml_loge ("internal error, the data should not be NULL");
return;
}
db.connectDB ();
db.set_pipeline (service_name, pipeline_desc);
} catch (const std::invalid_argument &e) {
- _E ("An exception occurred during write to the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during write to the DB. Error message: %s", e.what ());
result = -EINVAL;
} catch (const std::exception &e) {
- _E ("An exception occurred during write to the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during write to the DB. Error message: %s", e.what ());
result = -EIO;
}
db.disconnectDB ();
if (result) {
- _E ("Failed to set pipeline description of %s", service_name);
+ ml_loge ("Failed to set pipeline description of %s", service_name);
machinelearning_service_pipeline_complete_set_pipeline (obj, invoc, result);
return TRUE;
}
db.connectDB ();
db.get_pipeline (service_name, stored_pipeline_description);
} catch (const std::invalid_argument &e) {
- _E ("An exception occurred during read the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during read the DB. Error message: %s", e.what ());
result = -EINVAL;
} catch (const std::exception &e) {
- _E ("An exception occurred during read the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during read the DB. Error message: %s", e.what ());
result = -EIO;
}
db.disconnectDB ();
if (result) {
- _E ("Failed to get pipeline description of %s", service_name);
+ ml_loge ("Failed to get pipeline description of %s", service_name);
}
machinelearning_service_pipeline_complete_get_pipeline (
db.connectDB ();
db.delete_pipeline (service_name);
} catch (const std::invalid_argument &e) {
- _E ("An exception occurred during delete an item in the DB. Error message: %s",
+ ml_loge ("An exception occurred during delete an item in the DB. Error message: %s",
e.what ());
result = -EINVAL;
} catch (const std::exception &e) {
- _E ("An exception occurred during delete an item in the DB. Error message: %s",
+ ml_loge ("An exception occurred during delete an item in the DB. Error message: %s",
e.what ());
result = -EIO;
}
db.disconnectDB ();
if (result) {
- _E ("Failed to delete the pipeline description of %s", service_name);
+ ml_loge ("Failed to delete the pipeline description of %s", service_name);
machinelearning_service_pipeline_complete_delete_pipeline (obj, invoc, result);
return TRUE;
}
db.connectDB ();
db.get_pipeline (service_name, stored_pipeline_description);
} catch (const std::invalid_argument &e) {
- _E ("An exception occurred during read the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during read the DB. Error message: %s", e.what ());
result = -EINVAL;
} catch (const std::exception &e) {
- _E ("An exception occurred during read the DB. Error message: %s", e.what ());
+ ml_loge ("An exception occurred during read the DB. Error message: %s", e.what ());
result = -EIO;
}
db.disconnectDB ();
if (result) {
- _E ("Failed to launch pipeline of %s", service_name);
+ ml_loge ("Failed to launch pipeline of %s", service_name);
machinelearning_service_pipeline_complete_launch_pipeline (obj, invoc, result, -1);
return TRUE;
}
pipeline = gst_parse_launch (stored_pipeline_description.c_str (), &err);
if (!pipeline || err) {
- _E ("gst_parse_launch with %s Failed. error msg: %s",
+ ml_loge ("gst_parse_launch with %s Failed. error msg: %s",
stored_pipeline_description.c_str (), (err) ? err->message : "unknown reason");
g_clear_error (&err);
/** now set pipeline as paused state */
sc_ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
if (sc_ret == GST_STATE_CHANGE_FAILURE) {
- _E ("Failed to set the state of the pipeline to PAUSED. For the detail, please check the GStreamer log message. The input pipeline was %s",
+ ml_loge ("Failed to set the state of the pipeline to PAUSED. For the detail, please check the GStreamer log message. The input pipeline was %s",
stored_pipeline_description.c_str ());
gst_object_unref (pipeline);
p = (pipeline_s *) g_hash_table_lookup (pipeline_table, GINT_TO_POINTER (id));
if (!p) {
- _E ("The callback start_pipeline is called, but there is no pipeline matched with ID.");
+ ml_loge ("The callback start_pipeline is called, but there is no pipeline matched with ID.");
G_UNLOCK (pipeline_table_lock);
result = -EINVAL;
} else {
g_mutex_unlock (&p->lock);
if (sc_ret == GST_STATE_CHANGE_FAILURE) {
- _E ("Failed to set the state of the pipline to PLAYING whose service name is %s.",
+ ml_loge ("Failed to set the state of the pipline to PLAYING whose service name is %s.",
p->service_name);
result = -ESTRPIPE;
}
p = (pipeline_s *) g_hash_table_lookup (pipeline_table, GINT_TO_POINTER (id));
if (!p) {
- _E ("The callback stop_pipeline is called, but there is no pipeline matched with ID.");
+ ml_loge ("The callback stop_pipeline is called, but there is no pipeline matched with ID.");
G_UNLOCK (pipeline_table_lock);
result = -EINVAL;
} else {
g_mutex_unlock (&p->lock);
if (sc_ret == GST_STATE_CHANGE_FAILURE) {
- _E ("Failed to set the state of the pipline to PAUSED whose service name is %s.",
+ ml_loge ("Failed to set the state of the pipline to PAUSED whose service name is %s.",
p->service_name);
result = -ESTRPIPE;
}
p = (pipeline_s *) g_hash_table_lookup (pipeline_table, GINT_TO_POINTER (id));
if (!p) {
- _E ("The callback destroy_pipeline is called, but there is no pipeline matched with ID.");
+ ml_loge ("The callback destroy_pipeline is called, but there is no pipeline matched with ID.");
result = -EINVAL;
} else {
/**
* sc_ret = gst_element_set_state (p->element, GST_STATE_NULL);
* g_mutex_unlock (&p->lock);
* if (sc_ret == GST_STATE_CHANGE_FAILURE) {
- * _E ("Failed to set the state of the pipeline to NULL whose service name is %s. Destroy it anyway.", p->service_name);
+ * ml_loge ("Failed to set the state of the pipeline to NULL whose service name is %s. Destroy it anyway.", p->service_name);
* result = -ESTRPIPE;
* }
*/
p = (pipeline_s *) g_hash_table_lookup (pipeline_table, GINT_TO_POINTER (id));
if (!p) {
- _E ("The callback get_state is called, but there is no pipeline matched with ID.");
+ ml_loge ("The callback get_state is called, but there is no pipeline matched with ID.");
result = -EINVAL;
machinelearning_service_pipeline_complete_get_state (obj, invoc, result, (gint) state);
G_UNLOCK (pipeline_table_lock);
g_mutex_unlock (&p->lock);
if (sc_ret == GST_STATE_CHANGE_FAILURE) {
- _E ("Failed to get the state of the pipline whose service name is %s.", p->service_name);
+ ml_loge ("Failed to get the state of the pipline whose service name is %s.", p->service_name);
result = -ESTRPIPE;
machinelearning_service_pipeline_complete_get_state (obj, invoc, result, (gint) state);
return TRUE;
g_gdbus_instance = gdbus_get_pipeline_instance ();
if (g_gdbus_instance == NULL) {
- _E ("cannot get a dbus instance for the %s interface\n", DBUS_PIPELINE_INTERFACE);
+ ml_loge ("cannot get a dbus instance for the %s interface\n", DBUS_PIPELINE_INTERFACE);
return -ENOSYS;
}
ret = gdbus_connect_signal (g_gdbus_instance, ARRAY_SIZE (handler_infos), handler_infos);
if (ret < 0) {
- _E ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
+ ml_loge ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
ret = -ENOSYS;
goto out;
}
ret = gdbus_export_interface (g_gdbus_instance, DBUS_PIPELINE_PATH);
if (ret < 0) {
- _E ("cannot export the dbus interface '%s' at the object path '%s'\n",
+ ml_loge ("cannot export the dbus interface '%s' at the object path '%s'\n",
DBUS_PIPELINE_INTERFACE, DBUS_PIPELINE_PATH);
ret = -ENOSYS;
goto out_disconnect;
db.connectDB ();
db.set_resource (name, path, description, app_info);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.get_resource (name, res_info);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
db.connectDB ();
db.delete_resource (name);
} catch (const std::invalid_argument &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EINVAL;
} catch (const std::exception &e) {
- _E ("%s", e.what ());
+ ml_loge ("%s", e.what ());
ret = -EIO;
}
probe_resource_module (void *data)
{
int ret = 0;
- _D ("probe_resource_module");
+
+ ml_logd("probe_resource_module");
g_gdbus_res_instance = gdbus_get_resource_instance ();
if (NULL == g_gdbus_res_instance) {
- _E ("cannot get a dbus instance for the %s interface\n", DBUS_RESOURCE_INTERFACE);
+ ml_loge ("cannot get a dbus instance for the %s interface\n", DBUS_RESOURCE_INTERFACE);
return -ENOSYS;
}
ret = gdbus_connect_signal (
g_gdbus_res_instance, ARRAY_SIZE (res_handler_infos), res_handler_infos);
if (ret < 0) {
- _E ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
+ ml_loge ("cannot register callbacks as the dbus method invocation handlers\n ret: %d", ret);
ret = -ENOSYS;
goto out;
}
ret = gdbus_export_interface (g_gdbus_res_instance, DBUS_RESOURCE_PATH);
if (ret < 0) {
- _E ("cannot export the dbus interface '%s' at the object path '%s'\n",
+ ml_loge ("cannot export the dbus interface '%s' at the object path '%s'\n",
DBUS_RESOURCE_INTERFACE, DBUS_RESOURCE_PATH);
ret = -ENOSYS;
goto out_disconnect;
rc = sqlite3_open (_path.c_str (), &_db);
if (rc != SQLITE_OK) {
- _E ("Failed to open database: %s (%d)", sqlite3_errmsg (_db), rc);
+ ml_loge ("Failed to open database: %s (%d)", sqlite3_errmsg (_db), rc);
goto error;
}
rc = sqlite3_prepare_v2 (_db, sql.c_str (), -1, &res, nullptr);
if (rc != SQLITE_OK) {
- _W ("Failed to get the version of table %s: %s (%d)", tbl_name.c_str (),
+ ml_logw ("Failed to get the version of table %s: %s (%d)", tbl_name.c_str (),
sqlite3_errmsg (_db), rc);
return -1;
}
sqlite3_finalize (res);
if (!is_done)
- _W ("Failed to update version of table %s.", tbl_name.c_str ());
+ ml_logw ("Failed to update version of table %s.", tbl_name.c_str ());
return is_done;
}
rc = sqlite3_exec (_db, sql.c_str (), nullptr, nullptr, &errmsg);
if (rc != SQLITE_OK) {
- _W ("Failed to create table %s: %s (%d)", tbl_name.c_str (), errmsg, rc);
+ ml_logw ("Failed to create table %s: %s (%d)", tbl_name.c_str (), errmsg, rc);
sqlite3_clear_errmsg (errmsg);
return false;
}
rc = sqlite3_exec (_db, begin ? "BEGIN TRANSACTION;" : "END TRANSACTION;",
nullptr, nullptr, &errmsg);
if (rc != SQLITE_OK)
- _W ("Failed to %s transaction: %s (%d)", begin ? "begin" : "end", errmsg, rc);
+ ml_logw ("Failed to %s transaction: %s (%d)", begin ? "begin" : "end", errmsg, rc);
sqlite3_clear_errmsg (errmsg);
return (rc == SQLITE_OK);
long long int last_id = sqlite3_last_insert_rowid (_db);
if (last_id == 0) {
- _E ("Failed to get last inserted row id: %s", sqlite3_errmsg (_db));
+ ml_loge ("Failed to get last inserted row id: %s", sqlite3_errmsg (_db));
throw std::runtime_error ("Failed to get last inserted row id.");
}
throw std::runtime_error ("Failed to end transaction.");
if (_version == 0) {
- _E ("Failed to get model version with name %s: %s", name.c_str (),
+ ml_loge ("Failed to get model version with name %s: %s", name.c_str (),
sqlite3_errmsg (_db));
throw std::invalid_argument ("Failed to get model version of " + name);
}
long long int last_id = sqlite3_last_insert_rowid (_db);
if (last_id == 0) {
- _E ("Failed to get last inserted row id: %s", sqlite3_errmsg (_db));
+ ml_loge ("Failed to get last inserted row id: %s", sqlite3_errmsg (_db));
throw std::runtime_error ("Failed to get last inserted row id.");
}
}
#include "../dbus/test-dbus-interface.h"
#include "dbus-interface.h"
#include "gdbus-util.h"
+#include "log.h"
#include "test-dbus.h"
/**
/* Test: Call the DBus method */
machinelearning_service_test_call_get_state_sync (proxy, &status, &result, NULL, &error);
if (error != NULL) {
- g_critical ("Error : %s", error->message);
+ ml_loge ("Error : %s", error->message);
g_error_free (error);
FAIL ();
}
try {
testing::InitGoogleTest (&argc, argv);
} catch (...) {
- g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+ ml_logw ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
}
try {
result = RUN_ALL_TESTS ();
} catch (...) {
- g_warning ("catch `testing::internal::GoogleTestFailureException`");
+ ml_logw ("catch `testing::internal::GoogleTestFailureException`");
}
return result;
#include <gtest/gtest.h>
#include <gio/gio.h>
+#include "log.h"
#include "ml-agent-interface.h"
/**
try {
testing::InitGoogleTest (&argc, argv);
} catch (...) {
- g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+ ml_logw ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
}
try {
result = RUN_ALL_TESTS ();
} catch (...) {
- g_warning ("catch `testing::internal::GoogleTestFailureException`");
+ ml_logw ("catch `testing::internal::GoogleTestFailureException`");
}
return result;
#include <gtest/gtest.h>
#include <gio/gio.h>
+#include "log.h"
#include "service-db.hh"
/**
try {
db.set_pipeline ("", "videotestsrc ! fakesink");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_pipeline ("test_key", "");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string pipeline_description;
db.get_pipeline ("", pipeline_description);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_pipeline ("");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_model ("", "model", true, "description", "", &version);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_model ("test", "", true, "description", "", &version);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_model ("test", "model", true, "", "", NULL);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
db.delete_model ("test", 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 0);
std::string model_description;
db.get_model ("", model_description, 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string model_description;
db.get_model ("test", model_description, -54321);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.update_model_description ("", 1, "description");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.update_model_description ("test", 1, "");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.update_model_description ("test", 0, "description");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.activate_model ("", 1);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.activate_model ("test", 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_model ("", 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_model ("test", version);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_model ("test", version);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_pipeline ("test", "videotestsrc ! fakesink");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string pd;
db.get_pipeline ("test", pd);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_pipeline ("test");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
guint version;
db.set_model ("test", "model", true, "description", "", &version);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.update_model_description ("test", 0, "description");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.activate_model ("test", 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string model_path;
db.get_model ("test", model_path, 0);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_model ("test", 0U);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_resource ("", "resource", "description", "");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_resource ("test", "", "description", "");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
db.delete_resource ("test");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 0);
std::string res_description;
db.get_resource ("", res_description);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string res_description;
db.get_resource ("test", res_description);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_resource ("");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_resource ("test");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.set_resource ("test", "resource", "description", "");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
std::string res_description;
db.get_resource ("test", res_description);
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
db.delete_resource ("test");
} catch (const std::exception &e) {
- g_critical ("Got Exception: %s", e.what ());
+ ml_loge ("Got Exception: %s", e.what ());
gotException = 1;
}
EXPECT_EQ (gotException, 1);
try {
testing::InitGoogleTest (&argc, argv);
} catch (...) {
- g_warning ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
+ ml_logw ("catch 'testing::internal::<unnamed>::ClassUniqueToAlwaysTrue'");
}
try {
result = RUN_ALL_TESTS ();
} catch (...) {
- g_warning ("catch `testing::internal::GoogleTestFailureException`");
+ ml_logw ("catch `testing::internal::GoogleTestFailureException`");
}
return result;
static void
init_test (void *data)
{
- g_debug ("init_test module");
+ ml_logd ("init_test module");
gdbus_initialize ();
}
probe_test (void *data)
{
int ret = 0;
- g_debug ("probe_test");
+
+ ml_logd ("probe_test");
+
g_gdbus_instance = gdbus_get_instance_test ();
if (g_gdbus_instance == NULL) {
- g_critical ("Cannot get the dbus instance for the %s interface.",
+ 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) {
- g_critical ("Cannot register callbacks as the dbus method invocation handlers (ret: %d).",
+ 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) {
- g_critical ("Cannot export the dbus interface '%s' at the object path '%s'.",
+ ml_loge ("Cannot export the dbus interface '%s' at the object path '%s'.",
DBUS_TEST_INTERFACE, DBUS_TEST_PATH);
ret = -ENOSYS;
goto out_disconnect;