Skip to content

Commit

Permalink
Add support of ov::Busy and ov::Cancelled in C API
Browse files Browse the repository at this point in the history
  • Loading branch information
vurusovs committed Jan 9, 2024
1 parent 4c31bd6 commit 70a8061
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/bindings/c/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "openvino/core/except.hpp"
#include "openvino/openvino.hpp"
#include "openvino/runtime/exception.hpp"

#define CATCH_OV_EXCEPTION(StatusCode, ExceptionType) \
catch (const ov::ExceptionType& ex) { \
Expand All @@ -20,6 +21,8 @@
}

#define CATCH_OV_EXCEPTIONS \
CATCH_OV_EXCEPTION(REQUEST_BUSY, Busy) \
CATCH_OV_EXCEPTION(INFER_CANCELLED, Cancelled) \
CATCH_OV_EXCEPTION(NOT_IMPLEMENTED, NotImplemented) \
CATCH_OV_EXCEPTION(GENERAL_ERROR, Exception) \
catch (...) { \
Expand Down
9 changes: 9 additions & 0 deletions src/bindings/c/tests/ov_infer_request_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@ TEST_P(ov_infer_request_test, infer_async_wait_for) {
}
}

TEST_P(ov_infer_request_test, infer_async_wait_for_return_busy) {
OV_EXPECT_OK(ov_infer_request_set_input_tensor_by_index(infer_request, 0, input_tensor));

OV_ASSERT_OK(ov_infer_request_start_async(infer_request));

if (!HasFatalFailure())
EXPECT_EQ(ov_status_e::REQUEST_BUSY, ov_infer_request_get_tensor(infer_request, in_tensor_name, &input_tensor));
}

TEST_P(ov_infer_request_test, infer_async_wait_for_return_fail) {
OV_EXPECT_NOT_OK(ov_infer_request_wait_for(infer_request, 10));
}
Expand Down

0 comments on commit 70a8061

Please sign in to comment.