diff options
author | MyoungJune Park <mj2004.park@samsung.com> | 2016-11-14 09:37:15 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-11-14 10:15:44 +0900 |
commit | 14d91799a142c47ade1989b92682a515b7015fbe (patch) | |
tree | d4dc449cf29820acd94697d84915693d1fee9088 | |
parent | f1b6391d4e92993a6e6554072fdcd82c0dbcc485 (diff) | |
download | libslp-db-util-14d91799a142c47ade1989b92682a515b7015fbe.tar.gz libslp-db-util-14d91799a142c47ade1989b92682a515b7015fbe.tar.bz2 libslp-db-util-14d91799a142c47ade1989b92682a515b7015fbe.zip |
code update and remove TCs
- remove TCs
Change-Id: I2ebc7b8da0a4bc365fed53784688263b4ca74767
Signed-off-by: MyoungJune Park <mj2004.park@samsung.com>
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
-rwxr-xr-x | TC/build.sh | 20 | ||||
-rwxr-xr-x | TC/execute.sh | 19 | ||||
-rwxr-xr-x | TC/tet_code | 12 | ||||
-rwxr-xr-x | TC/tet_scen | 7 | ||||
-rwxr-xr-x | TC/tetbuild.cfg | 2 | ||||
-rwxr-xr-x | TC/tetclean.cfg | 2 | ||||
-rwxr-xr-x | TC/tetexec.cfg | 1 | ||||
-rwxr-xr-x | TC/unit/Makefile | 25 | ||||
-rwxr-xr-x | TC/unit/tc_gen.sh | 28 | ||||
-rwxr-xr-x | TC/unit/tslist | 3 | ||||
-rwxr-xr-x | TC/unit/utc_ApplicationFW_db_util_close.c | 114 | ||||
-rwxr-xr-x | TC/unit/utc_ApplicationFW_db_util_open.c | 96 | ||||
-rwxr-xr-x | TC/unit/utc_ApplicationFW_db_util_open_with_options.c | 114 | ||||
-rwxr-xr-x | TC/unit/utc_MODULE_API_func.c.in | 62 | ||||
-rw-r--r-- | collation.c | 10 | ||||
-rw-r--r-- | util_func.c | 14 |
16 files changed, 21 insertions, 508 deletions
diff --git a/TC/build.sh b/TC/build.sh deleted file mode 100755 index c488da0..0000000 --- a/TC/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -export TET_INSTALL_PATH=/home/deuk/repository/tetware/TETware # local tetware 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 - -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 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/execute.sh b/TC/execute.sh deleted file mode 100755 index 21021c0..0000000 --- a/TC/execute.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -export TET_INSTALL_PATH=/mnt/nfs/tetware/TETware -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 - -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 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/tet_code b/TC/tet_code deleted file mode 100755 index a2cf6c1..0000000 --- a/TC/tet_code +++ /dev/null @@ -1,12 +0,0 @@ -# TET reserved codes -0 "PASS" -1 "FAIL" -2 "UNRESOLVED" -3 "NOTINUSE" -4 "UNSUPPORTED" -5 "UNTESTED" -6 "UNINITIATED" -7 "NORESULT" - -# Test suite additional codes -33 "INSPECT" diff --git a/TC/tet_scen b/TC/tet_scen deleted file mode 100755 index 43cbc9b..0000000 --- a/TC/tet_scen +++ /dev/null @@ -1,7 +0,0 @@ -all - ^TEST -##### Scenarios for TEST ##### - -# Test scenario -TEST - :include:/unit/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg deleted file mode 100755 index a584acd..0000000 --- a/TC/tetbuild.cfg +++ /dev/null @@ -1,2 +0,0 @@ -TET_OUTPUT_CAPTURE=False -TET_BUILD_TOOL=make diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg deleted file mode 100755 index c66eda4..0000000 --- a/TC/tetclean.cfg +++ /dev/null @@ -1,2 +0,0 @@ -TET_OUTPUT_CAPTURE=False -TET_CLEAN_TOOL=make clean diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg deleted file mode 100755 index 0d9d39a..0000000 --- a/TC/tetexec.cfg +++ /dev/null @@ -1 +0,0 @@ -TET_OUTPUT_CAPTURE=False diff --git a/TC/unit/Makefile b/TC/unit/Makefile deleted file mode 100755 index e82feb8..0000000 --- a/TC/unit/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CC ?= gcc - -TARGETS = utc_ApplicationFW_db_util_close \ - utc_ApplicationFW_db_util_open \ - utc_ApplicationFW_db_util_open_with_options \ - -PKGS = sqlite3 dlog db-util - -LDFLAGS = `pkg-config --libs $(PKGS)` -LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s -LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s -LDFLAGS += -pthread - -CFLAGS = -I. `pkg-config --cflags $(PKGS)` -CFLAGS += -I$(TET_ROOT)/inc/tet3 -CFLAGS += -Wall - -all: $(TARGETS) - -$(TARGETS): %: %.c - $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) - -clean: - rm -f $(TARGETS) diff --git a/TC/unit/tc_gen.sh b/TC/unit/tc_gen.sh deleted file mode 100755 index 54f482d..0000000 --- a/TC/unit/tc_gen.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -TMPSTR=$0 -SCRIPT=${TMPSTR##*/} - -if [ $# -lt 2 ]; then - echo "Usage) $SCRIPT module_name api_name" - exit 1 -fi - -MODULE=$1 -API=$2 -TEMPLATE=utc_MODULE_API_func.c.in -TESTCASE=utc_${MODULE}_${API}_func - -sed -e ' - s^@API@^'"$API"'^g - s^@MODULE@^'"$MODULE"'^g - ' $TEMPLATE > $TESTCASE.c - -if [ ! -e "$TESTCASE.c" ]; then - echo "Failed" - exit 1 -fi -echo "Testcase file is $TESTCASE.c" -echo "Done" -echo "please put \"$TESTCASE\" as Target in Makefile" -echo "please put \"/unit/$TESTCASE\" in tslist" diff --git a/TC/unit/tslist b/TC/unit/tslist deleted file mode 100755 index c221828..0000000 --- a/TC/unit/tslist +++ /dev/null @@ -1,3 +0,0 @@ -/unit/utc_ApplicationFW_db_util_close -/unit/utc_ApplicationFW_db_util_open -/unit/utc_ApplicationFW_db_util_open_with_options diff --git a/TC/unit/utc_ApplicationFW_db_util_close.c b/TC/unit/utc_ApplicationFW_db_util_close.c deleted file mode 100755 index 3c6f855..0000000 --- a/TC/unit/utc_ApplicationFW_db_util_close.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * libslp-db-util - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> - * - * 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 <db-util.h> - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_ApplicationFW_db_util_close_func_01(void); -static void utc_ApplicationFW_db_util_close_func_02(void); - -static sqlite3* db_hd = NULL; -char* db_path = "/opt/test.db"; - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_ApplicationFW_db_util_close_func_01, POSITIVE_TC_IDX }, - { utc_ApplicationFW_db_util_close_func_02, NEGATIVE_TC_IDX }, - { NULL, 0 } -}; - -static void startup(void) -{ -} - -static void cleanup(void) -{ -} - -/** - * @brief Positive test case of db_util_close() - */ -static void utc_ApplicationFW_db_util_close_func_01(void) -{ - int r = 0; - - r = db_util_open(db_path, &db_hd, 0); - if (r != SQLITE_OK) { - tet_infoline("db_util_close() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - - r = db_util_close(db_hd); - if (r != SQLITE_OK) { - tet_infoline("db_util_close() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - db_hd = NULL; - - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init db_util_close() - */ -static void utc_ApplicationFW_db_util_close_func_02(void) -{ - int r = 0; - sqlite3_stmt *db_stmt = NULL; - - db_hd = NULL; - - r = db_util_open(db_path, &db_hd, 0); - if (r != SQLITE_OK) { - tet_infoline("db_util_close() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - r = sqlite3_prepare(db_hd, "create table test(id int);", -1, &db_stmt, NULL); - if (r != SQLITE_OK) { - tet_infoline("db_util_close() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - r = db_util_close(db_hd); - if (r == SQLITE_OK) { - tet_infoline("db_util_close() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - tet_result(TET_PASS); -} - diff --git a/TC/unit/utc_ApplicationFW_db_util_open.c b/TC/unit/utc_ApplicationFW_db_util_open.c deleted file mode 100755 index feb9780..0000000 --- a/TC/unit/utc_ApplicationFW_db_util_open.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * libslp-db-util - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> - * - * 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 <db-util.h> - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_ApplicationFW_db_util_open_func_01(void); -static void utc_ApplicationFW_db_util_open_func_02(void); - -static sqlite3* db_hd = NULL; -char* db_path = "test.db"; - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_ApplicationFW_db_util_open_func_01, POSITIVE_TC_IDX }, - { utc_ApplicationFW_db_util_open_func_02, NEGATIVE_TC_IDX }, - { NULL, 0 } -}; - -static void startup(void) -{ -} - -static void cleanup(void) -{ - db_util_close(db_hd); -} - -/** - * @brief Positive test case of db_util_open() - */ -static void utc_ApplicationFW_db_util_open_func_01(void) -{ - int r = 0; - - r = db_util_open(db_path, &db_hd, 0); - if (r != SQLITE_OK) { - tet_infoline("db_util_open() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init db_util_open() - */ -static void utc_ApplicationFW_db_util_open_func_02(void) -{ - int r = 0; - - r = db_util_open(NULL, &db_hd, 0); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - r = db_util_open(db_path, NULL, 0); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - tet_result(TET_PASS); -} diff --git a/TC/unit/utc_ApplicationFW_db_util_open_with_options.c b/TC/unit/utc_ApplicationFW_db_util_open_with_options.c deleted file mode 100755 index 7c7b5ef..0000000 --- a/TC/unit/utc_ApplicationFW_db_util_open_with_options.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * libslp-db-util - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hakjoo Ko <hakjoo.ko@samsung.com> - * - * 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 <db-util.h> - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_ApplicationFW_db_util_open_with_options_func_01(void); -static void utc_ApplicationFW_db_util_open_with_options_func_02(void); - -static sqlite3* db_hd = NULL; -char* db_path = "/opt/test.db"; - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_ApplicationFW_db_util_open_with_options_func_01, POSITIVE_TC_IDX }, - { utc_ApplicationFW_db_util_open_with_options_func_02, NEGATIVE_TC_IDX }, - { NULL, 0 } -}; - -static void startup(void) -{ -} - -static void cleanup(void) -{ - db_util_close(db_hd); -} - -/** - * @brief Positive test case of db_util_open_with_options() - */ -static void utc_ApplicationFW_db_util_open_with_options_func_01(void) -{ - int r = 0; - - r = db_util_open_with_options(db_path, &db_hd, SQLITE_OPEN_READWRITE, NULL); - if (r != SQLITE_OK) { - tet_infoline("db_util_open() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init db_util_open_with_options() - */ -static void utc_ApplicationFW_db_util_open_with_options_func_02(void) -{ - int r = 0; - - r = db_util_open_with_options(NULL, &db_hd, SQLITE_OPEN_READWRITE, NULL); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - r = db_util_open_with_options(db_path, NULL, SQLITE_OPEN_READWRITE, NULL); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - r = db_util_open_with_options(db_path, &db_hd, 0, NULL); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - unlink(db_path); - - r = db_util_open_with_options(db_path, &db_hd, SQLITE_OPEN_READONLY, NULL); - if (r == SQLITE_OK) { - tet_infoline("db_util_open() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - - tet_result(TET_PASS); -} - - diff --git a/TC/unit/utc_MODULE_API_func.c.in b/TC/unit/utc_MODULE_API_func.c.in deleted file mode 100755 index e9629be..0000000 --- a/TC/unit/utc_MODULE_API_func.c.in +++ /dev/null @@ -1,62 +0,0 @@ -#include <tet_api.h> - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_@MODULE@_@API@_func_01(void); -static void utc_@MODULE@_@API@_func_02(void); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_@MODULE@_@API@_func_01, POSITIVE_TC_IDX }, - { utc_@MODULE@_@API@_func_02, NEGATIVE_TC_IDX }, -}; - -static void startup(void) -{ -} - -static void cleanup(void) -{ -} - -/** - * @brief Positive test case of @API@() - */ -static void utc_@MODULE@_@API@_func_01(void) -{ - int r = 0; - - r = @API@(...); - - if (r<0) { - tet_infoline("@API@() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init @API@() - */ -static void utc_@MODULE@_@API@_func_02(void) -{ - int r = 0; - - r = @API@(...); - - if (r>=0) { - tet_infoline("@API@() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} diff --git a/collation.c b/collation.c index 5b38fb5..5029eee 100644 --- a/collation.c +++ b/collation.c @@ -423,7 +423,7 @@ static int __db_util_collation_create(sqlite3* db_handle, char* locale, char* co } #endif - if(ucol_strength_value) { + if(ucol_strength_value == UCOL_PRIMARY) { icu_symbol.icu_ucol_setStrength(ucol, ucol_strength_value); if (U_FAILURE(status)) { DB_UTIL_TRACE_ERROR("ucol_setStrength fail : %d \n", status); @@ -474,13 +474,18 @@ int db_util_create_collation( UErrorCode status = U_ZERO_ERROR; const char* locale = NULL; + if ( (!db_handle) || (!col_name) ) { + DB_UTIL_TRACE_ERROR("wrong input param"); + return DB_UTIL_ERROR; + } + DB_UTIL_TRACE_DEBUG("db_util_create_collation start"); ret = __db_util_dl_load_icu(); DB_UTIL_RETV_IF(ret != DB_UTIL_OK, DB_UTIL_ERROR); /* get current locale */ - icu_symbol.icu_uloc_setDefault((const char*)getenv("LC_COLLATE"), &status); + icu_symbol.icu_uloc_setDefault((const char*)getenv("LANG"), &status); locale = icu_symbol.icu_uloc_getDefault(); if(locale == NULL) { DB_UTIL_TRACE_WARNING("Fail to get current locale : %d", DB_UTIL_ERR_ENV); @@ -521,6 +526,7 @@ int db_util_create_collation( #endif default : DB_UTIL_TRACE_WARNING("wrong collate input type"); + ret = DB_UTIL_ERROR; } if(ret != DB_UTIL_OK) diff --git a/util_func.c b/util_func.c index a33e814..0bbd43d 100644 --- a/util_func.c +++ b/util_func.c @@ -30,7 +30,12 @@ static int __db_util_busyhandler(void *pData, int count) { if(5 - count > 0) { DB_UTIL_TRACE_DEBUG("Busy Handler Called! : PID(%d) / CNT(%d)\n", getpid(), count+1); - usleep((count+1)*100000); + struct timespec time = { + .tv_sec = 0, + .tv_nsec = (count+1) * 100 * 1000 * 1000 + }; + nanosleep(&time, NULL); + return 1; } else { DB_UTIL_TRACE_DEBUG("Busy Handler will be returned SQLITE_BUSY error : PID(%d) \n", getpid()); @@ -100,6 +105,13 @@ int db_util_open(const char *pszFilePath, sqlite3 **ppDB, int nOption) return DB_UTIL_ERROR; } + if((geteuid() != 0) && (access(pszFilePath, R_OK))) { + if(errno == EACCES) { + DB_UTIL_TRACE_ERROR("file access permission error"); + return SQLITE_PERM; + } + } + /* Open DB */ int rc = sqlite3_open(pszFilePath, ppDB); if (SQLITE_OK != rc) { |