2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
4 # Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 # @file cert-svc-test-upgrade.sh.in
19 # @author Sangwan Kwon (sangwan.kwon@samsung.com)
20 # @brief test script for platform upgrade Tizen 2.4 -> 3.0
23 NEW_DB=@CERT_SVC_DB_PATH@/certs-meta.db
24 TEST_GNAME1="6410666e.0"
25 TEST_GNAME2="790a7190.0"
27 # set test old database
28 rm -rf @CERT_SVC_OLD_DB_PATH@/*
29 cp @UPGRADE_DATA_PATH@/certs-meta-old.db @CERT_SVC_OLD_DB_PATH@/certs-meta.db
31 before_upgrade_certs_cnt=`ls -l @TZ_SYS_CA_CERTS@ | grep ^l | wc -l`
32 before_upgrade_bundle_line=`cat @TZ_SYS_CA_BUNDLE@ | wc -l`
35 @UPGRADE_SCRIPT_PATH@/242.cert-svc-db-upgrade.sh
37 # testcase 1. disabled_certs table should have 2 column
38 disabled_certs_cnt=`sqlite3 $NEW_DB "SELECT count(*) FROM disabled_certs;"`
39 if [ "$disabled_certs_cnt" != "2" ]
41 echo "[-] Failed to upgrade disabled_certs table."
43 echo "[+] Success to upgrade disabled_certs table."
46 # testcase 2. below gname's enabled column should off
47 enabled_column1=`sqlite3 $NEW_DB "SELECT enabled from ssl WHERE gname='$TEST_GNAME1';"`
48 if [ "$enabled_column1" != "0" ]
50 echo "[-] Failed to upgrade ssl table."
52 echo "[+] Success to upgrade ssl table."
54 enabled_column2=`sqlite3 $NEW_DB "SELECT enabled from ssl WHERE gname='$TEST_GNAME2';"`
55 if [ "$enabled_column2" != "0" ]
57 echo "[-] Failed to upgrade ssl table."
59 echo "[+] Success to upgrade ssl table."
62 # testcase 3. check to exist disabled certs on rw area
63 link_path1="@TZ_SYS_CA_CERTS@/$TEST_GNAME1"
66 echo "[-] Failed to unlink disabled certs."
68 echo "[+] Success to unlink disabled certs."
70 link_path2="@TZ_SYS_CA_CERTS@/$TEST_GNAME2"
73 echo "[-] Failed to unlink disabled certs."
75 echo "[+] Success to unlink disabled certs."
78 # check certificate's count was reduced
79 after_upgrade_certs_cnt=`ls -l @TZ_SYS_CA_CERTS@ | grep ^l | wc -l`
80 diff_cnt=$(expr $before_upgrade_certs_cnt - $after_upgrade_certs_cnt)
81 if [ "$diff_cnt" != "2" ]
83 echo "[-] Failed to unlink disabled certs."
84 echo "[-] Check ca-certificate package's upgrade has done."
86 echo "[+] Success to unlink disabled certs."
89 # testcase 4. bundle file should update
90 after_upgrade_bundle_line=`cat @TZ_SYS_CA_BUNDLE@ | wc -l`
91 diff_line1=$(expr $before_upgrade_bundle_line - $after_upgrade_bundle_line)
92 if [ "$diff_line1" != "56" ]
94 echo "[-] Failed to update bundle file."
95 echo "[-] Check ca-certificate package's upgrade has done."
97 echo "[+] Success to update bundle file."
100 after_symbol_bundle_line=`cat @CERT_SVC_CA_BUNDLE@ | wc -l`
101 diff_line2=$(expr $after_upgrade_bundle_line - $after_symbol_bundle_line)
102 if [ "$diff_line2" != "0" ]
104 echo "[-] Failed to sync bundle file with CERT_SVC_CA_BUNDLE."
106 echo "[+] Success to sync bundle file with CERT_SVC_CA_BUNDLE."
109 # testcase 5. user table migration
110 wifi_certs_cnt=`sqlite3 $NEW_DB "SELECT count(*) FROM wifi;"`
111 if [ "$wifi_certs_cnt" != "1" ]
113 echo "[-] Failed to migrate wifi table."
115 echo "[+] Success to migrate wifi table."
118 vpn_certs_cnt=`sqlite3 $NEW_DB "SELECT count(*) FROM vpn;"`
119 if [ "$vpn_certs_cnt" != "1" ]
121 echo "[-] Failed to migrate vpn table."
123 echo "[+] Success to migrate vpn table."
126 email_certs_cnt=`sqlite3 $NEW_DB "SELECT count(*) FROM email;"`
127 if [ "$email_certs_cnt" != "1" ]
129 echo "[-] Failed to migrate email table."
131 echo "[+] Success to migrate email table."