Coverity issue on scheduler (#7072)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 2 Sep 2019 00:56:33 +0000 (09:56 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Mon, 2 Sep 2019 00:56:33 +0000 (09:56 +0900)
- Unreached default in switch-case
- Unchecked return of library call

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/core/src/backend/JSONExecTime.cc
runtimes/neurun/test/core/backend/ExecTime.test.cc
runtimes/neurun/test/core/compiler/Scheduler.cc

index 2c2fc08..e2404b2 100644 (file)
@@ -119,8 +119,6 @@ void JSON::readOperation(const std::string &backend, const std::string &operatio
           } // we ignore the records for unsupported backends
           break;
         }
-        default:
-          break;
       }
       number_of_commas++;
       int_buf.clear();
index 778fa62..ff67f65 100644 (file)
@@ -67,7 +67,7 @@ TEST(ExecTime, roundtrip_ok)
     et.uploadOperationsExecTime();
   }
   // clean up
-  remove("exec_time.json");
+  EXPECT_EQ(remove("exec_time.json"), 0);
 }
 
 TEST(ExecTime, structure)
@@ -91,6 +91,6 @@ TEST(ExecTime, structure)
     et.uploadOperationsExecTime();
   }
   // clean up
-  remove("exec_time.json");
+  EXPECT_EQ(remove("exec_time.json"), 0);
 }
 } // unnamed namespace
index 4a56b08..9fab9d7 100644 (file)
@@ -288,7 +288,10 @@ protected:
     _mock_backends = {_cpu_backend, _gpu_backend, _npu_backend};
 
     // Remove previous profile data if it exists
-    remove("exec_time.json");
+    if (!remove("exec_time.json"))
+    {
+      // DO NOTHING (no profile data)
+    }
 
     // Remember original value of 'EXECUTOR' environment variable
     char *executor = std::getenv("EXECUTOR");
@@ -300,7 +303,7 @@ protected:
     delete _cpu_backend;
     delete _gpu_backend;
     delete _npu_backend;
-    remove("exec_time.json");
+    EXPECT_EQ(remove("exec_time.json"), 0);
     setenv("EXECUTOR", _original_executor.c_str(), true);
   }