CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(gtest-haltest-wifi-mesh-manager C CXX)
-SET(GTEST_TEST "wifi-mesh-manager-haltests")
+SET(HALTEST "wifi-mesh-manager-haltests")
ADD_DEFINITIONS("-DUSE_DLOG")
SET(REQUIRES_LIST ${REQUIRES_LIST}
gio-2.0
gmock
dlog
+ capi-system-info
)
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(GTEST_TEST_PKG REQUIRED ${REQUIRES_LIST})
+PKG_CHECK_MODULES(HALTEST_PKG REQUIRED ${REQUIRES_LIST})
-FOREACH(flag ${GTEST_TEST_PKG_CFLAGS})
+FOREACH(flag ${HALTEST_PKG_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-FILE(GLOB GTEST_TEST_SRCS *.cpp)
-SET(GTEST_TEST_SRCS ${GTEST_TEST_SRCS})
+FILE(GLOB HALTEST_SRCS *.cpp)
+SET(HALTEST_SRCS ${HALTEST_SRCS})
-ADD_EXECUTABLE(${GTEST_TEST} ${GTEST_TEST_SRCS})
-TARGET_LINK_LIBRARIES(${GTEST_TEST} ${GTEST_TEST_LDFLAGS} ${GTEST_TEST_PKG_LDFLAGS} -ldl -lgcov)
+ADD_EXECUTABLE(${HALTEST} ${HALTEST_SRCS})
+TARGET_LINK_LIBRARIES(${HALTEST} ${HALTEST_LDFLAGS} ${HALTEST_PKG_LDFLAGS} -ldl -lgcov)
-INSTALL(TARGETS ${GTEST_TEST} RUNTIME DESTINATION ${BIN_DIR})
+INSTALL(TARGETS ${HALTEST} RUNTIME DESTINATION ${BIN_DIR})
error_e error = ERROR_NONE;
int result = 0;
+ if (!CheckFeature())
+ return ERROR_NONE;
+
message = InvokeMethod(WIFI_MESH_MGR_SERVICE".manager",
WIFI_MESH_MGR_MANAGER_PATH,
WIFI_MESH_MGR_MANAGER_INTERFACE,
error_e error = ERROR_NONE;
int result = 0;
+ if (!CheckFeature())
+ return ERROR_NONE;
+
message = InvokeMethod(WIFI_MESH_MGR_SERVICE,
WIFI_MESH_MGR_MANAGER_PATH,
WIFI_MESH_MGR_MANAGER_INTERFACE,
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <iostream>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <unistd.h>
-
-#include "manager.h"
-#include "wmesh.h"
-
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-
-char *mesh_id = (char *)"haltestnetwork";
-
-/*
-@testcase Enable_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Enable wifi-mesh-manager
-@apicovered "enable" dbus method on net.wmesh.manager interface
-@passcase when EnableManager() returns ERROR_NONE
-@failcase when EnableManager() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, Enable_p)
-{
- error_e ret = ERROR_NONE;
- Manager mgr;
-
- ret = mgr.EnableManager();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase StartMesh_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Start wifi-mesh-manager
-@apicovered "enable_mesh" dbus method on net.wmesh.manager interface
-@passcase when EnableMesh() returns ERROR_NONE
-@failcase when EnableMesh() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, EnableMesh_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.EnableMesh();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase Scan_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Scan using wifi-mesh-manager
-@apicovered "scan" dbus method on net.wmesh.manager interface
-@passcase when Scan() returns ERROR_NONE
-@failcase when Scan() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, Scan_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.Scan();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase EnableSoftap_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Enable softap using wifi-mesh-manager
-@apicovered "enable_softap" dbus method on net.wmesh.manager interface
-@passcase when EnableSoftap() returns ERROR_NONE
-@failcase when EnableSoftap() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, SetSoftap_p)
-{
- static char ssid[] = "haltestnetwork";
- static char passphrase[] = "00000000";
- static int channel = 1;
- static int visibility = 1;
- static int max_stations = 10;
- static int security = 2;
-
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.SetSoftap(ssid, passphrase,
- channel, visibility, max_stations, security);
- EXPECT_EQ(ERROR_NONE, ret);
-
- ret = w.GetSoftap();
- EXPECT_EQ(ERROR_NONE, ret);
-
- ret = w.EnableSoftap();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase DisableSoftap_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Disable softap using wifi-mesh-manager
-@apicovered "disable_softap" dbus method on net.wmesh.manager interface
-@passcase when DisableSoftap() returns ERROR_NONE
-@failcase when DisableSoftap() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, DisableSoftap_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.DisableSoftap();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase CreateMeshNetwork_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Create mesh network using wifi-mesh-manager
-@apicovered "create_mesh_network" dbus method on net.wmesh.manager interface
-@passcase when CreateMeshNetwork() returns ERROR_NONE
-@failcase when CreateMeshNetwork() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, CreateMeshNetwork_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.CreateMeshNetwork(mesh_id, 1, 2, 1);
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase ConnectMeshNetwork_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Connect to a mesh network using wifi-mesh-manager
-@apicovered "connect_mesh_network" dbus method on net.wmesh.manager interface
-@passcase when ConnectMeshNetwork() returns ERROR_NONE
-@failcase when ConnectMeshNetwork() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, ConnectMeshNetwork_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
- char *passphrase = (char *)"00000000";
-
- ret = w.ConnectMeshNetwork(mesh_id, 1, 2, passphrase);
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-
-/*
-@testcase Stop_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Stop wifi-mesh-manager
-@apicovered "disable_mesh" dbus method on net.wmesh.manager interface
-@passcase when DisableMesh() returns ERROR_NONE
-@failcase when DisableMesh() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, DisableMesh_p)
-{
- error_e ret = ERROR_NONE;
- Wmesh w;
-
- ret = w.DisableMesh();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-/*
-@testcase Disable_p
-@since_tizen 5.0
-@author SRID(abhishek.s94)
-@reviewer HQ(saerome.kim)
-@type auto
-@description Positive, Disable wifi-mesh-manager
-@apicovered "disable" dbus method on net.wmesh.manager interface
-@passcase when DisableManager() returns ERROR_NONE
-@failcase when DisableManager() does not return ERROR_NONE
-@precondition None
-@postcondition None
-*/
-TEST(WifiMeshManager, Disable_p)
-{
- error_e ret = ERROR_NONE;
- Manager mgr;
-
- ret = mgr.DisableManager();
- EXPECT_EQ(ERROR_NONE, ret);
-}
-
-int main(int argc, char **argv)
-{
- int ret = 0;
- try {
- testing::InitGoogleTest(&argc, argv);
- } catch (const ::testing::internal::GoogleTestFailureException& ex) {
- std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
- } catch (...) {
- std::cerr << "Caught: unknown exception" << std::endl;
- }
-
- try {
- ret = RUN_ALL_TESTS();
- } catch (const ::testing::internal::GoogleTestFailureException& ex) {
- std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
- } catch (...) {
- std::cerr << "Caught: unknown exception" << std::endl;
- }
- return ret;
-}
--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+#include <system_info.h>
+
+#include "manager.h"
+#include "wmesh.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+char *mesh_id = (char *)"haltestnetwork";
+char *feature_name = (char *)"http://tizen.org/feature/network.wifi.mesh";
+
+bool CheckFeature()
+{
+ bool mesh_supported = FALSE;
+ if (!system_info_get_platform_bool(feature_name, &mesh_supported)) {
+ if (FALSE == mesh_supported) {
+ GLOGD("wifi-mesh feature is disabled");
+ return ERROR_NOT_SUPPORTED;
+ }
+ return ERROR_NONE;
+ } else {
+ GLOGD("Error - Feature getting from System Info");
+ return ERROR_INVALID_PARAMETER;
+ }
+}
+
+/*
+@testcase Enable_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Enable wifi-mesh-manager
+@apicovered "enable" dbus method on net.wmesh.manager interface
+@passcase when EnableManager() returns ERROR_NONE
+@failcase when EnableManager() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, Enable_p)
+{
+ error_e ret = ERROR_NONE;
+ Manager mgr;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = mgr.EnableManager();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase StartMesh_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Start wifi-mesh-manager
+@apicovered "enable_mesh" dbus method on net.wmesh.manager interface
+@passcase when EnableMesh() returns ERROR_NONE
+@failcase when EnableMesh() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, EnableMesh_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.EnableMesh();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase Scan_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Scan using wifi-mesh-manager
+@apicovered "scan" dbus method on net.wmesh.manager interface
+@passcase when Scan() returns ERROR_NONE
+@failcase when Scan() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, Scan_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.Scan();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase EnableSoftap_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Enable softap using wifi-mesh-manager
+@apicovered "enable_softap" dbus method on net.wmesh.manager interface
+@passcase when EnableSoftap() returns ERROR_NONE
+@failcase when EnableSoftap() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, SetSoftap_p)
+{
+ static char ssid[] = "haltestnetwork";
+ static char passphrase[] = "00000000";
+ static int channel = 1;
+ static int visibility = 1;
+ static int max_stations = 10;
+ static int security = 2;
+
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.SetSoftap(ssid, passphrase,
+ channel, visibility, max_stations, security);
+ EXPECT_EQ(ERROR_NONE, ret);
+
+ ret = w.GetSoftap();
+
+ EXPECT_EQ(ERROR_NONE, ret);
+
+ ret = w.EnableSoftap();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase DisableSoftap_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Disable softap using wifi-mesh-manager
+@apicovered "disable_softap" dbus method on net.wmesh.manager interface
+@passcase when DisableSoftap() returns ERROR_NONE
+@failcase when DisableSoftap() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, DisableSoftap_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.DisableSoftap();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase CreateMeshNetwork_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Create mesh network using wifi-mesh-manager
+@apicovered "create_mesh_network" dbus method on net.wmesh.manager interface
+@passcase when CreateMeshNetwork() returns ERROR_NONE
+@failcase when CreateMeshNetwork() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, CreateMeshNetwork_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.CreateMeshNetwork(mesh_id, 1, 2, 1);
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase ConnectMeshNetwork_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Connect to a mesh network using wifi-mesh-manager
+@apicovered "connect_mesh_network" dbus method on net.wmesh.manager interface
+@passcase when ConnectMeshNetwork() returns ERROR_NONE
+@failcase when ConnectMeshNetwork() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, ConnectMeshNetwork_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+ char *passphrase = (char *)"00000000";
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.ConnectMeshNetwork(mesh_id, 1, 2, passphrase);
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+
+/*
+@testcase Stop_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Stop wifi-mesh-manager
+@apicovered "disable_mesh" dbus method on net.wmesh.manager interface
+@passcase when DisableMesh() returns ERROR_NONE
+@failcase when DisableMesh() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, DisableMesh_p)
+{
+ error_e ret = ERROR_NONE;
+ Wmesh w;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = w.DisableMesh();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+/*
+@testcase Disable_p
+@since_tizen 5.0
+@author SRID(abhishek.s94)
+@reviewer HQ(saerome.kim)
+@type auto
+@description Positive, Disable wifi-mesh-manager
+@apicovered "disable" dbus method on net.wmesh.manager interface
+@passcase when DisableManager() returns ERROR_NONE
+@failcase when DisableManager() does not return ERROR_NONE
+@precondition None
+@postcondition None
+*/
+TEST(WifiMeshManager, Disable_p)
+{
+ error_e ret = ERROR_NONE;
+ Manager mgr;
+
+ if (ERROR_NONE == CheckFeature()) {
+ ret = mgr.DisableManager();
+ }
+ EXPECT_EQ(ERROR_NONE, ret);
+}
+
+int main(int argc, char **argv)
+{
+ int ret = 0;
+ try {
+ testing::InitGoogleTest(&argc, argv);
+ } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+ std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+ } catch (...) {
+ std::cerr << "Caught: unknown exception" << std::endl;
+ }
+
+ try {
+ ret = RUN_ALL_TESTS();
+ } catch (const ::testing::internal::GoogleTestFailureException& ex) {
+ std::cerr << "Caught: GoogleTestFailureException& " << ex.what() << std::endl;
+ } catch (...) {
+ std::cerr << "Caught: unknown exception" << std::endl;
+ }
+ return ret;
+}
ERROR_IN_PROGRESS = -11,
} error_e;
+bool CheckFeature();
#endif /* __WIFI_MESH_MGR_H__ */
Manager for handling Wi-Fi mesh network
%package haltests
-Summary: wifi-mesh-manager extension for HAL test
-BuildRequires: pkgconfig(gmock)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(gio-2.0)
+Summary: wifi-mesh-manager extension for HAL test
+BuildRequires: pkgconfig(gmock)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(dlog)
-Requires: %{name} = %{version}-%{release}
+BuildRequires: pkgconfig(capi-system-info)
+Requires: %{name} = %{version}-%{release}
+
%description haltests
TIZEN wifi-mesh-manager extension for HAL test.