[CONF] Remove iniparser's duplicated loads & error messages
authorDongju Chae <dongju.chae@samsung.com>
Wed, 27 Nov 2019 07:44:04 +0000 (16:44 +0900)
committer함명주/On-Device Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Wed, 27 Nov 2019 09:27:53 +0000 (18:27 +0900)
This commit removes iniparser's duplicated loads and error messages.
The origianl codes used to call load_conf() multiple times, generating
meaningless error messages.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
src/core/ne-conf.c
src/core/npu/NPUdrvAPI.c
src/test/unittests/ne_core_comm_ip_test.cpp
src/test/unittests/ne_core_gem_test.cpp
src/test/unittests/ne_core_handler_test.cpp
src/test/unittests/ne_core_inf_test.cpp
src/test/unittests/ne_core_mem_test.cpp
src/test/unittests/ne_core_npu_test.cpp
src/test/unittests/ne_core_tlb_test.cpp

index 7c46669..5fbe699 100644 (file)
@@ -144,24 +144,13 @@ int load_conf(const char *inipath)
   load_conf_default();
 
   /* Load up config from ini if available */
-
-  if (inipath) {
-    ini = iniparser_load(inipath);
-    if (ini == NULL)
-      fprintf(stderr, "Cannot load .ini file (%s)\n", inipath);
-  } else {
-    ini = iniparser_load(default_ini_path);
-    if (ini == NULL)
-      fprintf(stderr, "Cannot load .ini file (%s)\n", default_ini_path);
-  }
-
+  ini = iniparser_load(inipath != NULL ? inipath : default_ini_path);
   if (ini) {
     load_conf_ini(ini, &config);
     iniparser_freedict(ini);
   }
 
   /* Load up config from envvar if available */
-
   load_conf_envvar(&config);
 
   return 0;
index f8db2de..2e92446 100644 (file)
@@ -93,8 +93,6 @@ void init_npu_api(void)
 {
   int i;
 
-  load_conf(NULL);
-
   pthread_mutex_init(&napi_priv.mutex, NULL);
   for (i=0; i<MAX_NUM_DEVICE; i++) {
     napi_priv.npu_fd_table[i] = NULL;
index 1601910..f6a9362 100644 (file)
@@ -293,11 +293,7 @@ TEST (ne_core_ip_test_default_conf, registerNPUmodel_large_size)
 int
 main (int argc, char **argv)
 {
-  int ret = 0;
-
   testing::InitGoogleTest (&argc, argv);
 
-  ret = RUN_ALL_TESTS();
-
-  return ret;
+  return RUN_ALL_TESTS();
 }
index e908c5d..592c7e4 100644 (file)
@@ -205,8 +205,7 @@ TEST (ne_core_gem_test, self_import_dmabuf)
 int
 main (int argc, char **argv)
 {
-  /** NULL is OK because it will load load_conf_default */
-  load_conf (argv[1]);
+  load_conf (NULL);
 
   testing::InitGoogleTest (&argc, argv);
 
index 9e0b144..4b9392e 100644 (file)
@@ -200,13 +200,9 @@ TEST (ne_core_handler_test, start_stop_operation)
 int
 main (int argc, char **argv)
 {
-  int ret = 0;
-
-  load_conf (argv[1]);
+  load_conf (NULL);
 
   testing::InitGoogleTest (&argc, argv);
 
-  ret = RUN_ALL_TESTS();
-
-  return ret;
+  return RUN_ALL_TESTS();
 }
index 016201e..24e7647 100644 (file)
@@ -293,13 +293,7 @@ TEST (ne_core_inf_test, multiple_inputs)
 int
 main (int argc, char **argv)
 {
-  int ret = 0;
-
-  load_conf (argv[1]);
-
   testing::InitGoogleTest (&argc, argv);
 
-  ret = RUN_ALL_TESTS();
-
-  return ret;
+  return RUN_ALL_TESTS();
 }
index 16b85a9..443b26c 100644 (file)
@@ -621,8 +621,6 @@ TEST (ne_core_mem_test, get_next_buffer_modes)
 int
 main (int argc, char **argv)
 {
-  load_conf (argv[1]);
-
   testing::InitGoogleTest (&argc, argv);
 
   return RUN_ALL_TESTS();
index 91cc14d..560bf4f 100644 (file)
@@ -253,7 +253,7 @@ TEST (ne_core_npu_test, check_dev_status)
 int
 main (int argc, char **argv)
 {
-  load_conf (argv[1]);
+  load_conf (NULL);
 
   testing::InitGoogleTest (&argc, argv);
 
index d258a46..2608c7f 100644 (file)
@@ -225,7 +225,7 @@ TEST (ne_core_tlb_test, dev_operate_02_n)
 int
 main (int argc, char **argv)
 {
-  load_conf (argv[1]);
+  load_conf (NULL);
 
   testing::InitGoogleTest (&argc, argv);