Initialize Tizen 2.3
[framework/system/deviced.git] / test / testcase / utc_system_deviced_mmc.c
1 /*
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of SAMSUNG
7  * ELECTRONICS ("Confidential Information"). You agree and acknowledge that
8  * this software is owned by Samsung and you shall not disclose such
9  * Confidential Information and shall use it only in accordance with the terms
10  * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG
11  * make no representations or warranties about the suitability of the software,
12  * either express or implied, including but not limited to the implied
13  * warranties of merchantability, fitness for a particular purpose, or
14  * non-infringement. SAMSUNG shall not be liable for any damages suffered by
15  * licensee arising out of or related to this software.
16  *
17  */
18 #include <tet_api.h>
19 #include <dd-mmc.h>
20
21 #define API_NAME_MMC_SECURE_MOUNT "mmc_secure_mount"
22 #define API_NAME_MMC_SECURE_UNMOUNT "mmc_secure_unmount"
23
24 static void startup(void);
25 static void cleanup(void);
26
27 void (*tet_startup)(void) = startup;
28 void (*tet_cleanup)(void) = cleanup;
29
30
31 static void utc_system_deviced_mmc_secure_mount_p(void);
32 static void utc_system_deviced_mmc_secure_mount_n(void);
33 static void utc_system_deviced_mmc_secure_unmount_p(void);
34 static void utc_system_deviced_mmc_secure_unmount_n(void);
35
36 enum {
37         POSITIVE_TC_IDX = 0x01,
38         NEGATIVE_TC_IDX,
39 };
40
41 struct tet_testlist tet_testlist[] = {
42         { utc_system_deviced_mmc_secure_mount_p, POSITIVE_TC_IDX },
43         { utc_system_deviced_mmc_secure_mount_n, NEGATIVE_TC_IDX },
44         { utc_system_deviced_mmc_secure_unmount_p, POSITIVE_TC_IDX },
45         { utc_system_deviced_mmc_secure_unmount_n, NEGATIVE_TC_IDX },
46         { NULL, 0 },
47 };
48
49 #define SECURE_MOUNT_POINT "/opt/storage/secure"
50
51 static void startup(void)
52 {
53 }
54
55 static void cleanup(void)
56 {
57 }
58
59 /**
60  * @brief Positive test case of mmc_secure_mount()
61  */
62 static void utc_system_deviced_mmc_secure_mount_p(void)
63 {
64         int ret;
65
66         dts_message("This testcase is only valid when mmc is inserted");
67
68         ret = mmc_secure_mount(SECURE_MOUNT_POINT);
69         dts_check_eq(API_NAME_MMC_SECURE_MOUNT, ret, 0);
70 }
71
72 /**
73  * @brief Negative test case of mmc_secure_mount()
74  */
75 static void utc_system_deviced_mmc_secure_mount_n(void)
76 {
77         int ret;
78
79         dts_message("This testcase is only valid when mmc is inserted");
80
81         ret = mmc_secure_mount(NULL);
82         dts_check_ne(API_NAME_MMC_SECURE_MOUNT, ret, 0);
83 }
84
85 /**
86  * @brief Positive test case of mmc_secure_unmount()
87  */
88 static void utc_system_deviced_mmc_secure_unmount_p(void)
89 {
90         int ret;
91
92         ret = mmc_secure_unmount(SECURE_MOUNT_POINT);
93         dts_check_eq(API_NAME_MMC_SECURE_UNMOUNT, ret, 0);
94 }
95
96 /**
97  * @brief Negative test case of mmc_secure_unmount()
98  */
99 static void utc_system_deviced_mmc_secure_unmount_n(void)
100 {
101         int ret;
102
103         ret = mmc_secure_unmount(NULL);
104         dts_check_ne(API_NAME_MMC_SECURE_UNMOUNT, ret, 0);
105 }