Initialize Tizen 2.3
[framework/system/deviced.git] / test / testcase / utc_system_deviced_deviced.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-deviced.h>
20
21 #define API_NAME_DEVICED_GET_CMDLINE_NAME "deviced_get_cmdline_name"
22 #define API_NAME_DEVICED_GET_APPPATH "deviced_get_apppath"
23 #define API_NAME_DEVICED_CONF_SET_MEMPOLICY "deviced_conf_set_mempolicy"
24 #define API_NAME_DEVICED_CONF_SET_MEMPOLICY_BYPID "deviced_conf_set_mempolicy_bypid"
25 #define API_NAME_DEVICED_CONF_SET_PERMANENT "deviced_conf_set_permanent"
26 #define API_NAME_DEVICED_CONF_SET_PERMANENT_BYPID "deviced_conf_set_permanent_bypid"
27 #define API_NAME_DEVICED_CONF_SET_VIP "deviced_conf_set_vip"
28 #define API_NAME_DEVICED_CONF_IS_VIP "deviced_conf_is_vip"
29 #define API_NAME_DEVICED_SET_TIMEZONE "deviced_set_timezone"
30 #define API_NAME_DEVICED_INFORM_FOREGRD "deviced_inform_foregrd"
31 #define API_NAME_DEVICED_INFORM_BACKGRD "deviced_inform_backgrd"
32 #define API_NAME_DEVICED_INFORM_ACTIVE "deviced_inform_active"
33 #define API_NAME_DEVICED_INFORM_INACTIVE "deviced_inform_active"
34 #define API_NAME_DEVICED_REQUEST_POWEROFF "deviced_request_poweroff"
35 #define API_NAME_DEVICED_REQUEST_ENTERSLEEP "deviced_request_entersleep"
36 #define API_NAME_DEVICED_REQUEST_LEAVESLEEP "deviced_request_leavesleep"
37 #define API_NAME_DEVICED_REQUEST_REBOOT "deviced_request_reboot"
38 #define API_NAME_DEVICED_REQUEST_SET_CPU_MAX_FREQUENCY "deviced_request_set_cpu_max_frequency"
39 #define API_NAME_DEVICED_REQUEST_SET_CPU_MIN_FREQUENCY "deviced_request_set_cpu_min_frequency"
40 #define API_NAME_DEVICED_RELEASE_CPU_MAX_FREQUENCY "deviced_release_cpu_max_frequency"
41 #define API_NAME_DEVICED_RELEASE_CPU_MIN_FREQUENCY "deviced_release_cpu_min_frequency"
42 #define API_NAME_DEVICED_REQUEST_SET_FACTORY_MODE "deviced_request_set_factory_mode"
43 #define API_NAME_DEVICED_REQUEST_DUMP_LOG "deviced_request_dump_log"
44 #define API_NAME_DEVICED_REQUEST_DELETE_DUMP "deviced_request_delete_dump"
45
46 static void startup(void);
47 static void cleanup(void);
48
49 void (*tet_startup)(void) = startup;
50 void (*tet_cleanup)(void) = cleanup;
51
52
53 static void utc_system_deviced_deviced_get_cmdline_name_p(void);
54 static void utc_system_deviced_deviced_get_cmdline_name_n_1(void);
55 static void utc_system_deviced_deviced_get_cmdline_name_n_2(void);
56 static void utc_system_deviced_deviced_get_cmdline_name_n_3(void);
57 static void utc_system_deviced_deviced_get_apppath_p(void);
58 static void utc_system_deviced_deviced_get_apppath_n_1(void);
59 static void utc_system_deviced_deviced_get_apppath_n_2(void);
60 static void utc_system_deviced_deviced_get_apppath_n_3(void);
61 static void utc_system_deviced_deviced_conf_set_mempolicy_p(void);
62 static void utc_system_deviced_deviced_conf_set_mempolicy_n(void);
63 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_p(void);
64 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_1(void);
65 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_2(void);
66 static void utc_system_deviced_deviced_conf_set_permanent_p(void);
67 static void utc_system_deviced_deviced_conf_set_permanent_bypid_p(void);
68 static void utc_system_deviced_deviced_conf_set_permanent_bypid_n(void);
69 static void utc_system_deviced_deviced_conf_set_vip_p(void);
70 static void utc_system_deviced_deviced_conf_set_vip_n(void);
71 static void utc_system_deviced_deviced_conf_is_vip_p(void);
72 static void utc_system_deviced_deviced_conf_is_vip_n(void);
73 static void utc_system_deviced_deviced_set_timezone_p(void);
74 static void utc_system_deviced_deviced_set_timezone_n(void);
75 static void utc_system_deviced_deviced_inform_foregrd_p(void);
76 static void utc_system_deviced_deviced_inform_backgrd_p(void);
77 static void utc_system_deviced_deviced_inform_active_p(void);
78 static void utc_system_deviced_deviced_inform_active_n(void);
79 static void utc_system_deviced_deviced_inform_inactive_p(void);
80 static void utc_system_deviced_deviced_inform_inactive_n(void);
81 static void utc_system_deviced_deviced_request_poweroff_p(void);
82 static void utc_system_deviced_deviced_request_entersleep_p(void);
83 static void utc_system_deviced_deviced_request_leavesleep_p(void);
84 static void utc_system_deviced_deviced_request_reboot_p(void);
85 static void utc_system_deviced_deviced_request_set_cpu_max_frequency_p(void);
86 static void utc_system_deviced_deviced_request_set_cpu_max_frequency_n(void);
87 static void utc_system_deviced_deviced_request_set_cpu_min_frequency_p(void);
88 static void utc_system_deviced_deviced_request_set_cpu_min_frequency_n(void);
89 static void utc_system_deviced_deviced_release_cpu_max_frequency_p(void);
90 static void utc_system_deviced_deviced_release_cpu_min_frequency_p(void);
91 static void utc_system_deviced_deviced_request_set_factory_mode_p_1(void);
92 static void utc_system_deviced_deviced_request_set_factory_mode_p_2(void);
93 static void utc_system_deviced_deviced_request_set_factory_mode_n(void);
94 static void utc_system_deviced_deviced_request_dump_log_p_1(void);
95 static void utc_system_deviced_deviced_request_dump_log_p_2(void);
96 static void utc_system_deviced_deviced_request_dump_log_n(void);
97 static void utc_system_deviced_deviced_request_delete_dump_p(void);
98 static void utc_system_deviced_deviced_request_delete_dump_n(void);
99
100 enum {
101         POSITIVE_TC_IDX = 0x01,
102         NEGATIVE_TC_IDX,
103 };
104
105 struct tet_testlist tet_testlist[] = {
106         { utc_system_deviced_deviced_get_cmdline_name_p, POSITIVE_TC_IDX },
107         { utc_system_deviced_deviced_get_cmdline_name_n_1, NEGATIVE_TC_IDX },
108         { utc_system_deviced_deviced_get_cmdline_name_n_2, NEGATIVE_TC_IDX },
109         { utc_system_deviced_deviced_get_cmdline_name_n_3, NEGATIVE_TC_IDX },
110         { utc_system_deviced_deviced_get_apppath_p, POSITIVE_TC_IDX },
111         { utc_system_deviced_deviced_get_apppath_n_1, NEGATIVE_TC_IDX },
112         { utc_system_deviced_deviced_get_apppath_n_2, NEGATIVE_TC_IDX },
113         { utc_system_deviced_deviced_get_apppath_n_3, NEGATIVE_TC_IDX },
114         { utc_system_deviced_deviced_conf_set_mempolicy_p, POSITIVE_TC_IDX },
115         { utc_system_deviced_deviced_conf_set_mempolicy_n, NEGATIVE_TC_IDX },
116         { utc_system_deviced_deviced_conf_set_mempolicy_bypid_p, POSITIVE_TC_IDX },
117         { utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_1, NEGATIVE_TC_IDX },
118         { utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_2, NEGATIVE_TC_IDX },
119         { utc_system_deviced_deviced_conf_set_permanent_p, POSITIVE_TC_IDX },
120         { utc_system_deviced_deviced_conf_set_permanent_bypid_p, POSITIVE_TC_IDX },
121         { utc_system_deviced_deviced_conf_set_permanent_bypid_n, NEGATIVE_TC_IDX },
122         { utc_system_deviced_deviced_conf_set_vip_p, POSITIVE_TC_IDX },
123         { utc_system_deviced_deviced_conf_set_vip_n, NEGATIVE_TC_IDX },
124         { utc_system_deviced_deviced_conf_is_vip_p, POSITIVE_TC_IDX },
125         { utc_system_deviced_deviced_conf_is_vip_n, NEGATIVE_TC_IDX },
126         { utc_system_deviced_deviced_set_timezone_p, POSITIVE_TC_IDX },
127         { utc_system_deviced_deviced_set_timezone_n, NEGATIVE_TC_IDX },
128         { utc_system_deviced_deviced_inform_foregrd_p, POSITIVE_TC_IDX },
129         { utc_system_deviced_deviced_inform_backgrd_p, POSITIVE_TC_IDX },
130         { utc_system_deviced_deviced_inform_active_p, POSITIVE_TC_IDX },
131         { utc_system_deviced_deviced_inform_active_n, NEGATIVE_TC_IDX },
132         { utc_system_deviced_deviced_inform_inactive_p, POSITIVE_TC_IDX },
133         { utc_system_deviced_deviced_inform_inactive_n, NEGATIVE_TC_IDX },
134 //      { utc_system_deviced_deviced_request_poweroff_p, POSITIVE_TC_IDX },
135         { utc_system_deviced_deviced_request_entersleep_p, POSITIVE_TC_IDX },
136         { utc_system_deviced_deviced_request_leavesleep_p, POSITIVE_TC_IDX },
137 //      { utc_system_deviced_deviced_request_reboot_p, POSITIVE_TC_IDX },
138         { utc_system_deviced_deviced_request_set_cpu_max_frequency_p, POSITIVE_TC_IDX },
139         { utc_system_deviced_deviced_request_set_cpu_max_frequency_n, NEGATIVE_TC_IDX },
140         { utc_system_deviced_deviced_request_set_cpu_min_frequency_p, POSITIVE_TC_IDX },
141         { utc_system_deviced_deviced_request_set_cpu_min_frequency_n, NEGATIVE_TC_IDX },
142         { utc_system_deviced_deviced_release_cpu_max_frequency_p, POSITIVE_TC_IDX },
143         { utc_system_deviced_deviced_release_cpu_min_frequency_p, POSITIVE_TC_IDX },
144         { utc_system_deviced_deviced_request_set_factory_mode_p_1, POSITIVE_TC_IDX },
145         { utc_system_deviced_deviced_request_set_factory_mode_p_2, POSITIVE_TC_IDX },
146         { utc_system_deviced_deviced_request_set_factory_mode_n, NEGATIVE_TC_IDX },
147         { utc_system_deviced_deviced_request_dump_log_p_1, POSITIVE_TC_IDX },
148         { utc_system_deviced_deviced_request_dump_log_p_2, POSITIVE_TC_IDX },
149         { utc_system_deviced_deviced_request_dump_log_n, NEGATIVE_TC_IDX },
150         { utc_system_deviced_deviced_request_delete_dump_p, POSITIVE_TC_IDX },
151         { utc_system_deviced_deviced_request_delete_dump_n, NEGATIVE_TC_IDX },
152         { NULL, 0 },
153 };
154
155 static void startup(void)
156 {
157 }
158
159 static void cleanup(void)
160 {
161 }
162
163 /**
164  * @brief Positive test case of deviced_get_cmdline_name()
165  */
166 static void utc_system_deviced_deviced_get_cmdline_name_p(void)
167 {
168         pid_t pid;
169         char str[1024];
170         int ret;
171
172         pid = getpid();
173
174         ret = deviced_get_cmdline_name(pid, str, sizeof(str));
175         dts_check_eq(API_NAME_DEVICED_GET_CMDLINE_NAME, ret, 0);
176 }
177
178 /**
179  * @brief Negative test case of deviced_get_cmdline_name()
180  */
181 static void utc_system_deviced_deviced_get_cmdline_name_n_1(void)
182 {
183         char str[1024];
184         int ret;
185
186         ret = deviced_get_cmdline_name(-1, str, sizeof(str));
187         dts_check_ne(API_NAME_DEVICED_GET_CMDLINE_NAME, ret, 0);
188 }
189
190 /**
191  * @brief Negative test case of deviced_get_cmdline_name()
192  */
193 static void utc_system_deviced_deviced_get_cmdline_name_n_2(void)
194 {
195         pid_t pid;
196         char str[1024];
197         int ret;
198
199         pid = getpid();
200
201         ret = deviced_get_cmdline_name(pid, NULL, sizeof(str));
202         dts_check_ne(API_NAME_DEVICED_GET_CMDLINE_NAME, ret, 0);
203 }
204
205 /**
206  * @brief Negative test case of deviced_get_cmdline_name()
207  */
208 static void utc_system_deviced_deviced_get_cmdline_name_n_3(void)
209 {
210         pid_t pid;
211         char str[1024];
212         int ret;
213
214         pid = getpid();
215
216         ret = deviced_get_cmdline_name(pid, str, -1);
217         dts_check_ne(API_NAME_DEVICED_GET_CMDLINE_NAME, ret, 0);
218 }
219
220 /**
221  * @brief Positive test case of deviced_get_apppath()
222  */
223 static void utc_system_deviced_deviced_get_apppath_p(void)
224 {
225         pid_t pid;
226         char str[1024];
227         int ret;
228
229         pid = getpid();
230
231         ret = deviced_get_apppath(pid, str, sizeof(str));
232         dts_check_eq(API_NAME_DEVICED_GET_APPPATH, ret, 0);
233 }
234
235 /**
236  * @brief Negative test case of deviced_get_apppath()
237  */
238 static void utc_system_deviced_deviced_get_apppath_n_1(void)
239 {
240         char str[1024];
241         int ret;
242
243         ret = deviced_get_apppath(-1, str, sizeof(str));
244         dts_check_ne(API_NAME_DEVICED_GET_APPPATH, ret, 0);
245 }
246
247 /**
248  * @brief Negative test case of deviced_get_apppath()
249  */
250 static void utc_system_deviced_deviced_get_apppath_n_2(void)
251 {
252         pid_t pid;
253         char str[1024];
254         int ret;
255
256         pid = getpid();
257
258         ret = deviced_get_apppath(pid, NULL, sizeof(str));
259         dts_check_ne(API_NAME_DEVICED_GET_APPPATH, ret, 0);
260 }
261
262 /**
263  * @brief Negative test case of deviced_get_apppath()
264  */
265 static void utc_system_deviced_deviced_get_apppath_n_3(void)
266 {
267         pid_t pid;
268         char str[1024];
269         int ret;
270
271         pid = getpid();
272
273         ret = deviced_get_apppath(pid, str, -1);
274         dts_check_ne(API_NAME_DEVICED_GET_APPPATH, ret, 0);
275 }
276
277 /**
278  * @brief Positive test case of deviced_conf_set_mempolicy()
279  */
280 static void utc_system_deviced_deviced_conf_set_mempolicy_p(void)
281 {
282         int ret;
283
284         ret = deviced_conf_set_mempolicy(OOM_LIKELY);
285         dts_check_eq(API_NAME_DEVICED_CONF_SET_MEMPOLICY, ret, 0);
286 }
287
288 /**
289  * @brief Negative test case of deviced_conf_set_mempolicy()
290  */
291 static void utc_system_deviced_deviced_conf_set_mempolicy_n(void)
292 {
293         int ret;
294
295         ret = deviced_conf_set_mempolicy(-1);
296         dts_check_ne(API_NAME_DEVICED_CONF_SET_MEMPOLICY, ret, 0);
297 }
298
299 /**
300  * @brief Positive test case of deviced_conf_set_mempolicy_bypid()
301  */
302 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_p(void)
303 {
304         pid_t pid;
305         int ret;
306
307         pid = getpid();
308
309         ret = deviced_conf_set_mempolicy_bypid(pid, OOM_LIKELY);
310         dts_check_eq(API_NAME_DEVICED_CONF_SET_MEMPOLICY_BYPID, ret, 0);
311 }
312
313 /**
314  * @brief Negative test case of deviced_conf_set_mempolicy_bypid()
315  */
316 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_1(void)
317 {
318         int ret;
319
320         ret = deviced_conf_set_mempolicy_bypid(-1, OOM_LIKELY);
321         dts_check_ne(API_NAME_DEVICED_CONF_SET_MEMPOLICY_BYPID, ret, 0);
322 }
323
324 /**
325  * @brief Negative test case of deviced_conf_set_mempolicy_bypid()
326  */
327 static void utc_system_deviced_deviced_conf_set_mempolicy_bypid_n_2(void)
328 {
329         pid_t pid;
330         int ret;
331
332         pid = getpid();
333
334         ret = deviced_conf_set_mempolicy_bypid(pid, -1);
335         dts_check_ne(API_NAME_DEVICED_CONF_SET_MEMPOLICY_BYPID, ret, 0);
336 }
337
338 /**
339  * @brief Positive test case of deviced_conf_set_permanent()
340  */
341 static void utc_system_deviced_deviced_conf_set_permanent_p(void)
342 {
343         int ret;
344
345         ret = deviced_conf_set_permanent();
346         dts_check_eq(API_NAME_DEVICED_CONF_SET_PERMANENT, ret, 0);
347 }
348
349 /**
350  * @brief Positive test case of deviced_conf_set_permanent_bypid()
351  */
352 static void utc_system_deviced_deviced_conf_set_permanent_bypid_p(void)
353 {
354         pid_t pid;
355         int ret;
356
357         pid = getpid();
358
359         ret = deviced_conf_set_permanent_bypid(pid);
360         dts_check_eq(API_NAME_DEVICED_CONF_SET_PERMANENT_BYPID, ret, 0);
361 }
362
363 /**
364  * @brief Negative test case of deviced_conf_set_permanent_bypid()
365  */
366 static void utc_system_deviced_deviced_conf_set_permanent_bypid_n(void)
367 {
368         int ret;
369
370         ret = deviced_conf_set_permanent_bypid(-1);
371         dts_check_ne(API_NAME_DEVICED_CONF_SET_PERMANENT_BYPID, ret, 0);
372 }
373
374 /**
375  * @brief Positive test case of deviced_conf_set_vip()
376  */
377 static void utc_system_deviced_deviced_conf_set_vip_p(void)
378 {
379         pid_t pid;
380         int ret;
381
382         pid = getpid();
383
384         ret = deviced_conf_set_vip(pid);
385         dts_check_eq(API_NAME_DEVICED_CONF_SET_VIP, ret, 0);
386 }
387
388 /**
389  * @brief Negative test case of deviced_conf_set_vip()
390  */
391 static void utc_system_deviced_deviced_conf_set_vip_n(void)
392 {
393         int ret;
394
395         ret = deviced_conf_set_vip(-1);
396         dts_check_ne(API_NAME_DEVICED_CONF_SET_VIP, ret, 0);
397 }
398
399 /**
400  * @brief Positive test case of deviced_conf_is_vip()
401  */
402 static void utc_system_deviced_deviced_conf_is_vip_p(void)
403 {
404         pid_t pid;
405         int ret;
406
407         pid = getpid();
408
409         ret = deviced_conf_is_vip(pid);
410         dts_check_ge(API_NAME_DEVICED_CONF_IS_VIP, ret, 0);
411 }
412
413 /**
414  * @brief Negative test case of deviced_conf_is_vip()
415  */
416 static void utc_system_deviced_deviced_conf_is_vip_n(void)
417 {
418         int ret;
419
420         ret = deviced_conf_is_vip(-1);
421         dts_check_lt(API_NAME_DEVICED_CONF_IS_VIP, ret, 0);
422 }
423
424 /**
425  * @brief Positive test case of deviced_set_timezone()
426  */
427 static void utc_system_deviced_deviced_set_timezone_p(void)
428 {
429         int ret;
430
431         ret = deviced_set_timezone("/usr/share/zoneinfo/Asia/Seoul");
432         dts_check_eq(API_NAME_DEVICED_SET_TIMEZONE, ret, 0);
433 }
434
435 /**
436  * @brief Negative test case of deviced_set_timezone()
437  */
438 static void utc_system_deviced_deviced_set_timezone_n(void)
439 {
440         int ret;
441
442         ret = deviced_set_timezone(NULL);
443         dts_check_ne(API_NAME_DEVICED_SET_TIMEZONE, ret, 0);
444 }
445
446 /**
447  * @brief Positive test case of deviced_inform_foregrd()
448  */
449 static void utc_system_deviced_deviced_inform_foregrd_p(void)
450 {
451         int ret;
452
453         ret = deviced_inform_foregrd();
454         dts_check_eq(API_NAME_DEVICED_INFORM_FOREGRD, ret, 0);
455 }
456
457 /**
458  * @brief Positive test case of deviced_inform_backgrd()
459  */
460 static void utc_system_deviced_deviced_inform_backgrd_p(void)
461 {
462         int ret;
463
464         ret = deviced_inform_backgrd();
465         dts_check_eq(API_NAME_DEVICED_INFORM_BACKGRD, ret, 0);
466 }
467
468 /**
469  * @brief Positive test case of deviced_inform_active()
470  */
471 static void utc_system_deviced_deviced_inform_active_p(void)
472 {
473         pid_t pid;
474         int ret;
475
476         pid = getpid();
477
478         ret = deviced_inform_active(pid);
479         dts_check_eq(API_NAME_DEVICED_INFORM_ACTIVE, ret, 0);
480 }
481
482 /**
483  * @brief Negative test case of deviced_inform_active()
484  */
485 static void utc_system_deviced_deviced_inform_active_n(void)
486 {
487         int ret;
488
489         ret = deviced_inform_active(-1);
490         dts_check_ne(API_NAME_DEVICED_INFORM_ACTIVE, ret, 0);
491 }
492
493 /**
494  * @brief Positive test case of deviced_inform_inactive()
495  */
496 static void utc_system_deviced_deviced_inform_inactive_p(void)
497 {
498         pid_t pid;
499         int ret;
500
501         pid = getpid();
502
503         ret = deviced_inform_inactive(pid);
504         dts_check_eq(API_NAME_DEVICED_INFORM_INACTIVE, ret, 0);
505 }
506
507 /**
508  * @brief Negative test case of deviced_inform_inactive()
509  */
510 static void utc_system_deviced_deviced_inform_inactive_n(void)
511 {
512         int ret;
513
514         ret = deviced_inform_inactive(-1);
515         dts_check_ne(API_NAME_DEVICED_INFORM_INACTIVE, ret, 0);
516 }
517
518 /**
519  * @brief Positive test case of deviced_request_poweroff()
520  */
521 static void utc_system_deviced_deviced_request_poweroff_p(void)
522 {
523         int ret;
524
525         ret = deviced_request_poweroff();
526         dts_check_eq(API_NAME_DEVICED_REQUEST_POWEROFF, ret, 0);
527 }
528
529 /**
530  * @brief Positive test case of deviced_request_entersleep()
531  */
532 static void utc_system_deviced_deviced_request_entersleep_p(void)
533 {
534         int ret;
535
536         ret = deviced_request_entersleep();
537         dts_check_eq(API_NAME_DEVICED_REQUEST_ENTERSLEEP, ret, 0);
538 }
539
540 /**
541  * @brief Positive test case of deviced_request_leavesleep()
542  */
543 static void utc_system_deviced_deviced_request_leavesleep_p(void)
544 {
545         int ret;
546
547         ret = deviced_request_leavesleep();
548         dts_check_eq(API_NAME_DEVICED_REQUEST_LEAVESLEEP, ret, 0);
549 }
550
551 /**
552  * @brief Positive test case of deviced_request_reboot()
553  */
554 static void utc_system_deviced_deviced_request_reboot_p(void)
555 {
556         int ret;
557
558         ret = deviced_request_reboot();
559         dts_check_eq(API_NAME_DEVICED_REQUEST_REBOOT, ret, 0);
560 }
561
562 /**
563  * @brief Positive test case of deviced_request_set_cpu_max_frequency()
564  */
565 static void utc_system_deviced_deviced_request_set_cpu_max_frequency_p(void)
566 {
567         int ret;
568
569         ret = deviced_request_set_cpu_max_frequency(60);
570         dts_check_eq(API_NAME_DEVICED_REQUEST_SET_CPU_MAX_FREQUENCY, ret, 0);
571 }
572
573 /**
574  * @brief Negative test case of deviced_request_set_cpu_max_frequency()
575  */
576 static void utc_system_deviced_deviced_request_set_cpu_max_frequency_n(void)
577 {
578         int ret;
579
580         ret = deviced_request_set_cpu_max_frequency(-1);
581         dts_check_ne(API_NAME_DEVICED_REQUEST_SET_CPU_MAX_FREQUENCY, ret, 0);
582 }
583
584 /**
585  * @brief Positive test case of deviced_request_set_cpu_min_frequency()
586  */
587 static void utc_system_deviced_deviced_request_set_cpu_min_frequency_p(void)
588 {
589         int ret;
590
591         ret = deviced_request_set_cpu_min_frequency(60);
592         dts_check_eq(API_NAME_DEVICED_REQUEST_SET_CPU_MIN_FREQUENCY, ret, 0);
593 }
594
595 /**
596  * @brief Negative test case of deviced_request_set_cpu_min_frequency()
597  */
598 static void utc_system_deviced_deviced_request_set_cpu_min_frequency_n(void)
599 {
600         int ret;
601
602         ret = deviced_request_set_cpu_min_frequency(-1);
603         dts_check_ne(API_NAME_DEVICED_REQUEST_SET_CPU_MIN_FREQUENCY, ret, 0);
604 }
605
606 /**
607  * @brief Positive test case of deviced_release_cpu_max_frequency()
608  */
609 static void utc_system_deviced_deviced_release_cpu_max_frequency_p(void)
610 {
611         int ret;
612
613         ret = deviced_release_cpu_max_frequency();
614         dts_check_eq(API_NAME_DEVICED_RELEASE_CPU_MAX_FREQUENCY, ret, 0);
615 }
616
617 /**
618  * @brief Positive test case of deviced_release_cpu_min_frequency()
619  */
620 static void utc_system_deviced_deviced_release_cpu_min_frequency_p(void)
621 {
622         int ret;
623
624         ret = deviced_release_cpu_min_frequency();
625         dts_check_eq(API_NAME_DEVICED_RELEASE_CPU_MIN_FREQUENCY, ret, 0);
626 }
627
628 /**
629  * @brief Positive test case of deviced_request_set_factory_mode()
630  */
631 static void utc_system_deviced_deviced_request_set_factory_mode_p_1(void)
632 {
633         int ret;
634
635         ret = deviced_request_set_factory_mode(1);
636         dts_check_eq(API_NAME_DEVICED_REQUEST_SET_FACTORY_MODE, ret, 1, "Enable factory mode");
637 }
638
639 /**
640  * @brief Positive test case of deviced_request_set_factory_mode()
641  */
642 static void utc_system_deviced_deviced_request_set_factory_mode_p_2(void)
643 {
644         int ret;
645
646         ret = deviced_request_set_factory_mode(0);
647         dts_check_eq(API_NAME_DEVICED_REQUEST_SET_FACTORY_MODE, ret, 0, "Disable factory mode");
648 }
649
650 /**
651  * @brief Negative test case of deviced_request_set_factory_mode()
652  */
653 static void utc_system_deviced_deviced_request_set_factory_mode_n(void)
654 {
655         int ret;
656
657         ret = deviced_request_set_factory_mode(-1);
658         dts_check_ne(API_NAME_DEVICED_REQUEST_SET_FACTORY_MODE, ret, 0);
659 }
660
661 /**
662  * @brief Positive test case of deviced_request_dump_log()
663  */
664 static void utc_system_deviced_deviced_request_dump_log_p_1(void)
665 {
666         int ret;
667
668         ret = deviced_request_dump_log(AP_DUMP);
669         dts_check_ge(API_NAME_DEVICED_REQUEST_DUMP_LOG, ret, 0);
670 }
671
672 /**
673  * @brief Positive test case of deviced_request_dump_log()
674  */
675 static void utc_system_deviced_deviced_request_dump_log_p_2(void)
676 {
677         int ret;
678
679         ret = deviced_request_dump_log(CP_DUMP);
680         dts_check_eq(API_NAME_DEVICED_REQUEST_DUMP_LOG, ret, 0);
681 }
682
683 /**
684  * @brief Positive test case of deviced_request_dump_log()
685  */
686 static void utc_system_deviced_deviced_request_dump_log_n(void)
687 {
688         int ret;
689
690         ret = deviced_request_dump_log(-1);
691         dts_check_ne(API_NAME_DEVICED_REQUEST_DUMP_LOG, ret, 0);
692 }
693
694 /**
695  * @brief Positive test case of deviced_request_delete_dump()
696  */
697 static void utc_system_deviced_deviced_request_delete_dump_p(void)
698 {
699         int ret;
700
701         ret = deviced_request_delete_dump("");
702         dts_check_eq(API_NAME_DEVICED_REQUEST_DELETE_DUMP, ret, 0);
703 }
704
705 /**
706  * @brief Negative test case of deviced_request_delete_dump()
707  */
708 static void utc_system_deviced_deviced_request_delete_dump_n(void)
709 {
710         int ret;
711
712         ret = deviced_request_delete_dump(NULL);
713         dts_check_ne(API_NAME_DEVICED_REQUEST_DELETE_DUMP, ret, 0);
714 }