--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="core-update-control-tests" version="0.1.0" api-version="3.0">
+ <label>CoreUpdateControlTest</label>
+ <author email="test@tizen.org" href="www.tizen.org">test</author>
+ <description>Core API test Application</description>
+ <ui-application appid="core.update-control-tests" exec="/usr/apps/core-update-control-tests/bin/tct-update-control-core" 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>
sound-pool
softap
zigbee
+update-control
--- /dev/null
+SET(PKG_NAME "update-control")
+
+SET(EXEC_NAME "tct-${PKG_NAME}-core")
+SET(RPM_NAME "core-${PKG_NAME}-tests")
+
+SET(CAPI_LIB "update-control")
+SET(TC_SOURCES
+ utc-update-control.c
+)
+
+PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
+ ${CAPI_LIB}
+ capi-appfw-application
+ capi-system-info
+ glib-2.0
+ bundle
+ dlog
+ elementary
+ update-control
+)
+
+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 "tct_common.h"
+
+#ifdef MOBILE //Starts MOBILE
+#include "tct-update-control-core_mobile.h"
+#endif //MOBILE //End MOBILE
+
+#ifdef WEARABLE //Starts WEARABLE
+#include "tct-update-control-core_wearable.h"
+#endif //WEARABLE //End WEARABLE
+
+#ifdef TV //Starts TV
+#include "tct-update-control-core_tv.h"
+#endif //TV //End TV
+
+#ifdef TIZENIOT //Starts TIZENIOT
+#include "tct-update-control-core_tizeniot.h"
+#endif //TIZENIOT //End TIZENIOT
+
+#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 <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)) )
+ {
+ DUMP_UTC_ERRLOG();
+ 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();
+ }
+
+ CLOSE_UTC_ERRLOG();
+ 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) 2018 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_UPDATE_CONTROL_NATIVE_H__
+#define __TCT_UPDATE_CONTROL_NATIVE_H__
+
+#include "testcase.h"
+#include "tct_common.h"
+
+extern void utc_update_control_startup(void);
+extern void utc_update_control_cleanup(void);
+
+extern int utc_update_control_check_new_version_p(void);
+extern int utc_update_control_download_package_p(void);
+extern int utc_update_control_do_update_p(void);
+extern int utc_update_control_make_reservation_p(void);
+extern int utc_update_control_make_reservation_n(void);
+extern int utc_update_control_cancel_reservation_p(void);
+extern int utc_update_control_get_property_NEW_VERSION_p(void);
+extern int utc_update_control_get_property_PACKAGE_URI_p(void);
+extern int utc_update_control_get_property_RESULT_p(void);
+extern int utc_update_control_get_property_PACKAGE_SIZE_p(void);
+extern int utc_update_control_get_property_DESCRIPTION_p(void);
+extern int utc_update_control_get_property_UPDATE_AVAILABLE_p(void);
+extern int utc_update_control_get_property_n(void);
+extern int utc_update_control_get_property_n2(void);
+
+testcase tc_array[] = {
+ {"utc_update_control_check_new_version_p", utc_update_control_check_new_version_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_download_package_p", utc_update_control_download_package_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_do_update_p", utc_update_control_do_update_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_make_reservation_p", utc_update_control_make_reservation_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_make_reservation_n", utc_update_control_make_reservation_n, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_cancel_reservation_p", utc_update_control_cancel_reservation_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_NEW_VERSION_p", utc_update_control_get_property_NEW_VERSION_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_PACKAGE_URI_p", utc_update_control_get_property_PACKAGE_URI_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_RESULT_p", utc_update_control_get_property_RESULT_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_PACKAGE_SIZE_p", utc_update_control_get_property_PACKAGE_SIZE_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_DESCRIPTION_p", utc_update_control_get_property_DESCRIPTION_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_UPDATE_AVAILABLE_p", utc_update_control_get_property_UPDATE_AVAILABLE_p, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_n", utc_update_control_get_property_n, utc_update_control_startup, utc_update_control_cleanup},
+ {"utc_update_control_get_property_n2", utc_update_control_get_property_n2, utc_update_control_startup, utc_update_control_cleanup},
+ {NULL, NULL}
+};
+
+#endif // __TCT_UPDATE_CONTROL_NATIVE_H__
--- /dev/null
+//
+// Copyright (c) 2018 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 <update_control.h>
+#include "assert.h"
+
+//& set: UpdateControl
+
+static bool g_feature = true;
+
+/**
+ * @function utc_uc_startup
+ * @description Called before each test
+ * @parameter NA
+ * @return NA
+ */
+void utc_update_control_startup(void)
+{
+ int ret;
+
+ system_info_get_platform_bool("http://tizen.org/feature/device_update", &g_feature);
+ if (false == g_feature)
+ return;
+
+ ret = update_control_initialize();
+ if (UPDATE_CONTROL_ERROR_NONE != ret)
+ return;
+}
+
+/**
+ * @function utc_uc_cleanup
+ * @description Called after each test
+ * @parameter NA
+ * @return NA
+ */
+void utc_update_control_cleanup(void)
+{
+ int ret;
+
+ ret = update_control_deinitialize();
+ if (UPDATE_CONTROL_ERROR_NONE != ret)
+ return;
+}
+
+
+/**
+ * @testcase utc_update_control_check_new_version_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_check_new_version
+ */
+int utc_update_control_check_new_version_p(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_check_new_version();
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_download_package_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_download_package
+ */
+int utc_update_control_download_package_p(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_download_package();
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_do_update_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_do_update
+ */
+int utc_update_control_do_update_p(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_do_update();
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_make_reservation_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_make_reservation
+ */
+int utc_update_control_make_reservation_p(void)
+{
+ int retcode = -1;
+ time_t timer;
+ struct tm *t;
+
+ timer = time(NULL);
+ t = localtime(&timer);
+ t->tm_mday += 1;
+
+ retcode = update_control_make_reservation(t);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_make_reservation_n
+ * @since_tizen 5.0
+ * @description Negative test case of update_control_make_reservation (Invalid parameter)
+ */
+int utc_update_control_make_reservation_n(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_make_reservation(NULL);
+ assert_neq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_cancel_reservation_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_cancel_reservation
+ */
+int utc_update_control_cancel_reservation_p(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_cancel_reservation();
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_NEW_VERSION_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (NEW_VERSION)
+ */
+int utc_update_control_get_property_NEW_VERSION_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_NEW_VERSION,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_PACKAGE_URI_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (PACKAGE_URI)
+ */
+int utc_update_control_get_property_PACKAGE_URI_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_PACKAGE_URI,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_RESULT_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (RESULT)
+ */
+int utc_update_control_get_property_RESULT_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_RESULT,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_PACKAGE_SIZE_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (PACKAGE_SIZE)
+ */
+int utc_update_control_get_property_PACKAGE_SIZE_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_PACKAGE_SIZE,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_DESCRIPTION_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (DESCRIPTION)
+ */
+int utc_update_control_get_property_DESCRIPTION_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_DESCRIPTION,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_UPDATE_AVAILABLE_p
+ * @since_tizen 5.0
+ * @description Positive test case of update_control_get_property (UPDATE_AVAILABLE)
+ */
+int utc_update_control_get_property_UPDATE_AVAILABLE_p(void)
+{
+ int retcode = -1;
+ void *retval = NULL;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_UPDATE_AVAILABLE,
+ &retval);
+ if (retval)
+ free(retval);
+ assert_eq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_n
+ * @since_tizen 5.0
+ * @description Negative test case of update_control_get_property (not found key)
+ */
+int utc_update_control_get_property_n(void)
+{
+ int retcode = -1;
+ char *invalid_key = NULL;
+
+ retcode = update_control_get_property(9999, (void **)&invalid_key);
+ if (invalid_key)
+ free(invalid_key);
+ assert_neq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_update_control_get_property_n2
+ * @since_tizen 5.0
+ * @description Negative test case of update_control_get_property (Invalid parameter)
+ */
+int utc_update_control_get_property_n2(void)
+{
+ int retcode = -1;
+
+ retcode = update_control_get_property(UPDATE_CONTROL_PROPERTY_NEW_VERSION, NULL);
+ assert_neq(retcode, UPDATE_CONTROL_ERROR_NONE);
+
+ return 0;
+}
mobile:aarch64:utc:zigbee;
mobile:x86:utc:zigbee;
mobile:x86_64:utc:zigbee;
+mobile:armv7l:utc:update-control;
+mobile:aarch64:utc:update-control;
+mobile:x86:utc:update-control;
+mobile:x86_64:utc:update-control;
+
## itc ##
mobile:armv7l:itc:appcore-watch;
wearable:aarch64:utc:zigbee;
wearable:x86:utc:zigbee;
wearable:x86_64:utc:zigbee;
+wearable:armv7l:utc:update-control;
+wearable:aarch64:utc:update-control;
+wearable:x86:utc:update-control;
+wearable:x86_64:utc:update-control;
+
## itc ##
wearable:armv7l:itc:asp;