diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..12fd24d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,52 @@ +# Build artifacts +*.o +*.lo +*.a +*.la +*.Po +*.Tpo +*.gcno +*.gcda +*.gcov + +# Autotools build artifacts +/unittest/Makefile +/unittest/Makefile.in +/unittest/aclocal.m4 +/unittest/autom4te.cache/ +/unittest/compile +/unittest/config.guess +/unittest/config.log +/unittest/config.status +/unittest/config.sub +/unittest/configure +/unittest/depcomp +/unittest/install-sh +/unittest/libtool +/unittest/ltmain.sh +/unittest/missing +/unittest/.deps/ +/unittest/mocks/.deps/ +/unittest/deviceutils/.deps/ + +# Dependency tracking directories +**/.deps/ + +# Build binaries +/unittest/rdkfw_device_status_gtest +/unittest/rdkfw_deviceutils_gtest +/unittest/rdkfw_main_gtest +/unittest/rdkfw_interface_gtest +/unittest/rdkfwupdatemgr_main_flow_gtest +/unittest/rdkFwupdateMgr_handlers_gtest +/unittest/dbus_handlers_gtest +/unittest/rdkFwupdateMgr_async_refcount_gtest +/unittest/rdkFwupdateMgr_async_stress_gtest +/unittest/rdkFwupdateMgr_async_cleanup_gtest +/unittest/rdkFwupdateMgr_async_signal_gtest +/unittest/rdkFwupdateMgr_async_threadsafety_gtest + +# Coverage reports +/src/coverage.info +/src/coverage.filtered.info +/src/out/ diff --git a/unittest/fwdl_interface_gtest.cpp b/unittest/fwdl_interface_gtest.cpp index 01ef3c80..167aa175 100644 --- a/unittest/fwdl_interface_gtest.cpp +++ b/unittest/fwdl_interface_gtest.cpp @@ -171,6 +171,46 @@ TEST_F(InterfaceTestFixture, TestName_isDebugServicesEnableSuccess) EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1).WillOnce(Return(1)); EXPECT_EQ(isDebugServicesEnabled(), true); } +TEST_F(InterfaceTestFixture, TestName_getDeviceTypeRFCReadFailure) +{ + char deviceType[32] = {0}; + EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1).WillOnce(Return(0)); + getDeviceTypeRFC(deviceType, sizeof(deviceType)); + EXPECT_STREQ(deviceType, "unknown"); +} +TEST_F(InterfaceTestFixture, TestName_getDeviceTypeRFCProd) +{ + char deviceType[32] = {0}; + EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1) + .WillOnce(Invoke([](char* /*type*/, const char* /*key*/, RFC_ParamData_t *param) { + snprintf(param->value, sizeof(param->value), "%s", "prod"); + return 1; + })); + getDeviceTypeRFC(deviceType, sizeof(deviceType)); + EXPECT_STREQ(deviceType, "prod"); +} +TEST_F(InterfaceTestFixture, TestName_getDeviceTypeRFCTest) +{ + char deviceType[32] = {0}; + EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1) + .WillOnce(Invoke([](char* /*type*/, const char* /*key*/, RFC_ParamData_t *param) { + snprintf(param->value, sizeof(param->value), "%s", "test"); + return 1; + })); + getDeviceTypeRFC(deviceType, sizeof(deviceType)); + EXPECT_STREQ(deviceType, "test"); +} +TEST_F(InterfaceTestFixture, TestName_getDeviceTypeRFCUnknown) +{ + char deviceType[32] = {0}; + EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1) + .WillOnce(Invoke([](char* /*type*/, const char* /*key*/, RFC_ParamData_t *param) { + snprintf(param->value, sizeof(param->value), "%s", "staging"); + return 1; + })); + getDeviceTypeRFC(deviceType, sizeof(deviceType)); + EXPECT_STREQ(deviceType, "unknown"); +} TEST_F(InterfaceTestFixture, TestName_isIncremetalCDLEnableSuccess) { EXPECT_CALL(*g_InterfaceMock, getRFCParameter(_, _, _)).Times(1).WillOnce(Return(1));