virtual int getDspmSize (uint32_t *dspm) const { return -EPERM; }
virtual int getNextRequest (int32_t *req_id) const { return -EPERM; }
- virtual int checkSanity () { return 0; }
+ virtual int checkSanity () { return -EPERM; }
/** The below requires initialized device */
/** @brief check whether the device is ready (true) or busy (false) */
/** @brief run inference with the input config */
virtual int runInput (input_config_t *input) const { return -EPERM; }
/** @brief stop all requests. The stopped requests should be notified */
- virtual int stop () const { return 0; }
+ virtual int stop () const { return -EPERM; }
/** @brief stop the target request with the given id obtained by runInput() */
virtual int stop_target (int id) const { return -EPERM; }
~TrinityEmulAPI ();
int open ();
+ int checkSanity ();
int getNextRequest (int32_t *req_id) const;
device_state_t isReady () const;
}
/**
+ * @brief create API instance not using derived class
+ */
+TEST (ne_core_npu_test, create_instance_base_class_n) {
+ std::unique_ptr<DriverAPI> api (new DriverAPI (0));
+
+ EXPECT_EQ (api->open (), -ENODEV);
+ EXPECT_EQ (api->checkSanity (), -EPERM);
+ EXPECT_EQ (api->getAPILevel (nullptr), -EPERM);
+ EXPECT_EQ (api->getTops (nullptr), -EPERM);
+ EXPECT_EQ (api->getDspmSize (nullptr), -EPERM);
+ EXPECT_EQ (api->getNextRequest (nullptr), -EPERM);
+ EXPECT_LT (api->isReady (), 0);
+ EXPECT_EQ (api->alloc (0), -EPERM);
+ EXPECT_EQ (api->dealloc (0), -EPERM);
+ EXPECT_EQ (api->mmap (0, 0), nullptr);
+ EXPECT_EQ (api->munmap (nullptr, 0), -EPERM);
+ EXPECT_EQ (api->getMemoryStatus (nullptr, nullptr), -EPERM);
+ EXPECT_EQ (api->runInput (nullptr), -EPERM);
+ EXPECT_EQ (api->stop (), -EPERM);
+ EXPECT_EQ (api->stop_target (0), -EPERM);
+ EXPECT_EQ (api->registerModel (nullptr), -EPERM);
+ EXPECT_EQ (api->deregisterModel (0), -EPERM);
+ EXPECT_EQ (api->getProfile (0, nullptr), -EPERM);
+ EXPECT_EQ (api->getStatApps (nullptr), -EPERM);
+ EXPECT_EQ (api->getStatReqs (0, nullptr), -EPERM);
+}
+
+/**
* @brief create API instances without initailiation
*/
TEST (ne_core_npu_test, create_instance_uninitialized_n) {