Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Lebedev committed May 25, 2021
1 parent d108fa0 commit 15e6713
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
32 changes: 32 additions & 0 deletions inference-engine/ie_bridges/python/tests/test_ExecutableNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,3 +304,35 @@ def test_get_config(device):
exec_net = ie_core.load_network(net, device)
config = exec_net.get_config("PERF_COUNT")
assert config == "NO"


# issue 28996
# checks that objects can deallocate in this order, if not - segfault happends
def test_input_info_deallocation(device):
ie_core = ie.IECore()
net = ie_core.read_network(model=test_net_xml, weights=test_net_bin)
exec_net = ie_core.load_network(net, device)
input_info = exec_net.input_info["data"]
del ie_core
del exec_net
del input_info


def test_outputs_deallocation(device):
ie_core = ie.IECore()
net = ie_core.read_network(model=test_net_xml, weights=test_net_bin)
exec_net = ie_core.load_network(net, device)
output = exec_net.outputs["fc_out"]
del ie_core
del exec_net
del output


def test_exec_graph_info_deallocation(device):
ie_core = ie.IECore()
net = ie_core.read_network(model=test_net_xml, weights=test_net_bin)
exec_net = ie_core.load_network(net, device)
exec_graph_info = exec_net.get_exec_graph_info()
del ie_core
del exec_net
del exec_graph_info
18 changes: 18 additions & 0 deletions inference-engine/ie_bridges/python/tests/test_InputInfoCPtr.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def test_name(device):
exec_net = ie.load_network(net, device, num_requests=5)
assert isinstance(exec_net.input_info['data'], InputInfoCPtr)
assert exec_net.input_info['data'].name == "data", "Incorrect name"
del ie
del exec_net


Expand All @@ -25,6 +26,7 @@ def test_precision(device):
exec_net = ie.load_network(net, device, num_requests=5)
assert isinstance(exec_net.input_info['data'], InputInfoCPtr)
assert exec_net.input_info['data'].precision == "FP32", "Incorrect precision"
del ie
del exec_net


Expand All @@ -36,6 +38,7 @@ def test_no_precision_setter(device):
exec_net.input_info['data'].precision = "I8"
assert "attribute 'precision' of 'openvino.inference_engine.ie_api.InputInfoCPtr' " \
"objects is not writable" in str(e.value)
del ie
del exec_net


Expand All @@ -45,9 +48,24 @@ def test_input_data(device):
exec_net = ie.load_network(net, device, num_requests=5)
assert isinstance(exec_net.input_info['data'], InputInfoCPtr)
assert isinstance(exec_net.input_info['data'].input_data, DataPtr), "Incorrect precision for layer 'fc_out'"
del ie
del exec_net


# issue 28996
# checks that objects can deallocate in this order, if not - segfault happends
def test_input_data_deallocation(device):
ie = IECore()
net = ie.read_network(model=test_net_xml, weights=test_net_bin)
exec_net = ie.load_network(net, device)
input_info = exec_net.input_info['data']
input_data = input_info.input_data
del ie
del exec_net
del input_info
del input_data


def test_tensor_desc(device):
ie = IECore()
net = ie.read_network(model=test_net_xml, weights=test_net_bin)
Expand Down

0 comments on commit 15e6713

Please sign in to comment.