diff options
-rwxr-xr-x | TC/_export_env.sh | 8 | ||||
-rwxr-xr-x | TC/_export_target_env.sh | 7 | ||||
-rwxr-xr-x | TC/build.sh | 16 | ||||
-rwxr-xr-x | TC/clean.sh | 11 | ||||
-rw-r--r-- | TC/config.default | 2 | ||||
-rwxr-xr-x | TC/execute.sh | 15 | ||||
-rw-r--r-- | TC/testcase/tslist | 1 | ||||
-rwxr-xr-x | TC/testcase/utc_network_connection.c | 1010 | ||||
-rwxr-xr-x | TC/testcase/utc_network_connection.h | 65 | ||||
-rw-r--r-- | TC/tet_scen | 7 | ||||
-rw-r--r-- | TC/tetbuild.cfg | 5 | ||||
-rw-r--r-- | TC/tetclean.cfg | 5 | ||||
-rw-r--r-- | TC/tetexec.cfg | 5 |
13 files changed, 1157 insertions, 0 deletions
diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100755 index 0000000..5ddaa53 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,7 @@ +#!/bin/sh +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..72aad6c --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100755 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured diff --git a/TC/config.default b/TC/config.default new file mode 100644 index 0000000..04684f0 --- /dev/null +++ b/TC/config.default @@ -0,0 +1,2 @@ +TET_INSTALL_HOST_PATH=/home/rookiejava/dts_tool/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/dts_tool/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..0fe02e2 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100644 index 0000000..4d4a9a7 --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1 @@ +/testcase/utc_network_connection diff --git a/TC/testcase/utc_network_connection.c b/TC/testcase/utc_network_connection.c new file mode 100755 index 0000000..03e5387 --- /dev/null +++ b/TC/testcase/utc_network_connection.c @@ -0,0 +1,1010 @@ +/* + * Copyright (c) 2011 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 <stdlib.h> +#include <glib.h> +#include <glib-object.h> +#include "utc_network_connection.h" + +connection_h handle = NULL; +static void startup(), cleanup(); +void (*tet_startup) () = startup; +void (*tet_cleanup) () = cleanup; +int rv = 0; +static connection_network_status_e conn_status = CONNECTION_STATUS_UNAVAILABLE; + +struct tet_testlist tet_testlist[] = { + {utc_connection_create_positive,1}, + {utc_connection_create_negative,2}, + {utc_connection_destroy_positive,3}, + {utc_connection_destroy_negative,4}, + {utc_connection_set_cb_positive,5}, + {utc_connection_set_cb_negative,6}, + {utc_connection_get_ip_address_positive,7}, + {utc_connection_get_ip_address_negative,8}, + {utc_connection_get_proxy_positive,9}, + {utc_connection_get_proxy_negative,10}, + {utc_connection_get_network_status_positive_1,11}, + {utc_connection_get_network_status_positive_2,12}, + {utc_connection_get_network_status_positive_3,13}, + {utc_connection_get_network_status_negative_1,14}, + {utc_connection_get_network_status_negative_2,15}, + {utc_connection_is_connected_positive,16}, + {utc_connection_unset_cb_positive,17}, + {utc_connection_unset_cb_negative,18}, + {utc_connection_get_last_sent_positive,19}, + {utc_connection_get_last_sent_negative,20}, + {utc_connection_get_last_recv_positive,21}, + {utc_connection_get_last_recv_negative,22}, + {utc_connection_get_total_sent_positive,23}, + {utc_connection_get_total_sent_negative,24}, + {utc_connection_get_total_recv_positive,25}, + {utc_connection_get_total_recv_negative,26}, + {utc_connection_get_total_duration_positive,27}, + {utc_connection_get_total_duration_negative,28}, + {utc_connection_get_wifi_last_datacall_duration_positive,29}, + {utc_connection_get_wifi_last_datacall_duration_negative,30}, + {utc_connection_get_wifi_last_received_data_size_positive,31}, + {utc_connection_get_wifi_last_received_data_size_negative,32}, + {utc_connection_get_wifi_last_sent_data_size_positive,33}, + {utc_connection_get_wifi_last_sent_data_size_negative,34}, + {utc_connection_get_wifi_total_datacall_duration_positive,35}, + {utc_connection_get_wifi_total_datacall_duration_negative,36}, + {utc_connection_get_wifi_total_received_data_size_positive,37}, + {utc_connection_get_wifi_total_received_data_size_negative,38}, + {utc_connection_get_wifi_total_sent_data_size_positive,39}, + {utc_connection_get_wifi_total_sent_data_size_negative,40}, + {utc_connection_get_last_datacall_duration_positive,41}, + {utc_connection_get_last_datacall_duration_negative,42}, + {TET_NULLFP, 0} + }; + + + +//callbacks +void net_callback(const connection_network_param_e param, void *user_data) +{ + tet_printf("== CM callback == %d\n", param); +} + +int create_handle() +{ + int rv=0; + rv = connection_create(&handle); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Create Error [%d]\n", rv); + return 1; + } + tet_printf("Connection Create Success [%d]\n", rv); + return 0; + +} + +int set_callbacks() +{ + int rv = 0; + rv = connection_set_cb(handle, net_callback, NULL); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Set Callback is not called! Error [%d]\n", rv); + return 1; + } + tet_printf("Connection Set Callback! Success [%d]\n", rv); + return 0; +} + +int get_api_preconditions() +{ + if(create_handle()){ + tet_result(TET_FAIL); + return 1; + } + if(set_callbacks()){ + tet_result(TET_FAIL); + return 1; + } + return 0; +} + +void startup() +{ + tet_printf(" TC startup"); + return; +} + +void cleanup() +{ + tet_printf(" TC cleanup"); + return; +} + +void utc_connection_create_positive(void) +{ + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); + return; +} + +void utc_connection_create_negative(void) +{ + int rv=0; + rv = connection_create(NULL); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Create Must Fail! Success [%d]\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Create Must Fail ! Error [%d]\n", rv); + tet_result(TET_FAIL); + return; +} + + +void utc_connection_set_cb_positive(void) +{ + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + if(set_callbacks()){ + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_result(TET_PASS); + connection_destroy(handle); + return; +} + +void utc_connection_set_cb_negative(void) +{ + int rv=0; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_set_cb(NULL, NULL, NULL); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Set Callback! Must Fail : Success [%d]\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection Set Callback Must Fail! Error [%d]\n", rv); + connection_destroy(handle); + tet_result(TET_FAIL); + return; +} + +void utc_connection_get_ip_address_positive(void) +{ + int rv=0; + + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + char *ip_address=NULL; + rv = connection_get_ip_address(handle, &ip_address); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Get IP Address Failed [%d]\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + if(ip_address !=NULL) + tet_printf("Connection Get IP Address Success : %s\n", ip_address); + else + tet_printf("Connection Get IP Address Success : No IP Address from Network\n"); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} + +void utc_connection_get_ip_address_negative(void) +{ + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + char *ip_address=NULL; + rv = connection_get_ip_address(NULL, &ip_address); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Get IP Address Must Fail [%d]\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection Get IP Address Must Fail Success : %d\n",rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} + +void utc_connection_get_proxy_positive(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + char *proxy=NULL; + rv = connection_get_proxy(handle, &proxy); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Get Proxy Failed [%d]\n", rv); + tet_result(TET_FAIL); + return; + } + if(proxy!=NULL) + tet_printf("Connection Get Proxy Success : %s\n", proxy); + else + tet_printf("Connection Get Proxy Success : Network Did Not Give Proxy\n"); + + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_proxy_negative(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + char *proxy=NULL; + rv = connection_get_proxy(NULL, &proxy); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection Get Proxy Must Fail [%d]\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection Get Proxy Must Fail : %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; +} + +void utc_connection_get_network_status_positive_1(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + connection_network_status_e status; + + rv = connection_get_network_status(CONNECTION_WIFI_TYPE, &status); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get Status Fail : %d\n", rv); + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status); + connection_destroy(handle); + tet_result(TET_PASS); + + if(status == CONNECTION_STATUS_AVAILABLE) + conn_status = status; + + return; + +} + +void utc_connection_get_network_status_positive_2(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + connection_network_status_e status; + + rv = connection_get_network_status(CONNECTION_MOBILE_TYPE, &status); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get Status Fail : %d\n", rv); + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status); + connection_destroy(handle); + tet_result(TET_PASS); + + if(status == CONNECTION_STATUS_AVAILABLE) + conn_status = status; + + return; +} + +void utc_connection_get_network_status_positive_3(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + connection_network_status_e status; + + rv = connection_get_network_status(CONNECTION_DEFAULT_TYPE, &status); + + if(rv!=CONNECTION_ERROR_NONE || status!=conn_status) + { + tet_printf("Connection Get Status Fail : %d\n", rv); + connection_destroy(handle); + tet_result(TET_FAIL); + status = CONNECTION_STATUS_UNAVAILABLE; + return; + } + tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status); + connection_destroy(handle); + tet_result(TET_PASS); + conn_status = CONNECTION_STATUS_UNAVAILABLE; + return; +} + +void utc_connection_get_network_status_negative_1(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + rv = connection_get_network_status(CONNECTION_MOBILE_TYPE, NULL); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get Status MUST Fail : Success %d\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection Get Status MUST Fail : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; +} + +void utc_connection_get_network_status_negative_2(void) +{ + int rv=0; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + connection_network_status_e status; + rv = connection_get_network_status(999, &status); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get Status MUST Fail : Success %d\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection Get Status MUST Fail : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; +} + +void utc_connection_get_last_datacall_duration_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_last_datacall_duration(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_datacall_duration : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get last_datacall_duration: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} + +void utc_connection_get_last_datacall_duration_negative(void) +{ + int stat; + + rv = connection_get_last_datacall_duration(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_datacall_duration : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get last_datacall_duration: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} + +void utc_connection_get_last_sent_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_last_sent_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_sent : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get last_sent: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} + +void utc_connection_get_last_sent_negative(void) +{ + int stat; + + rv = connection_get_last_sent_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_sent : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get last_sent: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} + +void utc_connection_get_last_recv_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_last_received_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_recv : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get last_recv: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_last_recv_negative(void) +{ + int stat; + + rv = connection_get_last_received_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_recv : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get last_recv: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_total_sent_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_total_sent_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_sent : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get total_sent: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_total_sent_negative(void) +{ + int stat; + + rv = connection_get_total_sent_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_sent : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get total_sent: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_total_recv_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_total_received_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_recv : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get total_recv: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_total_recv_negative(void) +{ + int stat; + + rv = connection_get_total_received_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_recv : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get total_recv : MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_last_duration_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_last_datacall_duration(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_duration : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get last_duration: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_last_duration_negative(void) +{ + int stat; + + rv = connection_get_last_datacall_duration(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get last_duration : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get last_duration: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_total_duration_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + + rv = connection_get_total_datacall_duration(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_datacall_duration : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get total_datacall_duration: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_total_duration_negative(void) +{ + int stat; + + rv = connection_get_total_datacall_duration(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get total_datacall_duration : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get total_datacall_duration: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_last_datacall_duration_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_last_datacall_duration(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_datacall_duration : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_last_datacall_duration: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_last_datacall_duration_negative(void) +{ + int stat; + + rv = connection_get_wifi_last_datacall_duration(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_datacall_duration : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_last_datacall_duration: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_last_received_data_size_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_last_received_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_received_data_size : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_last_received_data_size: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_last_received_data_size_negative(void) +{ + int stat; + + rv = connection_get_wifi_last_received_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_received_data_size : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_last_received_data_size: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_last_sent_data_size_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_last_sent_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_sent_data_size : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_last_sent_data_size: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_last_sent_data_size_negative(void) +{ + int stat; + + rv = connection_get_wifi_last_sent_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_last_sent_data_size : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_last_sent_data_size: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_total_datacall_duration_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_total_datacall_duration(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_datacall_duration : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_total_datacall_duration: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_total_datacall_duration_negative(void) +{ + int stat; + + rv = connection_get_wifi_total_datacall_duration(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_datacall_duration : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_total_datacall_duration: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_total_received_data_size_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_total_received_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_received_data_size : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_total_received_data_size: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_total_received_data_size_negative(void) +{ + int stat; + + rv = connection_get_wifi_total_received_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_received_data_size : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_total_received_data_size: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_get_wifi_total_sent_data_size_positive(void) +{ + int stat; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_get_wifi_total_sent_data_size(handle, &stat); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_sent_data_size : Failure %d\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection Get wifi_total_sent_data_size: Success %d Value = %d\n", rv, stat); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_get_wifi_total_sent_data_size_negative(void) +{ + int stat; + + rv = connection_get_wifi_total_sent_data_size(NULL, &stat); + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection Get wifi_total_sent_data_size : MUST FAIL %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Connection Get wifi_total_sent_data_size: MUST Fail %d \n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_unset_cb_positive(void) +{ + int rv=0; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + if(set_callbacks()){ + tet_result(TET_FAIL); + return; + } + rv = connection_unset_cb(handle); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection UnSet Callback Failed! Error [%d]\n", rv); + tet_result(TET_FAIL); + connection_destroy(handle); + return; + } + tet_printf("Connection UnSet Callback! Success [%d]\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; +} +void utc_connection_unset_cb_negative(void) +{ + int rv=0; + if(create_handle()){ + tet_result(TET_FAIL); + return; + } + rv = connection_unset_cb(NULL); + if(rv != CONNECTION_ERROR_NONE){ + tet_printf("Connection UnSet Callback! Must Fail : Success [%d]\n", rv); + tet_result(TET_PASS); + connection_destroy(handle); + return; + } + tet_printf("Connection UnSet Callback Must Fail! Error [%d]\n", rv); + connection_destroy(handle); + tet_result(TET_FAIL); + return; +} + +void utc_connection_destroy_positive(void) +{ + int rv = connection_destroy(handle); + + if(rv==CONNECTION_ERROR_NONE) + { + tet_printf("Destroy connection : Success %d\n", rv); + tet_result(TET_PASS); + return; + } + tet_printf("Destroy connection : Failure %d\n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_destroy_negative(void) +{ + int rv = connection_destroy(NULL); + + if(rv!=CONNECTION_ERROR_NONE) + { + tet_printf("Connection destroy Must Fail : Success %d\n", rv); + tet_result(TET_PASS); + return; + } + + tet_printf("Connection destroy Must Fail : Failure %d\n", rv); + tet_result(TET_FAIL); + return; +} +void utc_connection_is_connected_positive(void) +{ + bool status = FALSE; + if(get_api_preconditions()) + { + connection_destroy(handle); + tet_result(TET_FAIL); + return; + } + + if((connection_is_connected())) + { + tet_result(TET_PASS); + tet_printf("Is Connected:Expected %d vs Obtained %d\n", TRUE, status); + } + else + { + tet_result(TET_FAIL); + tet_printf("Is Connected:Expected %d vs Obtained %d\n", FALSE, status); + } + connection_destroy(handle); + +} diff --git a/TC/testcase/utc_network_connection.h b/TC/testcase/utc_network_connection.h new file mode 100755 index 0000000..6684783 --- /dev/null +++ b/TC/testcase/utc_network_connection.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2011 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 <tet_api.h> +#include <net_connection.h> + +void utc_connection_create_positive(void); +void utc_connection_create_negative(void); +void utc_connection_set_cb_positive(void); +void utc_connection_set_cb_negative(void); +void utc_connection_open_positive(void); +void utc_connection_open_negative(void); +void utc_connection_get_ip_address_positive(void); +void utc_connection_get_ip_address_negative(void); +void utc_connection_get_proxy_positive(void); +void utc_connection_get_proxy_negative(void); +void utc_connection_get_network_status_positive_1(void); +void utc_connection_get_network_status_positive_2(void); +void utc_connection_get_network_status_positive_3(void); +void utc_connection_get_network_status_negative_1(void); +void utc_connection_get_network_status_negative_2(void); +void utc_connection_get_last_datacall_duration_positive(void); +void utc_connection_get_last_datacall_duration_negative(void); +void utc_connection_get_last_sent_positive(void); +void utc_connection_get_last_sent_negative(void); +void utc_connection_get_last_recv_positive(void); +void utc_connection_get_last_recv_negative(void); +void utc_connection_get_total_sent_positive(void); +void utc_connection_get_total_sent_negative(void); +void utc_connection_get_total_recv_positive(void); +void utc_connection_get_total_recv_negative(void); +void utc_connection_get_total_duration_positive(void); +void utc_connection_get_total_duration_negative(void); +void utc_connection_get_wifi_last_datacall_duration_positive(void); +void utc_connection_get_wifi_last_datacall_duration_negative(void); +void utc_connection_get_wifi_last_received_data_size_positive(void); +void utc_connection_get_wifi_last_received_data_size_negative(void); +void utc_connection_get_wifi_last_sent_data_size_positive(void); +void utc_connection_get_wifi_last_sent_data_size_negative(void); +void utc_connection_get_wifi_total_datacall_duration_positive(void); +void utc_connection_get_wifi_total_datacall_duration_negative(void); +void utc_connection_get_wifi_total_received_data_size_positive(void); +void utc_connection_get_wifi_total_received_data_size_negative(void); +void utc_connection_get_wifi_total_sent_data_size_positive(void); +void utc_connection_get_wifi_total_sent_data_size_negative(void); +void utc_connection_is_connected_positive(void); +void utc_connection_unset_cb_positive(void); +void utc_connection_unset_cb_negative(void); +void utc_connection_destroy_positive(void); +void utc_connection_destroy_negative(void); diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? |