summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyunjee Kim <hj0426.kim@samsung.com>2020-04-23 09:23:05 +0900
committerHyunjee Kim <hj0426.kim@samsung.com>2020-04-23 09:23:39 +0900
commitecb2a7c3cfa1ab381dc3e7f8471be97b68090b00 (patch)
treed6b312ef395eaeee90e0074c4880a6f19f19ef02
parent04406b951275032918df1be1e1f7215f7f5e10e6 (diff)
downloadlibslp-db-util-ecb2a7c3cfa1ab381dc3e7f8471be97b68090b00.tar.gz
libslp-db-util-ecb2a7c3cfa1ab381dc3e7f8471be97b68090b00.tar.bz2
libslp-db-util-ecb2a7c3cfa1ab381dc3e7f8471be97b68090b00.zip
Add db_util_open negative case
Change-Id: I44ca060768876dc5dea1c58bd2d8d7445730cf60 Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
-rw-r--r--unittest/db-util_gtest.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittest/db-util_gtest.cc b/unittest/db-util_gtest.cc
index d8d3d80..a6ecf20 100644
--- a/unittest/db-util_gtest.cc
+++ b/unittest/db-util_gtest.cc
@@ -92,6 +92,20 @@ TEST_F(DbUtil, db_util_open_with_options_n2) {
rc = db_util_open_with_options(pszFilePath, NULL, flags, zVfs);
ASSERT_NE ( DB_UTIL_OK , rc );
}
+
+TEST_F(DbUtil, db_util_open_n4) {
+ int rc;
+
+ rc = db_util_open(pszFilePath, &db, nOption);
+ ASSERT_EQ ( DB_UTIL_OK , rc );
+
+ // In case of (geteuid() != 0) && access(pszFilePath, R_OK)
+ system("chmod 000 test.db");
+ setuid(1000);
+
+ rc = db_util_open(pszFilePath, &db, nOption);
+ ASSERT_EQ ( SQLITE_PERM , rc );
+}
//=======================================================================================