--- /dev/null
+%define MODULE_NAME usb-host
+%define MODULE_LIBNAME capi-system-usbhost
+Name: native-%{MODULE_NAME}-itc
+Summary: Native API Integration TC (%{name})
+Version: 0.1
+Release: 0
+Group: Development/Tools
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+BuildRequires: pkgconfig(%{MODULE_LIBNAME})
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: cmake
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(capi-system-info)
+
+%description
+Native API Integration TC (%{name})
+
+%prep
+%setup -q
+
+%build
+
+%define PREFIX "%{_libdir}/%{name}"
+
+export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
+
+%if %{?ASAN_BUILD:1}0
+ %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_TV:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+%else
+ %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_TV:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+ %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
+ cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
+ %endif
+%endif
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}/usr/share/packages/
+cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/
+mkdir -p %{buildroot}%{APP_PATH}%{name}/bin
+%post
+
+%postun
+
+
+%files
+%{APP_PATH}%{name}/*
+/usr/share/packages/native-%{MODULE_NAME}-itc.xml
+/usr/share/license/%{name}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="native-usb-host-itc" version="0.1.0" api-version="3.0">
+ <label>NativeUsbHostTest</label>
+ <author email="mymail@tizentest.com" href="www.tizentest.com">test</author>
+ <description>Native API test Application</description>
+ <ui-application appid="native.usb-host-itc" exec="/usr/apps/native-usb-host-itc/bin/tct-usb-host-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <background-category value="background-network"/>
+ <background-category value="download"/>
+ <background-category value="iot-communication"/>
+ <background-category value="location"/>
+ <background-category value="media"/>
+ <background-category value="sensor"/>
+ </ui-application>
+</manifest>
+++ /dev/null
-%define MODULE_NAME usbhost
-%define MODULE_LIBNAME usbhost
-Name: native-%{MODULE_NAME}-itc
-Summary: Native API Integration TC (%{name})
-Version: 0.1
-Release: 0
-Group: Development/Tools
-License: Apache-2.0
-Source0: %{name}-%{version}.tar.gz
-BuildRequires: pkgconfig(%{MODULE_LIBNAME})
-BuildRequires: pkgconfig(capi-appfw-application)
-BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: cmake
-BuildRequires: pkgconfig(bundle)
-BuildRequires: pkgconfig(elementary)
-BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(capi-system-info)
-
-%description
-Native API Integration TC (%{name})
-
-%prep
-%setup -q
-
-%build
-
-%define PREFIX "%{_libdir}/%{name}"
-
-export LDFLAGS+="-Wl,--rpath=%{PREFIX} -Wl,--as-needed"
-
-%if %{?ASAN_BUILD:1}0
- %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_TV:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="true" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
-%else
- %if %{?DEVICE_BUILD_TYPE_MOBILE:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="mobile" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_WEARABLE:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="wearable" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_TV:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="tv" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
- %if %{?DEVICE_BUILD_TYPE_COMMON_IOT:1}0
- cmake . -DMODULE="%{MODULE_NAME}" -DBUILDTCTYPE="itc" -DDEVICE_BUILD_TYPE="common_iot" -DASANBUILD="false" -DCMAKE_INSTALL_PREFIX=%{_prefix}
- %endif
-%endif
-
-make %{?jobs:-j%jobs}
-
-%install
-rm -rf %{buildroot}
-%make_install
-mkdir -p %{buildroot}/usr/share/license
-cp LICENSE %{buildroot}/usr/share/license/%{name}
-
-mkdir -p %{buildroot}/usr/share/packages/
-cp packaging/itc/native-%{MODULE_NAME}-itc.xml %{buildroot}/usr/share/packages/
-mkdir -p %{buildroot}%{APP_PATH}%{name}/bin
-%post
-
-%postun
-
-
-%files
-%{APP_PATH}%{name}/*
-/usr/share/packages/native-%{MODULE_NAME}-itc.xml
-/usr/share/license/%{name}
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="native-usbhost-itc" version="0.1.0" api-version="3.0">
- <label>NativeUsbhostTest</label>
- <author email="mymail@tizentest.com" href="www.tizentest.com">test</author>
- <description>Native API test Application</description>
- <ui-application appid="native.usbhost-itc" exec="/usr/apps/native-usbhost-itc/bin/tct-usbhost-native" nodisplay="false" multiple="false" type="capp" taskmanage="true">
- <background-category value="background-network"/>
- <background-category value="download"/>
- <background-category value="iot-communication"/>
- <background-category value="location"/>
- <background-category value="media"/>
- <background-category value="sensor"/>
- </ui-application>
-</manifest>
--- /dev/null
+SET(PKG_NAME "usb-host")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-native")
+SET(RPM_NAME "native-${PKG_NAME}-itc")
+
+SET(CAPI_LIB "capi-system-usbhost")
+SET(TC_SOURCES
+ ITs-usb-host-common.c
+ ITs-usb-host.c
+)
+
+PKG_CHECK_MODULES(
+ ${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-application
+ glib-2.0
+ bundle
+ capi-system-info
+ dlog
+ elementary
+)
+
+INCLUDE_DIRECTORIES(
+ ${${CAPI_LIB}_INCLUDE_DIRS}
+)
+
+ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
+TARGET_LINK_LIBRARIES(${EXEC_NAME}
+ ${${CAPI_LIB}_LIBRARIES}
+ bundle
+)
+
+INSTALL(PROGRAMS ${EXEC_NAME}
+ DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
+)
+
+IF( DEFINED ASAN )
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
+ELSE()
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
+ENDIF()
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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 "ITs-usb-host-common.h"
+
+/** @addtogroup itc-usbhost
+* @ingroup itc
+* @{
+*/
+
+//Add helper function definitions here
+
+/**
+* @function UsbHostGetError
+* @description Maps usb_host_error_e enums
+* @parameter error : error level
+* @return error string
+*/
+char* UsbHostGetError(usb_host_error_e error)
+{
+ char *szErrorVal = NULL;
+ switch ( error )
+ {
+ case USB_HOST_ERROR_NONE: szErrorVal = "USB_HOST_ERROR_NONE"; break;
+ case USB_HOST_ERROR_IO_ERROR: szErrorVal = "USB_HOST_ERROR_IO_ERROR"; break;
+ case USB_HOST_ERROR_INVALID_PARAMETER: szErrorVal = "USB_HOST_ERROR_INVALID_PARAMETER"; break;
+ case USB_HOST_ERROR_PERMISSION_DENIED: szErrorVal = "USB_HOST_ERROR_PERMISSION_DENIED"; break;
+ case USB_HOST_ERROR_NO_SUCH_DEVICE: szErrorVal = "USB_HOST_ERROR_NO_SUCH_DEVICE"; break;
+ case USB_HOST_ERROR_NOT_FOUND: szErrorVal = "USB_HOST_ERROR_NOT_FOUND"; break;
+ case USB_HOST_ERROR_RESOURCE_BUSY: szErrorVal = "USB_HOST_ERROR_RESOURCE_BUSY"; break;
+ case USB_HOST_ERROR_TIMED_OUT: szErrorVal = "USB_HOST_ERROR_TIMED_OUT"; break;
+ case USB_HOST_ERROR_OVERFLOW: szErrorVal = "USB_HOST_ERROR_OVERFLOW"; break;
+ case USB_HOST_ERROR_DEVICE_NOT_OPENED: szErrorVal = "USB_HOST_ERROR_DEVICE_NOT_OPENED"; break;
+ case USB_HOST_ERROR_BROKEN_PIPE: szErrorVal = "USB_HOST_ERROR_BROKEN_PIPE"; break;
+ case USB_HOST_ERROR_INTERRUPTED_SYS_CALL: szErrorVal = "USB_HOST_ERROR_INTERRUPTED_SYS_CALL"; break;
+ case USB_HOST_ERROR_OUT_OF_MEMORY: szErrorVal = "USB_HOST_ERROR_OUT_OF_MEMORY"; break;
+ case USB_HOST_ERROR_NOT_SUPPORTED: szErrorVal = "USB_HOST_ERROR_NOT_SUPPORTED"; break;
+ default: szErrorVal = "Unknown Error"; break;
+ }
+
+ return szErrorVal;
+}
+
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+#ifndef _ITS_USBHOST_COMMON_H_
+#define _ITS_USBHOST_COMMON_H_
+
+//Add test package related includes here
+#include "tct_common.h"
+#include "usb_host.h"
+/** @addtogroup itc-%{MODULE_NAME}
+* @ingroup itc
+* @{
+*/
+
+//Add helper function declarations here
+
+#define API_NAMESPACE "USBHOST_ITC"
+
+#define START_TEST {\
+ FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
+}
+
+char* UsbHostGetError(usb_host_error_e error);
+/** @} */
+#endif //_ITS_USBHOST_COMMON_H_
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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 "ITs-usb-host-common.h"
+
+//& set: Usbhost
+
+/** @addtogroup itc-usbhost
+* @ingroup itc
+* @{
+*/
+
+/**
+ * @function ITs_usbhost_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_usbhost_startup(void)
+{
+ struct stat stBuff;
+ if ( stat(ERR_LOG, &stBuff) == 0 )
+ {
+ remove(ERR_LOG);
+ }
+
+ return;
+}
+
+
+/**
+ * @function ITs_usbhost_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void ITs_usbhost_cleanup(void)
+{
+ return;
+}
+
+/**
+* @function UsbHostHotplugCB
+* @description To Call when usb hotplug connect or disconnect
+* @return NA
+*/
+void UsbHostHotplugCB(usb_host_device_h dev, void *user_data)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] UsbHostHotplugCB is called\\n", __LINE__, API_NAMESPACE);
+#endif
+}
+
+//& purpose: Registers and Unregisters the hotplug callback
+//& type: auto
+/**
+* @testcase ITc_usb_host_set_unset_hotplug_cb_p
+* @since_tizen 4.0
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Registers and Unregisters the hotplug callback
+* @scenario Registers and Unregisters the hotplug callback
+* @apicovered usb_host_set_hotplug_cb, usb_host_unset_hotplug_cb
+* @passcase If target API gets pass
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_usb_host_set_unset_hotplug_cb_p(void)
+{
+ START_TEST;
+
+ usb_host_context_h hCtxHandle;
+ usb_host_hotplug_h hHandle;
+
+ int nRet = usb_host_create(&hCtxHandle);
+ PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_create", UsbHostGetError(nRet));
+ if(hCtxHandle == NULL)
+ {
+ FPRINTF("[Line : %d][%s] hCtxHandle is NULL %s\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ //Callback is NULL as it require usb attach and detach event manually
+ nRet = usb_host_set_hotplug_cb(hCtxHandle, UsbHostHotplugCB, USB_HOST_HOTPLUG_EVENT_ANY, NULL, &hHandle);
+ PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_set_hotplug_cb", UsbHostGetError(nRet));
+ if(hHandle != NULL)
+ {
+ nRet = usb_host_unset_hotplug_cb(hHandle);
+ PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_unset_hotplug_cb", UsbHostGetError(nRet));
+ }
+
+ return 0;
+}
+
+/** @} */
+/** @} */
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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 "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-usb-host-native_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-usb-host-native_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-usb-host-native_tv.h"
+#endif //TV //End TV
+
+#ifdef COMMON_IOT //Starts COMMON_IOT
+#include "tct-usb-host-native_common_iot.h"
+#endif //COMMON_IOT //End COMMON_IOT
+
+#include <stdio.h>
+#include <string.h>
+#include <malloc.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <glib.h>
+#include <stdbool.h>
+#include <app.h>
+#include <dlog.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+
+#include <Elementary.h>
+
+typedef struct appdata {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *label;
+} appdata_s;
+
+static bool app_create(void *data)
+{
+ return true;
+}
+
+static void app_control(app_control_h app_control, void *data)
+{
+ char* pszGetTCName = NULL;
+ int i=0, result=0, nRet=0;
+ nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
+ if(nRet != APP_CONTROL_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
+ for ( i = 0; tc_array[i].name; i++ )
+ {
+ if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
+ {
+ if ( tc_array[i].startup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
+ tc_array[i].startup();
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
+ result = tc_array[i].function();
+ dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
+
+ if ( tc_array[i].cleanup )
+ {
+ dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
+ tc_array[i].cleanup();
+ }
+
+ PRINT_TC_RESULT("%d",result);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+ }
+ }
+
+ dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
+ PRINT_TC_RESULT("%d",1);
+ FREE_MEMORY_TC(pszGetTCName);
+ return;
+}
+
+static void app_terminate(void *data)
+{
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
+}
+
+int main(int argc, char *argv[])
+{
+ int ret = 0;
+ appdata_s ad = {0,};
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.app_control = app_control;
+
+ //setting gcda file location for coverage
+ setenv("GCOV_PREFIX","/tmp",1);
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
+ ret = ui_app_main(argc, argv, &event_callback, &ad);
+ if (ret != APP_ERROR_NONE)
+ {
+ dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
+ PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
+ PRINT_TC_RESULT("%d",1);
+ return ret;
+ }
+
+ dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
+ return ret;
+}
--- /dev/null
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// 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.
+//
+#ifndef __TCT_USBHOST_NATIVE_H__
+#define __TCT_USBHOST_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void ITs_usbhost_startup(void);
+extern void ITs_usbhost_cleanup(void);
+
+extern int ITc_usb_host_set_unset_hotplug_cb_p(void);
+
+testcase tc_array[] = {
+ {"ITc_usb_host_set_unset_hotplug_cb_p", ITc_usb_host_set_unset_hotplug_cb_p, ITs_usbhost_startup, ITs_usbhost_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_USBHOST_NATIVE_H__
+++ /dev/null
-SET(PKG_NAME "usbhost")
-
-SET(EXEC_NAME "tct-${PKG_NAME}-native")
-SET(RPM_NAME "native-${PKG_NAME}-itc")
-
-SET(CAPI_LIB "usbhost")
-SET(TC_SOURCES
- ITs-usbhost-common.c
- ITs-usbhost.c
-)
-
-PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
- ${CAPI_LIB}
- capi-appfw-application
- glib-2.0
- bundle
- capi-system-info
- dlog
- elementary
-)
-
-INCLUDE_DIRECTORIES(
- ${${CAPI_LIB}_INCLUDE_DIRS}
-)
-
-ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE})
-TARGET_LINK_LIBRARIES(${EXEC_NAME}
- ${${CAPI_LIB}_LIBRARIES}
- bundle
-)
-
-INSTALL(PROGRAMS ${EXEC_NAME}
- DESTINATION ${BIN_DIR}/${RPM_NAME}/bin
-)
-
-IF( DEFINED ASAN )
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address")
-ELSE()
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie")
-ENDIF()
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// 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 "ITs-usbhost-common.h"
-
-/** @addtogroup itc-usbhost
-* @ingroup itc
-* @{
-*/
-
-//Add helper function definitions here
-
-/**
-* @function UsbHostGetError
-* @description Maps usb_host_error_e enums
-* @parameter error : error level
-* @return error string
-*/
-char* UsbHostGetError(usb_host_error_e error)
-{
- char *szErrorVal = NULL;
- switch ( error )
- {
- case USB_HOST_ERROR_NONE: szErrorVal = "USB_HOST_ERROR_NONE"; break;
- case USB_HOST_ERROR_IO_ERROR: szErrorVal = "USB_HOST_ERROR_IO_ERROR"; break;
- case USB_HOST_ERROR_INVALID_PARAMETER: szErrorVal = "USB_HOST_ERROR_INVALID_PARAMETER"; break;
- case USB_HOST_ERROR_PERMISSION_DENIED: szErrorVal = "USB_HOST_ERROR_PERMISSION_DENIED"; break;
- case USB_HOST_ERROR_NO_SUCH_DEVICE: szErrorVal = "USB_HOST_ERROR_NO_SUCH_DEVICE"; break;
- case USB_HOST_ERROR_NOT_FOUND: szErrorVal = "USB_HOST_ERROR_NOT_FOUND"; break;
- case USB_HOST_ERROR_RESOURCE_BUSY: szErrorVal = "USB_HOST_ERROR_RESOURCE_BUSY"; break;
- case USB_HOST_ERROR_TIMED_OUT: szErrorVal = "USB_HOST_ERROR_TIMED_OUT"; break;
- case USB_HOST_ERROR_OVERFLOW: szErrorVal = "USB_HOST_ERROR_OVERFLOW"; break;
- case USB_HOST_ERROR_DEVICE_NOT_OPENED: szErrorVal = "USB_HOST_ERROR_DEVICE_NOT_OPENED"; break;
- case USB_HOST_ERROR_BROKEN_PIPE: szErrorVal = "USB_HOST_ERROR_BROKEN_PIPE"; break;
- case USB_HOST_ERROR_INTERRUPTED_SYS_CALL: szErrorVal = "USB_HOST_ERROR_INTERRUPTED_SYS_CALL"; break;
- case USB_HOST_ERROR_OUT_OF_MEMORY: szErrorVal = "USB_HOST_ERROR_OUT_OF_MEMORY"; break;
- case USB_HOST_ERROR_NOT_SUPPORTED: szErrorVal = "USB_HOST_ERROR_NOT_SUPPORTED"; break;
- default: szErrorVal = "Unknown Error"; break;
- }
-
- return szErrorVal;
-}
-
-/** @} */
\ No newline at end of file
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// 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.
-//
-#ifndef _ITS_USBHOST_COMMON_H_
-#define _ITS_USBHOST_COMMON_H_
-
-//Add test package related includes here
-#include "tct_common.h"
-#include "usb_host.h"
-/** @addtogroup itc-%{MODULE_NAME}
-* @ingroup itc
-* @{
-*/
-
-//Add helper function declarations here
-
-#define API_NAMESPACE "USBHOST_ITC"
-
-#define START_TEST {\
- FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\
-}
-
-char* UsbHostGetError(usb_host_error_e error);
-/** @} */
-#endif //_ITS_USBHOST_COMMON_H_
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// 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 "ITs-usbhost-common.h"
-
-//& set: Usbhost
-
-/** @addtogroup itc-usbhost
-* @ingroup itc
-* @{
-*/
-
-/**
- * @function ITs_usbhost_startup
- * @description Called before each test
- * @parameter NA
- * @return NA
- */
-void ITs_usbhost_startup(void)
-{
- struct stat stBuff;
- if ( stat(ERR_LOG, &stBuff) == 0 )
- {
- remove(ERR_LOG);
- }
-
- return;
-}
-
-
-/**
- * @function ITs_usbhost_cleanup
- * @description Called after each test
- * @parameter NA
- * @return NA
- */
-void ITs_usbhost_cleanup(void)
-{
- return;
-}
-
-/**
-* @function UsbHostHotplugCB
-* @description To Call when usb hotplug connect or disconnect
-* @return NA
-*/
-void UsbHostHotplugCB(usb_host_device_h dev, void *user_data)
-{
-#if DEBUG
- FPRINTF("[Line : %d][%s] UsbHostHotplugCB is called\\n", __LINE__, API_NAMESPACE);
-#endif
-}
-
-//& purpose: Registers and Unregisters the hotplug callback
-//& type: auto
-/**
-* @testcase ITc_usb_host_set_unset_hotplug_cb_p
-* @since_tizen 4.0
-* @author SRID(nibha.sharma)
-* @reviewer SRID(shobhit.v)
-* @type auto
-* @description Registers and Unregisters the hotplug callback
-* @scenario Registers and Unregisters the hotplug callback
-* @apicovered usb_host_set_hotplug_cb, usb_host_unset_hotplug_cb
-* @passcase If target API gets pass
-* @failcase If target API fails or any precondition API fails
-* @precondition None
-* @postcondition None
-*/
-int ITc_usb_host_set_unset_hotplug_cb_p(void)
-{
- START_TEST;
-
- usb_host_context_h hCtxHandle;
- usb_host_hotplug_h hHandle;
-
- int nRet = usb_host_create(&hCtxHandle);
- PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_create", UsbHostGetError(nRet));
- if(hCtxHandle == NULL)
- {
- FPRINTF("[Line : %d][%s] hCtxHandle is NULL %s\\n", __LINE__, API_NAMESPACE);
- return 1;
- }
-
- //Callback is NULL as it require usb attach and detach event manually
- nRet = usb_host_set_hotplug_cb(hCtxHandle, UsbHostHotplugCB, USB_HOST_HOTPLUG_EVENT_ANY, NULL, &hHandle);
- PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_set_hotplug_cb", UsbHostGetError(nRet));
- if(hHandle != NULL)
- {
- nRet = usb_host_unset_hotplug_cb(hHandle);
- PRINT_RESULT(USB_HOST_ERROR_NONE, nRet, "usb_host_unset_hotplug_cb", UsbHostGetError(nRet));
- }
-
- return 0;
-}
-
-/** @} */
-/** @} */
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// 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 "tct_common.h"
-
-#ifdef MOBILE //Starts MOBILE
-#include "tct-usbhost-native_mobile.h"
-#endif //MOBILE //End MOBILE
-
-#ifdef WEARABLE //Starts WEARABLE
-#include "tct-usbhost-native_wearable.h"
-#endif //WEARABLE //End WEARABLE
-
-#ifdef TV //Starts TV
-#include "tct-usbhost-native_tv.h"
-#endif //TV //End TV
-
-#ifdef COMMON_IOT //Starts COMMON_IOT
-#include "tct-usbhost-native_common_iot.h"
-#endif //COMMON_IOT //End COMMON_IOT
-
-#include <stdio.h>
-#include <string.h>
-#include <malloc.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <glib.h>
-#include <stdbool.h>
-#include <app.h>
-#include <dlog.h>
-
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-#include <Elementary.h>
-
-typedef struct appdata {
- Evas_Object *win;
- Evas_Object *conform;
- Evas_Object *label;
-} appdata_s;
-
-static bool app_create(void *data)
-{
- return true;
-}
-
-static void app_control(app_control_h app_control, void *data)
-{
- char* pszGetTCName = NULL;
- int i=0, result=0, nRet=0;
- nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName);
- if(nRet != APP_CONTROL_ERROR_NONE)
- {
- dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet);
- PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__);
- PRINT_TC_RESULT("%d",1);
- FREE_MEMORY_TC(pszGetTCName);
- return;
- }
-
- dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName);
- for ( i = 0; tc_array[i].name; i++ )
- {
- if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) )
- {
- if ( tc_array[i].startup )
- {
- dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName);
- tc_array[i].startup();
- }
-
- dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName);
- result = tc_array[i].function();
- dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result);
-
- if ( tc_array[i].cleanup )
- {
- dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName);
- tc_array[i].cleanup();
- }
-
- PRINT_TC_RESULT("%d",result);
- FREE_MEMORY_TC(pszGetTCName);
- return;
- }
- }
-
- dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName);
- PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName);
- PRINT_TC_RESULT("%d",1);
- FREE_MEMORY_TC(pszGetTCName);
- return;
-}
-
-static void app_terminate(void *data)
-{
- dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__);
-}
-
-int main(int argc, char *argv[])
-{
- int ret = 0;
- appdata_s ad = {0,};
-
- ui_app_lifecycle_callback_s event_callback = {0,};
- event_callback.create = app_create;
- event_callback.terminate = app_terminate;
- event_callback.app_control = app_control;
-
- //setting gcda file location for coverage
- setenv("GCOV_PREFIX","/tmp",1);
- dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__);
-
- dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__);
- ret = ui_app_main(argc, argv, &event_callback, &ad);
- if (ret != APP_ERROR_NONE)
- {
- dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret);
- PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret);
- PRINT_TC_RESULT("%d",1);
- return ret;
- }
-
- dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__);
- return ret;
-}
+++ /dev/null
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// 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.
-//
-#ifndef __TCT_USBHOST_NATIVE_H__
-#define __TCT_USBHOST_NATIVE_H__
-
-#include "testcase.h"
-#include "tct_common.h"
-
-extern void ITs_usbhost_startup(void);
-extern void ITs_usbhost_cleanup(void);
-
-extern int ITc_usb_host_set_unset_hotplug_cb_p(void);
-
-testcase tc_array[] = {
- {"ITc_usb_host_set_unset_hotplug_cb_p", ITc_usb_host_set_unset_hotplug_cb_p, ITs_usbhost_startup, ITs_usbhost_cleanup},
- {NULL, NULL}
-};
-
-#endif // __TCT_USBHOST_NATIVE_H__
wearable:aarch64:itc:cbhm;
wearable:x86:itc:cbhm;
wearable:x86_64:itc:cbhm;
+wearable:armv7l:itc:usb-host;
+wearable:aarch64:itc:usb-host;
+wearable:x86:itc:usb-host;
+wearable:x86_64:itc:usb-host;
## ctc ##
wearable:armv7l:ctc:video-util;
tv:aarch64:itc:cbhm;
tv:x86:itc:cbhm;
tv:x86_64:itc:cbhm;
+tv:armv7l:itc:usb-host;
+tv:aarch64:itc:usb-host;
+tv:x86:itc:usb-host;
+tv:x86_64:itc:usb-host;
## ctc ##
tv:armv7l:ctc:camera;
common_iot:aarch64:itc:cbhm;
common_iot:x86:itc:cbhm;
common_iot:x86_64:itc:cbhm;
+common_iot:armv7l:itc:usb-host;
+common_iot:aarch64:itc:usb-host;
+common_iot:x86:itc:usb-host;
+common_iot:x86_64:itc:usb-host;
## ctc ##
common_iot:armv7l:ctc:filesystem-permission;