From: jihun park Date: Tue, 16 May 2017 03:46:52 +0000 (+0900) Subject: [ITC][usb-host][Non-ACR][Change folder name and adding wearable profile not supported... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f26e52c93454edd2792e3da9bbc95ea53376cb5;p=test%2Ftct%2Fnative%2Fapi.git [ITC][usb-host][Non-ACR][Change folder name and adding wearable profile not supported list] Change-Id: Id445f6a07b19f73191d4831783d9f0b6dad788b5 Signed-off-by: jihun park --- diff --git a/packaging/itc/native-usb-host-itc.spec b/packaging/itc/native-usb-host-itc.spec new file mode 100755 index 000000000..69018e353 --- /dev/null +++ b/packaging/itc/native-usb-host-itc.spec @@ -0,0 +1,78 @@ +%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} diff --git a/packaging/itc/native-usb-host-itc.xml b/packaging/itc/native-usb-host-itc.xml new file mode 100755 index 000000000..d499d37db --- /dev/null +++ b/packaging/itc/native-usb-host-itc.xml @@ -0,0 +1,14 @@ + + + + test + Native API test Application + + + + + + + + + diff --git a/packaging/itc/native-usbhost-itc.spec b/packaging/itc/native-usbhost-itc.spec deleted file mode 100755 index 89a6657ed..000000000 --- a/packaging/itc/native-usbhost-itc.spec +++ /dev/null @@ -1,78 +0,0 @@ -%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} diff --git a/packaging/itc/native-usbhost-itc.xml b/packaging/itc/native-usbhost-itc.xml deleted file mode 100755 index d9b2d1530..000000000 --- a/packaging/itc/native-usbhost-itc.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - test - Native API test Application - - - - - - - - - diff --git a/src/itc/usb-host/CMakeLists.txt b/src/itc/usb-host/CMakeLists.txt new file mode 100755 index 000000000..fa916d586 --- /dev/null +++ b/src/itc/usb-host/CMakeLists.txt @@ -0,0 +1,43 @@ +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() diff --git a/src/itc/usb-host/ITs-usb-host-common.c b/src/itc/usb-host/ITs-usb-host-common.c new file mode 100755 index 000000000..2e309f9ed --- /dev/null +++ b/src/itc/usb-host/ITs-usb-host-common.c @@ -0,0 +1,56 @@ +// +// 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; +} + +/** @} */ diff --git a/src/itc/usb-host/ITs-usb-host-common.h b/src/itc/usb-host/ITs-usb-host-common.h new file mode 100755 index 000000000..8eeecb547 --- /dev/null +++ b/src/itc/usb-host/ITs-usb-host-common.h @@ -0,0 +1,37 @@ +// +// 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_ diff --git a/src/itc/usb-host/ITs-usb-host.c b/src/itc/usb-host/ITs-usb-host.c new file mode 100755 index 000000000..5d2793e2d --- /dev/null +++ b/src/itc/usb-host/ITs-usb-host.c @@ -0,0 +1,110 @@ +// +// 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; +} + +/** @} */ +/** @} */ diff --git a/src/itc/usb-host/tct-usb-host-native.c b/src/itc/usb-host/tct-usb-host-native.c new file mode 100755 index 000000000..1dae3c630 --- /dev/null +++ b/src/itc/usb-host/tct-usb-host-native.c @@ -0,0 +1,143 @@ +// +// 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +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; +} diff --git a/src/itc/usb-host/tct-usb-host-native_mobile.h b/src/itc/usb-host/tct-usb-host-native_mobile.h new file mode 100755 index 000000000..3c38e428b --- /dev/null +++ b/src/itc/usb-host/tct-usb-host-native_mobile.h @@ -0,0 +1,32 @@ +// +// 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__ diff --git a/src/itc/usbhost/CMakeLists.txt b/src/itc/usbhost/CMakeLists.txt deleted file mode 100755 index 62c97fcf9..000000000 --- a/src/itc/usbhost/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -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() diff --git a/src/itc/usbhost/ITs-usbhost-common.c b/src/itc/usbhost/ITs-usbhost-common.c deleted file mode 100755 index 2a5cb610b..000000000 --- a/src/itc/usbhost/ITs-usbhost-common.c +++ /dev/null @@ -1,56 +0,0 @@ -// -// 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 diff --git a/src/itc/usbhost/ITs-usbhost-common.h b/src/itc/usbhost/ITs-usbhost-common.h deleted file mode 100755 index 8eeecb547..000000000 --- a/src/itc/usbhost/ITs-usbhost-common.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// 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_ diff --git a/src/itc/usbhost/ITs-usbhost.c b/src/itc/usbhost/ITs-usbhost.c deleted file mode 100755 index 657a3668e..000000000 --- a/src/itc/usbhost/ITs-usbhost.c +++ /dev/null @@ -1,110 +0,0 @@ -// -// 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; -} - -/** @} */ -/** @} */ diff --git a/src/itc/usbhost/tct-usbhost-native.c b/src/itc/usbhost/tct-usbhost-native.c deleted file mode 100755 index 292ceaf90..000000000 --- a/src/itc/usbhost/tct-usbhost-native.c +++ /dev/null @@ -1,143 +0,0 @@ -// -// 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -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; -} diff --git a/src/itc/usbhost/tct-usbhost-native_mobile.h b/src/itc/usbhost/tct-usbhost-native_mobile.h deleted file mode 100755 index 3c38e428b..000000000 --- a/src/itc/usbhost/tct-usbhost-native_mobile.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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__ diff --git a/tct_unsupported.txt b/tct_unsupported.txt index 099819fc9..85f2cab46 100755 --- a/tct_unsupported.txt +++ b/tct_unsupported.txt @@ -174,6 +174,10 @@ wearable:armv7l:itc:cbhm; 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; @@ -573,6 +577,10 @@ tv:armv7l:itc:cbhm; 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; @@ -1031,6 +1039,10 @@ common_iot:armv7l:itc:cbhm; 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;