Commit ccbba5e4 authored by Gleb Kazantaev's avatar Gleb Kazantaev Committed by Scott Cyphers

Fixed compilation warnings to build nGraph unit tests in OV CI (#3841)

* Fix for openvino ci

* Fix

* Resolve comments

* Revert_changes
parent 56141695
......@@ -527,11 +527,7 @@ if(NGRAPH_ADDRESS_SANITIZER)
endif()
target_link_libraries(unit-test PRIVATE ngraph_test_util)
if(NGRAPH_UNIT_TEST_OPENVINO_ENABLE)
target_link_libraries(unit-test PRIVATE ngraph gtest)
else()
target_link_libraries(unit-test PRIVATE ngraph libgtest)
endif()
target_link_libraries(unit-test PRIVATE ngraph libgtest)
target_compile_definitions(unit-test PRIVATE NGRAPH_VERSION_LABEL="${NGRAPH_VERSION_LABEL}")
if (NGRAPH_JSON_ENABLE)
......@@ -602,22 +598,24 @@ if (NGRAPH_MLIR_ENABLE)
target_include_directories(unit-test PRIVATE ${CMAKE_BINARY_DIR}/src/contrib/mlir)
endif()
# If all the runtime libraries are installed into one location, that will make life easier.
if (MSVS)
add_custom_target(unit-test-check
COMMAND set "PATH=${EXTERNAL_PROJECTS_ROOT}/src/ngraph/Release;${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/;${EXTERNAL_PROJECTS_ROOT}/mkl/src/ext_mkl/lib/;${EXTERNAL_PROJECTS_ROOT}/ext_tbb-prefix/src/ext_tbb/tbb2019_20181203oss/bin/intel64/vc14;%PATH%"
COMMAND ${PROJECT_BINARY_DIR}/test/unit-test \${ARGS}
DEPENDS unit-test
)
else()
add_custom_target(unit-test-check
COMMAND ${PROJECT_BINARY_DIR}/test/unit-test --cpath ${EXTERNAL_PROJECTS_ROOT}/src/ngraph/ \${ARGS}
DEPENDS unit-test
if (NOT NGRAPH_UNIT_TEST_OPENVINO_ENABLE)
# If all the runtime libraries are installed into one location, that will make life easier.
if (MSVS)
add_custom_target(unit-test-check
COMMAND set "PATH=${EXTERNAL_PROJECTS_ROOT}/src/ngraph/Release;${EXTERNAL_PROJECTS_ROOT}/mkldnn/lib/;${EXTERNAL_PROJECTS_ROOT}/mkl/src/ext_mkl/lib/;${EXTERNAL_PROJECTS_ROOT}/ext_tbb-prefix/src/ext_tbb/tbb2019_20181203oss/bin/intel64/vc14;%PATH%"
COMMAND ${PROJECT_BINARY_DIR}/test/unit-test \${ARGS}
DEPENDS unit-test
)
else()
add_custom_target(unit-test-check
COMMAND ${PROJECT_BINARY_DIR}/test/unit-test --cpath ${EXTERNAL_PROJECTS_ROOT}/src/ngraph/ \${ARGS}
DEPENDS unit-test
)
endif()
add_custom_target(check
DEPENDS
style-check
unit-test-check
)
endif()
add_custom_target(check
DEPENDS
style-check
unit-test-check
)
......@@ -571,6 +571,6 @@ TEST(algebraic_simplification, pass_property)
{
auto pass = std::make_shared<ngraph::pass::AlgebraicSimplification>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
......@@ -216,6 +216,6 @@ TEST(build_graph, validate_function_for_dynamic_shape)
return f;
};
EXPECT_EQ(true, make_function(true)->is_dynamic());
EXPECT_EQ(false, make_function(false)->is_dynamic());
EXPECT_TRUE(make_function(true)->is_dynamic());
EXPECT_FALSE(make_function(false)->is_dynamic());
}
......@@ -287,13 +287,13 @@ TEST(concat_fusion, pass_property)
{
{
auto pass = std::make_shared<ngraph::pass::ConcatElimination>();
ASSERT_EQ(false, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
{
auto pass = std::make_shared<ngraph::pass::SelfConcatFusion>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
}
......@@ -1638,6 +1638,6 @@ TEST(constant_folding, constant_select)
TEST(constant_folding, pass_property)
{
auto pass = std::make_shared<ngraph::pass::ConstantFolding>();
ASSERT_EQ(false, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(true, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
......@@ -692,15 +692,15 @@ TEST(batch_fusion, group_convolution_fusion)
TEST(core_fusion, pass_property)
{
auto pass = std::make_shared<ngraph::pass::CoreFusion>();
ASSERT_EQ(false, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
TEST(batch_fusion, pass_property)
{
auto pass = std::make_shared<ngraph::pass::BatchFusion>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
#ifndef NGRAPH_JSON_DISABLE
......
......@@ -338,6 +338,6 @@ TEST(CSE, one_hot)
TEST(CSE, pass_property)
{
auto pass = std::make_shared<ngraph::pass::CommonSubexpressionElimination>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
......@@ -114,6 +114,6 @@ TEST(nop_elimination, eliminate_stop_gradient)
TEST(nop_elimination, pass_property)
{
auto pass = std::make_shared<ngraph::pass::NopElimination>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
......@@ -482,12 +482,12 @@ TEST(reshape_elimination, pass_property)
{
{
auto pass = std::make_shared<ngraph::pass::ReshapeElimination>();
ASSERT_EQ(false, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
{
auto pass = std::make_shared<ngraph::pass::RecurrentReshapeElimination>();
ASSERT_EQ(false, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
}
......@@ -268,6 +268,6 @@ TEST(reshape_sinking, concat)
TEST(reshape_sinking, pass_property)
{
auto pass = std::make_shared<ngraph::pass::ReshapeSinking>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
......@@ -129,7 +129,7 @@ TEST(type_prop_layers, proposal)
attrs.base_size = 1;
attrs.pre_nms_topn = 20;
attrs.post_nms_topn = 200;
const uint64_t batch_size = 7;
const size_t batch_size = 7;
auto class_probs = make_shared<op::Parameter>(element::f32, Shape{batch_size, 12, 34, 62});
auto class_logits = make_shared<op::Parameter>(element::f32, Shape{batch_size, 24, 34, 62});
......
......@@ -445,39 +445,39 @@ TEST(util, enum_mask_set_clear)
EXPECT_EQ(0, m.value());
m.set(Type::d);
m.set(Type::b);
EXPECT_EQ(true, m.is_set(Type::d));
EXPECT_EQ(false, m.is_set(Type::a));
EXPECT_EQ(true, m.is_set(Type::b));
EXPECT_EQ(false, m.is_set(Type::c));
EXPECT_EQ(false, m.is_set({Type::a, Type::b}));
EXPECT_EQ(false, m.is_set({Type::c, Type::d}));
EXPECT_EQ(false, m.is_set({Type::a, Type::c}));
EXPECT_EQ(true, m.is_set({Type::b, Type::d}));
EXPECT_EQ(false, m.is_clear(Type::d));
EXPECT_EQ(true, m.is_clear(Type::a));
EXPECT_EQ(false, m.is_clear(Type::b));
EXPECT_EQ(true, m.is_clear(Type::c));
EXPECT_EQ(false, m.is_clear({Type::c, Type::d}));
EXPECT_EQ(false, m.is_clear({Type::a, Type::b}));
EXPECT_EQ(true, m.is_clear({Type::a, Type::c}));
EXPECT_EQ(false, m.is_clear({Type::b, Type::d}));
EXPECT_EQ(true, m.is_any_set({Type::a, Type::b}));
EXPECT_EQ(true, m.is_any_set({Type::a, Type::d}));
EXPECT_EQ(true, m.is_any_set({Type::b, Type::c}));
EXPECT_EQ(true, m.is_any_set({Type::c, Type::d}));
EXPECT_EQ(false, m.is_any_set({Type::a, Type::c}));
EXPECT_EQ(true, m.is_any_clear({Type::c, Type::d}));
EXPECT_EQ(true, m.is_any_clear({Type::a, Type::b}));
EXPECT_EQ(true, m.is_any_clear({Type::a, Type::c}));
EXPECT_EQ(true, m.is_any_clear({Type::b, Type::c}));
EXPECT_EQ(false, m.is_any_clear({Type::b, Type::d}));
EXPECT_TRUE(m.is_set(Type::d));
EXPECT_FALSE(m.is_set(Type::a));
EXPECT_TRUE(m.is_set(Type::b));
EXPECT_FALSE(m.is_set(Type::c));
EXPECT_FALSE(m.is_set({Type::a, Type::b}));
EXPECT_FALSE(m.is_set({Type::c, Type::d}));
EXPECT_FALSE(m.is_set({Type::a, Type::c}));
EXPECT_TRUE(m.is_set({Type::b, Type::d}));
EXPECT_FALSE(m.is_clear(Type::d));
EXPECT_TRUE(m.is_clear(Type::a));
EXPECT_FALSE(m.is_clear(Type::b));
EXPECT_TRUE(m.is_clear(Type::c));
EXPECT_FALSE(m.is_clear({Type::c, Type::d}));
EXPECT_FALSE(m.is_clear({Type::a, Type::b}));
EXPECT_TRUE(m.is_clear({Type::a, Type::c}));
EXPECT_FALSE(m.is_clear({Type::b, Type::d}));
EXPECT_TRUE(m.is_any_set({Type::a, Type::b}));
EXPECT_TRUE(m.is_any_set({Type::a, Type::d}));
EXPECT_TRUE(m.is_any_set({Type::b, Type::c}));
EXPECT_TRUE(m.is_any_set({Type::c, Type::d}));
EXPECT_FALSE(m.is_any_set({Type::a, Type::c}));
EXPECT_TRUE(m.is_any_clear({Type::c, Type::d}));
EXPECT_TRUE(m.is_any_clear({Type::a, Type::b}));
EXPECT_TRUE(m.is_any_clear({Type::a, Type::c}));
EXPECT_TRUE(m.is_any_clear({Type::b, Type::c}));
EXPECT_FALSE(m.is_any_clear({Type::b, Type::d}));
m.set(Type::a);
EXPECT_EQ(false, m.is_clear(Type::a));
EXPECT_EQ(false, m.is_clear(Type::b));
EXPECT_EQ(true, m.is_clear(Type::c));
EXPECT_EQ(false, m.is_clear(Type::d));
EXPECT_FALSE(m.is_clear(Type::a));
EXPECT_FALSE(m.is_clear(Type::b));
EXPECT_TRUE(m.is_clear(Type::c));
EXPECT_FALSE(m.is_clear(Type::d));
}
TEST(util, enum_mask_operators)
......@@ -492,9 +492,9 @@ TEST(util, enum_mask_operators)
EnumMask<Type> m;
m = Type::b;
EXPECT_EQ(static_cast<uint32_t>(Type::b), m.value());
EXPECT_EQ(true, m[Type::b]);
EXPECT_EQ(false, m[Type::a]);
EXPECT_EQ(false, m[Type::c]);
EXPECT_TRUE(m[Type::b]);
EXPECT_FALSE(m[Type::a]);
EXPECT_FALSE(m[Type::c]);
m |= Type::c;
EXPECT_EQ(static_cast<uint32_t>(Type::b) | static_cast<uint32_t>(Type::c), m.value());
m &= Type::d;
......@@ -502,16 +502,16 @@ TEST(util, enum_mask_operators)
m |= Type::a;
m |= Type::c;
EXPECT_EQ(true, m.is_set(Type::a));
EXPECT_EQ(false, m.is_set(Type::b));
EXPECT_EQ(true, m.is_set(Type::c));
EXPECT_EQ(false, m.is_set(Type::d));
EXPECT_EQ(true, m.is_any_set(Type::a));
EXPECT_EQ(false, m.is_any_set(Type::b));
EXPECT_EQ(true, m.is_any_set(Type::c));
EXPECT_EQ(false, m.is_any_set(Type::d));
EXPECT_EQ(true, m.is_any_set({Type::a, Type::c}));
EXPECT_EQ(false, m.is_any_set({Type::b, Type::d}));
EXPECT_TRUE(m.is_set(Type::a));
EXPECT_FALSE(m.is_set(Type::b));
EXPECT_TRUE(m.is_set(Type::c));
EXPECT_FALSE(m.is_set(Type::d));
EXPECT_TRUE(m.is_any_set(Type::a));
EXPECT_FALSE(m.is_any_set(Type::b));
EXPECT_TRUE(m.is_any_set(Type::c));
EXPECT_FALSE(m.is_any_set(Type::d));
EXPECT_TRUE(m.is_any_set({Type::a, Type::c}));
EXPECT_FALSE(m.is_any_set({Type::b, Type::d}));
EnumMask<Type> n;
n = m | n;
......@@ -519,24 +519,24 @@ TEST(util, enum_mask_operators)
n = m & n;
EXPECT_EQ(m, n);
bool r = (n == m);
EXPECT_EQ(true, r);
EXPECT_TRUE(r);
r = (n != m);
EXPECT_EQ(false, r);
EXPECT_FALSE(r);
n.clear_all();
n = {Type::a, Type::b};
r = (n == m);
EXPECT_EQ(false, r);
EXPECT_FALSE(r);
r = (n != m);
EXPECT_EQ(true, r);
EXPECT_TRUE(r);
n = m & n;
EXPECT_EQ(static_cast<uint32_t>(Type::a), n.value());
n = m | Type::b;
EXPECT_EQ(true, n.is_set(Type::a));
EXPECT_EQ(true, n.is_set(Type::b));
EXPECT_EQ(true, n.is_set(Type::c));
EXPECT_EQ(false, n.is_set(Type::d));
EXPECT_EQ(false, n[Type::d]);
EXPECT_EQ(true, n[Type::b]);
EXPECT_TRUE(n.is_set(Type::a));
EXPECT_TRUE(n.is_set(Type::b));
EXPECT_TRUE(n.is_set(Type::c));
EXPECT_FALSE(n.is_set(Type::d));
EXPECT_FALSE(n[Type::d]);
EXPECT_TRUE(n[Type::b]);
}
TEST(graph, huge)
......
......@@ -207,6 +207,6 @@ TEST(zero_dim_tensor_elimination, zero_argmin)
TEST(zero_dim_tensor_elimination, pass_property)
{
auto pass = std::make_shared<ngraph::pass::ZeroDimTensorElimination>();
ASSERT_EQ(true, pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_EQ(false, pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
ASSERT_TRUE(pass->get_property(pass::PassProperty::REQUIRE_STATIC_SHAPE));
ASSERT_FALSE(pass->get_property(pass::PassProperty::CHANGE_DYNAMIC_STATE));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment