diff --git a/WORKSPACE b/WORKSPACE index 10ca83b28c..7b1175531b 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -89,7 +89,7 @@ http_archive( git_repository( name = "mediapipe", remote = "https://github.com/openvinotoolkit/mediapipe", - commit = "c839182d40daae7270a29feba5bedd6330ccc2f8", # Cleanup and switch to tflite object detection (#16) + commit = "ac9ff003cd735f96a2e5501e32b2c941f6d4543d", # Updated CAPI calls (#21) ) # DEV mediapipe 1 source - adjust local repository path for build diff --git a/src/capi_frontend/capi.cpp b/src/capi_frontend/capi.cpp index 633921a159..c2672870f8 100644 --- a/src/capi_frontend/capi.cpp +++ b/src/capi_frontend/capi.cpp @@ -110,7 +110,7 @@ OVMS_Status* OVMS_ServerReady(OVMS_Server* serverPtr, bool* isReady) { *isReady = server.isReady(); return nullptr; } -OVMS_Status* OVMS_StatusGetCode(OVMS_Status* status, +OVMS_Status* OVMS_StatusCode(OVMS_Status* status, uint32_t* code) { if (status == nullptr) return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "status")); @@ -121,7 +121,7 @@ OVMS_Status* OVMS_StatusGetCode(OVMS_Status* status, return nullptr; } -OVMS_Status* OVMS_StatusGetDetails(OVMS_Status* status, +OVMS_Status* OVMS_StatusDetails(OVMS_Status* status, const char** details) { if (status == nullptr) return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "status")); @@ -181,7 +181,7 @@ void OVMS_ServerDelete(OVMS_Server* server) { // delete passed in ptr once multi server configuration is done } -OVMS_Status* OVMS_GetMetadataFieldByPointer(OVMS_Metadata* metadata, const char* pointer, const char** value, size_t* size) { +OVMS_Status* OVMS_MetadataFieldByPointer(OVMS_Metadata* metadata, const char* pointer, const char** value, size_t* size) { if (metadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "metadata")); } @@ -226,7 +226,7 @@ OVMS_Status* OVMS_SerializeMetadataToString(OVMS_Metadata* metadata, const char* return nullptr; } -OVMS_Status* OVMS_GetServerMetadata(OVMS_Server* server, OVMS_Metadata** metadata) { +OVMS_Status* OVMS_ServerMetadata(OVMS_Server* server, OVMS_Metadata** metadata) { if (server == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "server")); } @@ -612,7 +612,7 @@ OVMS_Status* OVMS_InferenceRequestInputRemoveData(OVMS_InferenceRequest* req, co return nullptr; } -OVMS_Status* OVMS_InferenceResponseGetOutput(OVMS_InferenceResponse* res, uint32_t id, const char** name, OVMS_DataType* datatype, const int64_t** shape, size_t* dimCount, const void** data, size_t* bytesize, OVMS_BufferType* bufferType, uint32_t* deviceId) { +OVMS_Status* OVMS_InferenceResponseOutput(OVMS_InferenceResponse* res, uint32_t id, const char** name, OVMS_DataType* datatype, const int64_t** shape, size_t* dimCount, const void** data, size_t* bytesize, OVMS_BufferType* bufferType, uint32_t* deviceId) { if (res == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "inference response")); } @@ -688,7 +688,7 @@ OVMS_Status* OVMS_InferenceResponseGetOutput(OVMS_InferenceResponse* res, uint32 return nullptr; } -OVMS_Status* OVMS_InferenceResponseGetOutputCount(OVMS_InferenceResponse* res, uint32_t* count) { +OVMS_Status* OVMS_InferenceResponseOutputCount(OVMS_InferenceResponse* res, uint32_t* count) { if (res == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "inference response")); } @@ -700,7 +700,7 @@ OVMS_Status* OVMS_InferenceResponseGetOutputCount(OVMS_InferenceResponse* res, u return nullptr; } -OVMS_Status* OVMS_InferenceResponseGetParameterCount(OVMS_InferenceResponse* res, uint32_t* count) { +OVMS_Status* OVMS_InferenceResponseParameterCount(OVMS_InferenceResponse* res, uint32_t* count) { if (res == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "inference response")); } @@ -712,7 +712,7 @@ OVMS_Status* OVMS_InferenceResponseGetParameterCount(OVMS_InferenceResponse* res return nullptr; } -OVMS_Status* OVMS_InferenceResponseGetParameter(OVMS_InferenceResponse* res, uint32_t id, OVMS_DataType* datatype, const void** data) { +OVMS_Status* OVMS_InferenceResponseParameter(OVMS_InferenceResponse* res, uint32_t id, OVMS_DataType* datatype, const void** data) { if (res == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "inference response")); } @@ -959,7 +959,7 @@ OVMS_Status* OVMS_GetServableMetadata(OVMS_Server* serverPtr, const char* servab return nullptr; } -OVMS_Status* OVMS_ServableMetadataGetInputCount(OVMS_ServableMetadata* servableMetadata, uint32_t* count) { +OVMS_Status* OVMS_ServableMetadataInputCount(OVMS_ServableMetadata* servableMetadata, uint32_t* count) { if (servableMetadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "servable metadata")); } @@ -971,7 +971,7 @@ OVMS_Status* OVMS_ServableMetadataGetInputCount(OVMS_ServableMetadata* servableM return nullptr; } -OVMS_Status* OVMS_ServableMetadataGetOutputCount(OVMS_ServableMetadata* servableMetadata, uint32_t* count) { +OVMS_Status* OVMS_ServableMetadataOutputCount(OVMS_ServableMetadata* servableMetadata, uint32_t* count) { if (servableMetadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "servable metadata")); } @@ -982,7 +982,7 @@ OVMS_Status* OVMS_ServableMetadataGetOutputCount(OVMS_ServableMetadata* servable *count = metadata->getOutputsInfo().size(); return nullptr; } -OVMS_Status* OVMS_ServableMetadataGetInput(OVMS_ServableMetadata* servableMetadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMin, int64_t** shapeMax) { +OVMS_Status* OVMS_ServableMetadataInput(OVMS_ServableMetadata* servableMetadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMin, int64_t** shapeMax) { if (servableMetadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "servable metadata")); } @@ -1040,7 +1040,7 @@ OVMS_Status* OVMS_ServableMetadataGetInput(OVMS_ServableMetadata* servableMetada return nullptr; } -OVMS_Status* OVMS_ServableMetadataGetOutput(OVMS_ServableMetadata* servableMetadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMin, int64_t** shapeMax) { +OVMS_Status* OVMS_ServableMetadataOutput(OVMS_ServableMetadata* servableMetadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMin, int64_t** shapeMax) { if (servableMetadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "servable metadata")); } @@ -1098,7 +1098,7 @@ OVMS_Status* OVMS_ServableMetadataGetOutput(OVMS_ServableMetadata* servableMetad return nullptr; } -OVMS_Status* OVMS_ServableMetadataGetInfo(OVMS_ServableMetadata* servableMetadata, const void** info) { +OVMS_Status* OVMS_ServableMetadataInfo(OVMS_ServableMetadata* servableMetadata, const void** info) { if (servableMetadata == nullptr) { return reinterpret_cast(new Status(StatusCode::NONEXISTENT_PTR, "servable metadata")); } diff --git a/src/main_benchmark.cpp b/src/main_benchmark.cpp index 45dde58ab9..8b2e7ca9ef 100644 --- a/src/main_benchmark.cpp +++ b/src/main_benchmark.cpp @@ -262,8 +262,8 @@ int main(int argc, char** argv) { if (res) { uint32_t code = 0; const char* details = nullptr; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); std::cout << "Error starting the server. Code:" << code << "; details:" << details << std::endl; OVMS_ServerDelete(srv); @@ -327,8 +327,8 @@ int main(int argc, char** argv) { if (res != nullptr) { uint32_t code = 0; const char* details = 0; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); std::cerr << "Error occured during inference. Code:" << code << ", details:" << details << std::endl; OVMS_StatusDelete(res); diff --git a/src/main_capi.c b/src/main_capi.c index 95c3f3589a..96a4d4965d 100644 --- a/src/main_capi.c +++ b/src/main_capi.c @@ -44,8 +44,8 @@ int main() { uint32_t code = 0; const char* details = 0; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); fprintf(stderr, "error during start: code %d, details: %s\n", code, details); @@ -82,8 +82,8 @@ int main() { uint32_t code = 0; const char* details = 0; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); fprintf(stderr, "error during inference: code %d, details: %s\n", code, details); @@ -98,14 +98,14 @@ int main() { } const char* oName = NULL; // not needed - OVMS_DataType oType; // not needed - const int64_t* oShape; // not needed - size_t oDims; // not needed + OVMS_DataType oType; // not needed + const int64_t* oShape; // not needed + size_t oDims; // not needed const void* oData = NULL; size_t oNumBytes = 0; OVMS_BufferType oBuffType; // not needed - uint32_t oDeviceId; // not needed - OVMS_InferenceResponseGetOutput(response, 0, &oName, &oType, &oShape, &oDims, &oData, &oNumBytes, &oBuffType, &oDeviceId); + uint32_t oDeviceId; // not needed + OVMS_InferenceResponseOutput(response, 0, &oName, &oType, &oShape, &oDims, &oData, &oNumBytes, &oBuffType, &oDeviceId); float expectedOutput[DATA_SIZE]; for (int i = 0; i < NUM_ELEMENTS; i++) { diff --git a/src/main_capi.cpp b/src/main_capi.cpp index ca376ba06b..1b1d2e9928 100644 --- a/src/main_capi.cpp +++ b/src/main_capi.cpp @@ -86,10 +86,10 @@ int main(int argc, char** argv) { OVMS_ServerNew(&srv); OVMS_Metadata* metadata = 0; - OVMS_GetServerMetadata(srv, &metadata); + OVMS_ServerMetadata(srv, &metadata); const char* version = 0; size_t size; - OVMS_GetMetadataFieldByPointer(metadata, "/version", &version, &size); + OVMS_MetadataFieldByPointer(metadata, "/version", &version, &size); std::cout << "OVMS Version: " << version << std::endl; OVMS_StringFree(version); @@ -105,8 +105,8 @@ int main(int argc, char** argv) { uint32_t code = 0; const char* details = nullptr; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); std::cerr << "error during start: code:" << code << "; details:" << details << std::endl; OVMS_StatusDelete(res); @@ -132,8 +132,8 @@ int main(int argc, char** argv) { if (res != nullptr) { uint32_t code = 0; const char* details = 0; - OVMS_StatusGetCode(res, &code); - OVMS_StatusGetDetails(res, &details); + OVMS_StatusCode(res, &code); + OVMS_StatusDetails(res, &details); std::cout << "Error occured during inference. Code:" << code << ", details:" << details << std::endl; OVMS_StatusDelete(res); @@ -145,7 +145,7 @@ int main(int argc, char** argv) { } // read output uint32_t outputCount = 0; - OVMS_InferenceResponseGetOutputCount(response, &outputCount); + OVMS_InferenceResponseOutputCount(response, &outputCount); const void* voutputData; size_t bytesize = 0; uint32_t outputId = outputCount - 1; @@ -155,7 +155,7 @@ int main(int argc, char** argv) { OVMS_BufferType bufferType = (OVMS_BufferType)42; uint32_t deviceId = 42; const char* outputName{nullptr}; - OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId); + OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId); std::stringstream ss; ss << "Got response from OVMS via C-API. " diff --git a/src/mediapipe_calculators/modelapiovmsinferencecalculator.cc b/src/mediapipe_calculators/modelapiovmsinferencecalculator.cc index 5758dc0157..485dbfb432 100644 --- a/src/mediapipe_calculators/modelapiovmsinferencecalculator.cc +++ b/src/mediapipe_calculators/modelapiovmsinferencecalculator.cc @@ -43,8 +43,8 @@ namespace { if (err != nullptr) { \ uint32_t code = 0; \ const char* msg = nullptr; \ - OVMS_StatusGetCode(err, &code); \ - OVMS_StatusGetDetails(err, &msg); \ + OVMS_StatusCode(err, &code); \ + OVMS_StatusDetails(err, &msg); \ LOG(INFO) << "Error encountred in OVMSCalculator:" << msg << " code: " << code; \ OVMS_StatusDelete(err); \ RET_CHECK(err == nullptr); \ @@ -127,7 +127,7 @@ class ModelAPISideFeedCalculator : public CalculatorBase { // TODO decide which will be easier to migrating later // using OV tensor by default will be more performant // but harder to migrate - /* + /* cc->Outputs().Tag(tag).Set(); */ LOG(INFO) << "setting output tag:" << tag << " to OVTensor"; diff --git a/src/mediapipe_calculators/ovms_calculator.cc b/src/mediapipe_calculators/ovms_calculator.cc index c6e6321ad5..94249169ac 100644 --- a/src/mediapipe_calculators/ovms_calculator.cc +++ b/src/mediapipe_calculators/ovms_calculator.cc @@ -40,8 +40,8 @@ namespace { if (err != nullptr) { \ uint32_t code = 0; \ const char* msg = nullptr; \ - OVMS_StatusGetCode(err, &code); \ - OVMS_StatusGetDetails(err, &msg); \ + OVMS_StatusCode(err, &code); \ + OVMS_StatusDetails(err, &msg); \ LOG(INFO) << "Error encountred in OVMSCalculator:" << msg << " code: " << code; \ OVMS_StatusDelete(err); \ RET_CHECK(err == nullptr); \ @@ -254,10 +254,10 @@ class OVMSOVCalculator : public CalculatorBase { CREATE_GUARD(responseGuard, OVMS_InferenceResponse, response); // verify GetOutputCount uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); RET_CHECK(outputCount == cc->Outputs().GetTags().size()); uint32_t parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); // TODO handle output filtering. Graph definition could suggest // that we are not interested in all outputs from OVMS Inference const void* voutputData; @@ -269,7 +269,7 @@ class OVMSOVCalculator : public CalculatorBase { uint32_t deviceId = 42; const char* outputName{nullptr}; for (size_t i = 0; i < outputCount; ++i) { - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, i, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, i, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ov::Tensor* outOvTensor = makeOvTensor(datatype, shape, dimCount, voutputData, bytesize); cc->Outputs().Tag(outputNameToTag.at(outputName)).Add(outOvTensor, cc->InputTimestamp()); } diff --git a/src/ovms.h b/src/ovms.h index 239c62cd6b..268aef207d 100644 --- a/src/ovms.h +++ b/src/ovms.h @@ -32,8 +32,8 @@ typedef struct OVMS_ModelsSettings_ OVMS_ModelsSettings; typedef struct OVMS_ServableMetadata_ OVMS_ServableMetadata; typedef struct OVMS_Metadata_ OVMS_Metadata; -#define OVMS_API_VERSION_MAJOR 0 -#define OVMS_API_VERSION_MINOR 3 +#define OVMS_API_VERSION_MAJOR 1 +#define OVMS_API_VERSION_MINOR 0 // Function to retrieve OVMS API version. // @@ -122,7 +122,7 @@ void OVMS_StatusDelete(OVMS_Status* status); // \param status The status object // \param code Value to be set // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_StatusGetCode(OVMS_Status* status, +OVMS_Status* OVMS_StatusCode(OVMS_Status* status, uint32_t* code); // Get value of metadata field by json pointer @@ -131,7 +131,7 @@ OVMS_Status* OVMS_StatusGetCode(OVMS_Status* status, // \param pointer Json pointer (https://datatracker.ietf.org/doc/html/rfc6901) // \param value Buffer that will contain fetched value, should be freed by user using OVMS_StringFree call // \param size Lenght of fetched value -OVMS_Status* OVMS_GetMetadataFieldByPointer(OVMS_Metadata* metadata, const char* pointer, const char** value, size_t* size); +OVMS_Status* OVMS_MetadataFieldByPointer(OVMS_Metadata* metadata, const char* pointer, const char** value, size_t* size); // Serialize metadata object into json // // \param metadata The metadata object @@ -143,7 +143,7 @@ OVMS_Status* OVMS_SerializeMetadataToString(OVMS_Metadata* metadata, const char* // // \param server The server object (reserved for future use) // \param metadata The metadata object -OVMS_Status* OVMS_GetServerMetadata(OVMS_Server* server, OVMS_Metadata** metadata); +OVMS_Status* OVMS_ServerMetadata(OVMS_Server* server, OVMS_Metadata** metadata); // Release memory used for holding metadata object // @@ -160,7 +160,7 @@ void OVMS_StringFree(const char* ptr); // \param status The status object // \param details The status details // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_StatusGetDetails(OVMS_Status* status, +OVMS_Status* OVMS_StatusDetails(OVMS_Status* status, const char** details); //// @@ -461,7 +461,7 @@ OVMS_Status* OVMS_InferenceRequestRemoveParameter(OVMS_InferenceRequest* request // \param response The response object // \param count The value to be set // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_InferenceResponseGetOutputCount(OVMS_InferenceResponse* response, uint32_t* count); +OVMS_Status* OVMS_InferenceResponseOutputCount(OVMS_InferenceResponse* response, uint32_t* count); // Get all information about an output from the response by providing output id. // @@ -476,14 +476,14 @@ OVMS_Status* OVMS_InferenceResponseGetOutputCount(OVMS_InferenceResponse* respon // \param bufferType The buffer type of the data // \param deviceId The device id of the data memory buffer // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_InferenceResponseGetOutput(OVMS_InferenceResponse* response, uint32_t id, const char** name, OVMS_DataType* datatype, const int64_t** shape, size_t* dimCount, const void** data, size_t* byteSize, OVMS_BufferType* bufferType, uint32_t* deviceId); +OVMS_Status* OVMS_InferenceResponseOutput(OVMS_InferenceResponse* response, uint32_t id, const char** name, OVMS_DataType* datatype, const int64_t** shape, size_t* dimCount, const void** data, size_t* byteSize, OVMS_BufferType* bufferType, uint32_t* deviceId); // Get the number of parameters in response. // // \param response The response object // \param count The parameter count to be set // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_InferenceResponseGetParameterCount(OVMS_InferenceResponse* response, uint32_t* count); +OVMS_Status* OVMS_InferenceResponseParameterCount(OVMS_InferenceResponse* response, uint32_t* count); // Extract information about parameter by providing its id. // @@ -492,7 +492,7 @@ OVMS_Status* OVMS_InferenceResponseGetParameterCount(OVMS_InferenceResponse* res // \param datatype The data type of the parameter // \param data The parameter content // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_InferenceResponseGetParameter(OVMS_InferenceResponse* response, uint32_t id, OVMS_DataType* datatype, const void** data); +OVMS_Status* OVMS_InferenceResponseParameter(OVMS_InferenceResponse* response, uint32_t id, OVMS_DataType* datatype, const void** data); // Delete OVMS_InferenceResponse object. // @@ -525,14 +525,14 @@ OVMS_Status* OVMS_GetServableMetadata(OVMS_Server* server, const char* servableN // \param metadata The metadata object // \param count The parameter count to be set // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_ServableMetadataGetInputCount(OVMS_ServableMetadata* metadata, uint32_t* count); +OVMS_Status* OVMS_ServableMetadataInputCount(OVMS_ServableMetadata* metadata, uint32_t* count); // Get the number of outputs of servable. // // \param metadata The metadata object // \param count The parameter count to be set // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_ServableMetadataGetOutputCount(OVMS_ServableMetadata* metadata, uint32_t* count); +OVMS_Status* OVMS_ServableMetadataOutputCount(OVMS_ServableMetadata* metadata, uint32_t* count); // Get the metadata of servable input given the index // @@ -548,7 +548,7 @@ OVMS_Status* OVMS_ServableMetadataGetOutputCount(OVMS_ServableMetadata* metadata // \param shapeMin The shape lower bounds of the input // \param shapeMax The shape upper bounds of the input // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_ServableMetadataGetInput(OVMS_ServableMetadata* metadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMinArray, int64_t** shapeMaxArray); +OVMS_Status* OVMS_ServableMetadataInput(OVMS_ServableMetadata* metadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMinArray, int64_t** shapeMaxArray); // Get the metadata of servable output given the index // @@ -564,7 +564,7 @@ OVMS_Status* OVMS_ServableMetadataGetInput(OVMS_ServableMetadata* metadata, uint // \param shapeMin The shape of the output // \param shapeMax The shape of the output // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_ServableMetadataGetOutput(OVMS_ServableMetadata* metadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMinArray, int64_t** shapeMaxArray); +OVMS_Status* OVMS_ServableMetadataOutput(OVMS_ServableMetadata* metadata, uint32_t id, const char** name, OVMS_DataType* datatype, size_t* dimCount, int64_t** shapeMinArray, int64_t** shapeMaxArray); // EXPERIMENTAL // TODO if declare specific type for underlying ov::AnyMap // Get the additional info about servable. @@ -572,7 +572,7 @@ OVMS_Status* OVMS_ServableMetadataGetOutput(OVMS_ServableMetadata* metadata, uin // \param metadata The metadata object // \param info The ptr to the ov::AnyMap* // \return OVMS_Status object in case of failure -OVMS_Status* OVMS_ServableMetadataGetInfo(OVMS_ServableMetadata* metadata, const void** info); +OVMS_Status* OVMS_ServableMetadataInfo(OVMS_ServableMetadata* metadata, const void** info); // Deallocates a status object. // diff --git a/src/test/c_api_test_utils.hpp b/src/test/c_api_test_utils.hpp index 2fab12a388..fd1ee19ea8 100644 --- a/src/test/c_api_test_utils.hpp +++ b/src/test/c_api_test_utils.hpp @@ -18,19 +18,19 @@ #include -#define ASSERT_CAPI_STATUS_NULL(C_API_CALL) \ - { \ - auto* err = C_API_CALL; \ - if (err != nullptr) { \ - uint32_t code = 0; \ - const char* msg = nullptr; \ - OVMS_StatusGetCode(err, &code); \ - OVMS_StatusGetDetails(err, &msg); \ - std::string smsg(msg); \ - OVMS_StatusDelete(err); \ - EXPECT_EQ(0, code) << smsg; \ - ASSERT_EQ(err, nullptr) << smsg; \ - } \ +#define ASSERT_CAPI_STATUS_NULL(C_API_CALL) \ + { \ + auto* err = C_API_CALL; \ + if (err != nullptr) { \ + uint32_t code = 0; \ + const char* msg = nullptr; \ + OVMS_StatusCode(err, &code); \ + OVMS_StatusDetails(err, &msg); \ + std::string smsg(msg); \ + OVMS_StatusDelete(err); \ + EXPECT_EQ(0, code) << smsg; \ + ASSERT_EQ(err, nullptr) << smsg; \ + } \ } #define ASSERT_CAPI_STATUS_NOT_NULL(C_API_CALL) \ @@ -49,8 +49,8 @@ if (err != nullptr) { \ uint32_t code = 0; \ const char* details = nullptr; \ - ASSERT_EQ(OVMS_StatusGetCode(err, &code), nullptr); \ - ASSERT_EQ(OVMS_StatusGetDetails(err, &details), nullptr); \ + ASSERT_EQ(OVMS_StatusCode(err, &code), nullptr); \ + ASSERT_EQ(OVMS_StatusDetails(err, &details), nullptr); \ ASSERT_NE(details, nullptr); \ ASSERT_EQ(code, static_cast(EXPECTED_STATUS_CODE)) \ << std::string{"wrong code: "} + std::to_string(code) + std::string{"; details: "} << details; \ diff --git a/src/test/c_api_tests.cpp b/src/test/c_api_tests.cpp index 692ebf9096..365e345bc3 100644 --- a/src/test/c_api_tests.cpp +++ b/src/test/c_api_tests.cpp @@ -261,14 +261,14 @@ TEST(CAPIStatusTest, GetCodeAndDetails) { StatusCode::INTERNAL_ERROR, "custom message"); OVMS_Status* sts = reinterpret_cast(s.get()); uint32_t code = 0; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusGetCode(nullptr, &code), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusGetCode(sts, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_StatusGetCode(sts, &code)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusCode(nullptr, &code), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusCode(sts, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_StatusCode(sts, &code)); EXPECT_EQ(code, static_cast(StatusCode::INTERNAL_ERROR)); const char* details = nullptr; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusGetDetails(nullptr, &details), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusGetDetails(sts, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_StatusGetDetails(sts, &details)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusDetails(nullptr, &details), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_StatusDetails(sts, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_StatusDetails(sts, &details)); std::stringstream ss; ss << Status(StatusCode::INTERNAL_ERROR).string() << " - custom message"; EXPECT_EQ(std::string(details), ss.str()); @@ -281,9 +281,9 @@ TEST(CAPIServerMetadata, Basic) { OVMS_Metadata* metadata = nullptr; OVMS_Server* cserver = nullptr; ASSERT_CAPI_STATUS_NULL(OVMS_ServerNew(&cserver)); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetServerMetadata(nullptr, &metadata), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetServerMetadata(cserver, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_GetServerMetadata(cserver, &metadata)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServerMetadata(nullptr, &metadata), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServerMetadata(cserver, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_ServerMetadata(cserver, &metadata)); const char* json; size_t size; ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_SerializeMetadataToString(nullptr, &json, &size), StatusCode::NONEXISTENT_PTR); @@ -295,30 +295,30 @@ TEST(CAPIServerMetadata, Basic) { OVMS_StringFree(json); const char* pointer = "/name"; const char* value; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetMetadataFieldByPointer(nullptr, pointer, &value, &size), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetMetadataFieldByPointer(metadata, nullptr, &value, &size), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetMetadataFieldByPointer(metadata, pointer, nullptr, &size), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetMetadataFieldByPointer(metadata, pointer, &value, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_MetadataFieldByPointer(nullptr, pointer, &value, &size), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_MetadataFieldByPointer(metadata, nullptr, &value, &size), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_MetadataFieldByPointer(metadata, pointer, nullptr, &size), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_MetadataFieldByPointer(metadata, pointer, &value, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_GetMetadataFieldByPointer(metadata, pointer, &value, &size)); + ASSERT_CAPI_STATUS_NULL(OVMS_MetadataFieldByPointer(metadata, pointer, &value, &size)); ASSERT_EQ(std::string(value), std::string(PROJECT_NAME)); ASSERT_EQ(size, std::strlen(value)); OVMS_StringFree(value); pointer = "/version"; - ASSERT_CAPI_STATUS_NULL(OVMS_GetMetadataFieldByPointer(metadata, pointer, &value, &size)); + ASSERT_CAPI_STATUS_NULL(OVMS_MetadataFieldByPointer(metadata, pointer, &value, &size)); ASSERT_EQ(std::string(value), std::string(PROJECT_VERSION)); ASSERT_EQ(size, std::strlen(value)); OVMS_StringFree(value); pointer = "/ov_version"; - ASSERT_CAPI_STATUS_NULL(OVMS_GetMetadataFieldByPointer(metadata, pointer, &value, &size)); + ASSERT_CAPI_STATUS_NULL(OVMS_MetadataFieldByPointer(metadata, pointer, &value, &size)); ASSERT_EQ(std::string(value), std::string(OPENVINO_NAME)); ASSERT_EQ(size, std::strlen(value)); OVMS_StringFree(value); pointer = "/dummy"; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_GetMetadataFieldByPointer(metadata, pointer, &value, &size), StatusCode::JSON_SERIALIZATION_ERROR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_MetadataFieldByPointer(metadata, pointer, &value, &size), StatusCode::JSON_SERIALIZATION_ERROR); ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServerMetadataDelete(nullptr), StatusCode::NONEXISTENT_PTR); OVMS_ServerMetadataDelete(metadata); @@ -343,9 +343,9 @@ TEST(CAPIServableMetadata, NoInputsAndOutputs) { OVMS_ServableMetadata* osm = reinterpret_cast(&sm); uint32_t count; ASSERT_EQ(sm.getVersion(), 1); - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetInputCount(osm, &count)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInputCount(osm, &count)); ASSERT_EQ(count, 0); - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetOutputCount(osm, &count)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataOutputCount(osm, &count)); ASSERT_EQ(count, 0); } @@ -374,12 +374,12 @@ TEST(CAPIInferenceResponse, Basic) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName = "n"; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::INTERNAL_ERROR); // Test GetOutput without defined buffer + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::INTERNAL_ERROR); // Test GetOutput without defined buffer ASSERT_EQ(r->getOutput(0, &name, &tensor), StatusCode::OK); std::unique_ptr buffer = std::make_unique(0, OVMS_BufferType::OVMS_BUFFERTYPE_CPU, 0); tensor->setBuffer(std::move(buffer)); outputName = "n"; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); delete r; } @@ -450,7 +450,7 @@ TEST_F(CAPIInference, TwoInputs) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string("a"), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -465,7 +465,7 @@ TEST_F(CAPIInference, TwoInputs) { EXPECT_EQ(data[i] + 1, outputData[i]) << "Different at:" << i << " place."; } outputId = 1; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string("d"), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -531,15 +531,15 @@ TEST_F(CAPIInference, Basic) { ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); // verify GetOutputCount uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutputCount(nullptr, &outputCount), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutputCount(response, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutputCount(nullptr, &outputCount), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutputCount(response, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); // verify GetParameterCount uint32_t parameterCount = 42; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameterCount(nullptr, ¶meterCount), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameterCount(response, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameterCount(nullptr, ¶meterCount), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameterCount(response, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); // verify GetOutput const void* voutputData; @@ -551,16 +551,16 @@ TEST_F(CAPIInference, Basic) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(nullptr, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, nullptr, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, nullptr, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, nullptr, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, nullptr, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, nullptr, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, nullptr, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, nullptr, &deviceId), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(nullptr, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, nullptr, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, nullptr, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, nullptr, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, nullptr, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, nullptr, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, nullptr, &bufferType, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, nullptr, &deviceId), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -651,10 +651,10 @@ TEST_F(CAPIInference, ReuseInputRemoveAndAddData) { OVMS_InferenceResponse* response = nullptr; ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); uint32_t parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); const void* voutputData = nullptr; size_t bytesize = 42; @@ -665,7 +665,7 @@ TEST_F(CAPIInference, ReuseInputRemoveAndAddData) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -688,10 +688,10 @@ TEST_F(CAPIInference, ReuseInputRemoveAndAddData) { ASSERT_CAPI_STATUS_NULL(OVMS_InferenceRequestInputSetData(request, DUMMY_MODEL_INPUT_NAME, reinterpret_cast(data2.data()), sizeof(float) * data2.size(), OVMS_BUFFERTYPE_CPU, notUsedNum)); ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); voutputData = nullptr; bytesize = 42; @@ -702,7 +702,7 @@ TEST_F(CAPIInference, ReuseInputRemoveAndAddData) { bufferType = (OVMS_BufferType)199; deviceId = 42; outputName = nullptr; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -756,10 +756,10 @@ TEST_F(CAPIInference, ReuseRequestRemoveAndAddInput) { OVMS_InferenceResponse* response = nullptr; ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); uint32_t parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); const void* voutputData = nullptr; size_t bytesize = 42; @@ -770,7 +770,7 @@ TEST_F(CAPIInference, ReuseRequestRemoveAndAddInput) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -794,10 +794,10 @@ TEST_F(CAPIInference, ReuseRequestRemoveAndAddInput) { ASSERT_CAPI_STATUS_NULL(OVMS_InferenceRequestInputSetData(request, DUMMY_MODEL_INPUT_NAME, reinterpret_cast(data2.data()), sizeof(float) * data2.size(), OVMS_BUFFERTYPE_CPU, notUsedNum)); ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); voutputData = nullptr; bytesize = 42; @@ -808,7 +808,7 @@ TEST_F(CAPIInference, ReuseRequestRemoveAndAddInput) { bufferType = (OVMS_BufferType)199; deviceId = 42; outputName = nullptr; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -950,7 +950,7 @@ TEST_F(CAPIInference, Scalar) { ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); // verify GetOutputCount uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); // verify GetOutput const void* voutputData; @@ -962,7 +962,7 @@ TEST_F(CAPIInference, Scalar) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(SCALAR_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 0); @@ -1020,19 +1020,19 @@ TEST_F(CAPIInference, ResponseRetrieval) { /////////////////////////// OVMS_InferenceResponse* response = reinterpret_cast(cppResponse.get()); uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); uint32_t parameterCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(1, parameterCount); // verify get Parameter OVMS_DataType parameterDatatype = OVMS_DATATYPE_FP32; const void* parameterData{nullptr}; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameter(nullptr, 0, ¶meterDatatype, ¶meterData), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameter(response, 0, nullptr, ¶meterData), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameter(response, 0, ¶meterDatatype, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameter(response, 0, ¶meterDatatype, ¶meterData)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameter(nullptr, 0, ¶meterDatatype, ¶meterData), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameter(response, 0, nullptr, ¶meterData), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameter(response, 0, ¶meterDatatype, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameter(response, 0, ¶meterDatatype, ¶meterData)); ASSERT_EQ(parameterDatatype, OVMS_DATATYPE_U64); EXPECT_EQ(0, std::memcmp(parameterData, (void*)&seqId, sizeof(seqId))); // verify get Output @@ -1045,8 +1045,8 @@ TEST_F(CAPIInference, ResponseRetrieval) { OVMS_BufferType bufferType = (OVMS_BufferType)199; uint32_t deviceId = 42; const char* outputName{nullptr}; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId + 42123, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_TENSOR); - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId + 42123, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::NONEXISTENT_TENSOR); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(INPUT_NAME, outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -1065,9 +1065,9 @@ TEST_F(CAPIInference, ResponseRetrieval) { // test negative scenario with getting output without buffer cppStatus = cppResponse->addOutput("outputWithNoBuffer", DATATYPE, cppOutputShape.data(), cppOutputShape.size()); ASSERT_EQ(cppStatus, StatusCode::OK) << cppStatus.string(); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetOutput(response, outputId + 1, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::INTERNAL_ERROR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseOutput(response, outputId + 1, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId), StatusCode::INTERNAL_ERROR); // negative scenario nonexistsing parameter - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseGetParameter(response, 123, ¶meterDatatype, ¶meterData), StatusCode::NONEXISTENT_PARAMETER); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_InferenceResponseParameter(response, 123, ¶meterDatatype, ¶meterData), StatusCode::NONEXISTENT_PARAMETER); // final cleanup // we release unique_ptr ownership here so that we can free it safely via C-API cppResponse.release(); @@ -1111,8 +1111,8 @@ class CAPIMetadata : public ::testing::Test { ASSERT_NE(nullptr, servableMetadata); uint32_t inputCount = 42; uint32_t outputCount = 42; - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetInputCount(servableMetadata, &inputCount)); - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetOutputCount(servableMetadata, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInputCount(servableMetadata, &inputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataOutputCount(servableMetadata, &outputCount)); ASSERT_EQ(expectedInputsInfo.size(), inputCount); ASSERT_EQ(expectedOutputsInfo.size(), outputCount); @@ -1125,7 +1125,7 @@ class CAPIMetadata : public ::testing::Test { std::set inputNames; std::set outputNames; for (id = 0; id < inputCount; ++id) { - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetInput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax)); auto it = expectedInputsInfo.find(tensorName); ASSERT_NE(it, expectedInputsInfo.end()); inputNames.insert(tensorName); @@ -1138,7 +1138,7 @@ class CAPIMetadata : public ::testing::Test { } EXPECT_EQ(inputNames.size(), inputCount); for (id = 0; id < outputCount; ++id) { - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax)); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax)); auto it = expectedOutputsInfo.find(tensorName); ASSERT_NE(it, expectedOutputsInfo.end()); outputNames.insert(tensorName); @@ -1151,7 +1151,7 @@ class CAPIMetadata : public ::testing::Test { } EXPECT_EQ(outputNames.size(), outputCount); const ov::AnyMap* servableMetadataRtInfo{nullptr}; - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetInfo(servableMetadata, reinterpret_cast(&servableMetadataRtInfo))); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInfo(servableMetadata, reinterpret_cast(&servableMetadataRtInfo))); ASSERT_NE(nullptr, servableMetadataRtInfo); EXPECT_EQ(0, servableMetadataRtInfo->size()); OVMS_ServableMetadataDelete(servableMetadata); @@ -1186,10 +1186,10 @@ TEST_F(CAPIMetadata, Negative) { uint32_t outputCount = 42; // OVMS_ServableMetadataGetInputCount // negative - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInputCount(nullptr, &inputCount), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInputCount(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutputCount(nullptr, &outputCount), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutputCount(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInputCount(nullptr, &inputCount), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInputCount(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutputCount(nullptr, &outputCount), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutputCount(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); // check inputs uint32_t id = 0; @@ -1200,13 +1200,13 @@ TEST_F(CAPIMetadata, Negative) { const char* tensorName{nullptr}; // OVMS_ServableMetadataGetInput // negative - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(nullptr, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, 412, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_TENSOR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, id, nullptr, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, id, &tensorName, nullptr, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, id, &tensorName, &datatype, nullptr, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, id, &tensorName, &datatype, &dimCount, nullptr, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(nullptr, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, 412, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_TENSOR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, id, nullptr, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, id, &tensorName, nullptr, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, id, &tensorName, &datatype, nullptr, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, id, &tensorName, &datatype, &dimCount, nullptr, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, nullptr), StatusCode::NONEXISTENT_PTR); // check outputs id = 0; datatype = (OVMS_DataType)199; @@ -1214,17 +1214,17 @@ TEST_F(CAPIMetadata, Negative) { shapeMax = nullptr; dimCount = 42; tensorName = nullptr; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(nullptr, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, 412, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_TENSOR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, id, nullptr, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, id, &tensorName, nullptr, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, id, &tensorName, &datatype, nullptr, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, nullptr, &shapeMax), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(nullptr, id, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, 412, &tensorName, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_TENSOR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, id, nullptr, &datatype, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, id, &tensorName, nullptr, &dimCount, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, id, &tensorName, &datatype, nullptr, &shapeMin, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, nullptr, &shapeMax), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataOutput(servableMetadata, id, &tensorName, &datatype, &dimCount, &shapeMin, nullptr), StatusCode::NONEXISTENT_PTR); // check info const ov::AnyMap* servableMetadataRtInfo; - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInfo(nullptr, reinterpret_cast(&servableMetadataRtInfo)), StatusCode::NONEXISTENT_PTR); - ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataGetInfo(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInfo(nullptr, reinterpret_cast(&servableMetadataRtInfo)), StatusCode::NONEXISTENT_PTR); + ASSERT_CAPI_STATUS_NOT_NULL_EXPECT_CODE(OVMS_ServableMetadataInfo(servableMetadata, nullptr), StatusCode::NONEXISTENT_PTR); OVMS_ServableMetadataDelete(nullptr); } @@ -1603,13 +1603,13 @@ TEST_F(CAPIDagInference, BasicDummyDag) { OVMS_InferenceResponse* response = nullptr; ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); // verify GetOutputCount - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); // verify GetParameterCount - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); // verify GetOutput - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 2); @@ -1656,13 +1656,13 @@ TEST_F(CAPIDagInference, DynamicEntryDummyDag) { OVMS_InferenceResponse* response = nullptr; ASSERT_CAPI_STATUS_NULL(OVMS_Inference(cserver, request, &response)); // verify GetOutputCount - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutputCount(response, &outputCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutputCount(response, &outputCount)); ASSERT_EQ(outputCount, 1); // verify GetParameterCount - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetParameterCount(response, ¶meterCount)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseParameterCount(response, ¶meterCount)); ASSERT_EQ(0, parameterCount); // verify GetOutput - ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseGetOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); + ASSERT_CAPI_STATUS_NULL(OVMS_InferenceResponseOutput(response, outputId, &outputName, &datatype, &shape, &dimCount, &voutputData, &bytesize, &bufferType, &deviceId)); ASSERT_EQ(std::string(DUMMY_MODEL_OUTPUT_NAME), outputName); EXPECT_EQ(datatype, OVMS_DATATYPE_FP32); EXPECT_EQ(dimCount, 3); diff --git a/src/test/mediapipeflow_test.cpp b/src/test/mediapipeflow_test.cpp index 8c439fa124..0531f75805 100644 --- a/src/test/mediapipeflow_test.cpp +++ b/src/test/mediapipeflow_test.cpp @@ -994,7 +994,7 @@ TEST(Mediapipe, AdapterRTInfo) { ASSERT_CAPI_STATUS_NULL(OVMS_GetServableMetadata(cserver, mockedModelName.c_str(), servableVersion, &servableMetadata)); const ov::AnyMap* servableMetadataRtInfo; - ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataGetInfo(servableMetadata, reinterpret_cast(&servableMetadataRtInfo))); + ASSERT_CAPI_STATUS_NULL(OVMS_ServableMetadataInfo(servableMetadata, reinterpret_cast(&servableMetadataRtInfo))); ASSERT_NE(nullptr, servableMetadataRtInfo); checkModelInfo(*servableMetadataRtInfo); OVMS_ServableMetadataDelete(servableMetadata); diff --git a/src/test/status_test.cpp b/src/test/status_test.cpp index 0d846a17d6..92f67e1b15 100644 --- a/src/test/status_test.cpp +++ b/src/test/status_test.cpp @@ -45,10 +45,10 @@ TEST(StatusCodeTest, CAPI) { Status status = Status(statusCode); OVMS_Status* sts = reinterpret_cast(&status); uint32_t code = 0; - ASSERT_EQ(OVMS_StatusGetCode(sts, &code), nullptr); + ASSERT_EQ(OVMS_StatusCode(sts, &code), nullptr); EXPECT_EQ(code, static_cast(statusCode)); const char* details = nullptr; - ASSERT_EQ(OVMS_StatusGetDetails(sts, &details), nullptr); + ASSERT_EQ(OVMS_StatusDetails(sts, &details), nullptr); std::stringstream ss; ss << Status(statusCode).string(); EXPECT_EQ(std::string(details), ss.str());