diff options
author | sangwan.kwon <sangwan.kwon@samsung.com> | 2016-09-02 16:03:43 +0900 |
---|---|---|
committer | sangwan.kwon <sangwan.kwon@samsung.com> | 2016-09-02 16:14:54 +0900 |
commit | 59265914dc4f93d04808471a1db7379712f1550c (patch) | |
tree | ad59ff772af6f40e719a941d7d847a2657d9236d | |
parent | e1dff866ee124a973d3e1604abb50962dcc528cb (diff) | |
download | cert-svc-59265914dc4f93d04808471a1db7379712f1550c.tar.gz cert-svc-59265914dc4f93d04808471a1db7379712f1550c.tar.bz2 cert-svc-59265914dc4f93d04808471a1db7379712f1550c.zip |
Add TC for platform upgrade script
* TC #1. disabled_certs table migration
* TC #2. enabled column on ssl table migration
Change-Id: I52cda7882849000b21f8b49a440c435e504f6788
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
-rw-r--r-- | etc/CMakeLists.txt | 12 | ||||
-rw-r--r-- | etc/upgrade/CMakeLists.txt | 30 | ||||
-rwxr-xr-x | etc/upgrade/cert-svc-db-upgrade.sh.in (renamed from etc/cert-svc-db-upgrade.sh.in) | 0 | ||||
-rwxr-xr-x | etc/upgrade/cert-svc-disabled-certs-upgrade.sh.in (renamed from etc/cert-svc-disabled-certs-upgrade.sh.in) | 0 | ||||
-rw-r--r-- | packaging/cert-svc.spec | 6 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/upgrade/CMakeLists.txt | 31 | ||||
-rwxr-xr-x | tests/upgrade/cert-svc-test-upgrade.sh.in | 44 | ||||
-rw-r--r-- | tests/upgrade/certs-meta-old.db | bin | 0 -> 446464 bytes |
9 files changed, 111 insertions, 13 deletions
diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt index 40dac00..d5005d2 100644 --- a/etc/CMakeLists.txt +++ b/etc/CMakeLists.txt @@ -36,14 +36,4 @@ INSTALL(FILES DESTINATION ${CERT_SVC_DB_PATH} ) -CONFIGURE_FILE(cert-svc-db-upgrade.sh.in cert-svc-db-upgrade.sh @ONLY) -CONFIGURE_FILE( - cert-svc-disabled-certs-upgrade.sh.in - cert-svc-disabled-certs-upgrade.sh @ONLY - ) - -INSTALL(FILES - ${ETC_DIR}/cert-svc-db-upgrade.sh - ${ETC_DIR}/cert-svc-disabled-certs-upgrade.sh - DESTINATION ${UPGRADE_SCRIPT_PATH} - ) +ADD_SUBDIRECTORY(upgrade) diff --git a/etc/upgrade/CMakeLists.txt b/etc/upgrade/CMakeLists.txt new file mode 100644 index 0000000..7d5ad25 --- /dev/null +++ b/etc/upgrade/CMakeLists.txt @@ -0,0 +1,30 @@ +# Copyright (c) 2016 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. +# +# @file CMakeLists.txt +# @author Sangwan Kwon (sangwan.kwon@samsung.com) +# + +CONFIGURE_FILE( + cert-svc-db-upgrade.sh.in + cert-svc-db-upgrade.sh @ONLY) +CONFIGURE_FILE( + cert-svc-disabled-certs-upgrade.sh.in + cert-svc-disabled-certs-upgrade.sh @ONLY) + +INSTALL(FILES + cert-svc-db-upgrade.sh + cert-svc-disabled-certs-upgrade.sh + DESTINATION ${UPGRADE_SCRIPT_PATH} +) diff --git a/etc/cert-svc-db-upgrade.sh.in b/etc/upgrade/cert-svc-db-upgrade.sh.in index 395c42b..395c42b 100755 --- a/etc/cert-svc-db-upgrade.sh.in +++ b/etc/upgrade/cert-svc-db-upgrade.sh.in diff --git a/etc/cert-svc-disabled-certs-upgrade.sh.in b/etc/upgrade/cert-svc-disabled-certs-upgrade.sh.in index 91f0805..91f0805 100755 --- a/etc/cert-svc-disabled-certs-upgrade.sh.in +++ b/etc/upgrade/cert-svc-disabled-certs-upgrade.sh.in diff --git a/packaging/cert-svc.spec b/packaging/cert-svc.spec index a3d0d52..ee90b4f 100644 --- a/packaging/cert-svc.spec +++ b/packaging/cert-svc.spec @@ -179,8 +179,8 @@ fi %attr(-, %{USER_NAME}, %{GROUP_NAME}) %CERT_SVC_DB_PATH/certs-meta.db-journal %attr(-, %{USER_NAME}, %{GROUP_NAME}) %CERT_SVC_RO_PATH -%attr(755, root, root) %{UPGRADE_SCRIPT_PATH}/cert-svc-db-upgrade.sh -%attr(755, root, root) %{UPGRADE_SCRIPT_PATH}/cert-svc-disabled-certs-upgrade.sh +%attr(755, root, root) %UPGRADE_SCRIPT_PATH/cert-svc-db-upgrade.sh +%attr(755, root, root) %UPGRADE_SCRIPT_PATH/cert-svc-disabled-certs-upgrade.sh %{UPGRADE_DATA_PATH}/certs-meta.db %files devel @@ -193,4 +193,6 @@ fi %TZ_SYS_BIN/cert-svc-test* %CERT_SVC_TESTS %_libdir/libcert-svc-validator-plugin.so +%attr(755, root, root) %UPGRADE_SCRIPT_PATH/cert-svc-test-upgrade.sh +%{UPGRADE_DATA_PATH}/certs-meta-old.db %endif diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index c0c4c30..58bfe1e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -53,3 +53,4 @@ ADD_SUBDIRECTORY(capi) ADD_SUBDIRECTORY(pkcs12) ADD_SUBDIRECTORY(vcore) ADD_SUBDIRECTORY(plugin) +ADD_SUBDIRECTORY(upgrade) diff --git a/tests/upgrade/CMakeLists.txt b/tests/upgrade/CMakeLists.txt new file mode 100644 index 0000000..a8b22b0 --- /dev/null +++ b/tests/upgrade/CMakeLists.txt @@ -0,0 +1,31 @@ +# Copyright (c) 2016 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. +# +# @file CMakeLists.txt +# @author Sangwan Kwon (sangwan.kwon@samsung.com) +# + +CONFIGURE_FILE( + cert-svc-test-upgrade.sh.in + cert-svc-test-upgrade.sh @ONLY) + +INSTALL(FILES + cert-svc-test-upgrade.sh + DESTINATION ${UPGRADE_SCRIPT_PATH} +) + +INSTALL(FILES + certs-meta-old.db + DESTINATION ${UPGRADE_DATA_PATH} +) diff --git a/tests/upgrade/cert-svc-test-upgrade.sh.in b/tests/upgrade/cert-svc-test-upgrade.sh.in new file mode 100755 index 0000000..00b8de3 --- /dev/null +++ b/tests/upgrade/cert-svc-test-upgrade.sh.in @@ -0,0 +1,44 @@ +#!/bin/bash +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +# Copyright (c) 2016 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. +# +# @file cert-svc-test-upgrade.sh.in +# @author Sangwan Kwon (sangwan.kwon@samsung.com) +# @brief test script for platform upgrade Tizen 2.4 -> 3.0 +# + +NEW_DB=@CERT_SVC_DB_PATH@/certs-meta.db + +# set test old database +rm -rf @CERT_SVC_OLD_DB_PATH@/* +cp @UPGRADE_DATA_PATH@/certs-meta-old.db @CERT_SVC_OLD_DB_PATH@/certs-meta.db + +# run db upgrade +@UPGRADE_SCRIPT_PATH@/cert-svc-db-upgrade.sh + +# testcase 1. disabled_certs table should have 2 column +disabled_certs_cnt=`sqlite3 $NEW_DB "SELECT count(*) FROM disabled_certs;"` +if [ "$disabled_certs_cnt" != "2" ] +then + echo "Failed to upgrade disabled_cers table." +fi + +# testcase 2. below gname's enabled column should off +enabled_column=`sqlite3 $NEW_DB "SELECT enabled from ssl WHERE gname='6410666e.0';"` +if [ "$enabled_column" != "0" ] +then + echo "Failed to upgrade ssl table." +fi diff --git a/tests/upgrade/certs-meta-old.db b/tests/upgrade/certs-meta-old.db Binary files differnew file mode 100644 index 0000000..3d48d9f --- /dev/null +++ b/tests/upgrade/certs-meta-old.db |