2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <system_info.h>
22 static void startup(void);
23 static void cleanup(void);
25 void (*tet_startup)(void) = startup;
26 void (*tet_cleanup)(void) = cleanup;
29 #define API_NAME_SYSINFO_ACCESSIBLE "system_info_type_accessible"
30 #define API_NAME_SYSINFO_GOOD_VALUE "system_info_good_value"
31 #define API_NAME_SYSINFO_SUPPORT_CHECK(key) "system_info_support_check_"#key
33 /* this is the sting with 2^15 elements, really huge */
34 #define HUGE_STRING_LEN 65536
36 /****************************************************************/
37 /* check if all defined types for results are accessible */
38 static void utc_system_info_get_int_p(void);
39 static void utc_system_info_get_int_n(void);
40 static void utc_system_info_get_bool_p(void);
41 static void utc_system_info_get_bool_n(void);
42 static void utc_system_info_get_string_p(void);
43 static void utc_system_info_get_string_n(void);
44 static void utc_system_info_get_double_p(void);
45 static void utc_system_info_get_double_n(void);
46 static void utc_system_info_get_platform_bool(void);
47 static void utc_system_info_get_platform_int(void);
48 static void utc_system_info_get_platform_double(void);
49 static void utc_system_info_get_platform_string(void);
50 static void utc_system_info_get_custom_bool(void);
51 static void utc_system_info_get_custom_int(void);
52 static void utc_system_info_get_custom_double(void);
53 static void utc_system_info_get_custom_string(void);
54 static void utc_system_info_get_internal_value(void);
56 /****************************************************************/
57 /* check if all particular informations have reasonable values */
58 static void utc_system_info_model_p(void);
59 static void utc_system_info_tizen_ver_p(void);
60 static void utc_system_info_h_res_p(void);
61 static void utc_system_info_w_res_p(void);
62 static void utc_system_info_platform_name_p(void);
63 static void utc_system_info_platform_ver_p(void);
64 static void utc_system_info_screen_DPI_p(void);
65 static void utc_system_info_core_cpu_arch_p(void);
66 static void utc_system_info_core_freq_p(void);
67 static void utc_system_info_physical_screen_height_p(void);
68 static void utc_system_info_physical_screen_width_p(void);
69 static void utc_system_info_build_string_p(void);
70 static void utc_system_info_build_date_p(void);
71 static void utc_system_info_build_time_p(void);
72 static void utc_system_info_manufacturer_p(void);
73 static void utc_system_info_tethering_support_key_p(void);
75 struct tet_testlist tet_testlist[] = {
76 {utc_system_info_get_int_p, 1},
77 {utc_system_info_get_int_n, 1},
78 {utc_system_info_get_bool_p, 1},
79 {utc_system_info_get_bool_n, 1},
80 {utc_system_info_get_string_p, 1},
81 {utc_system_info_get_string_n, 1},
82 {utc_system_info_get_double_p, 1},
83 {utc_system_info_get_double_n, 1},
84 {utc_system_info_model_p, 1},
85 {utc_system_info_tizen_ver_p, 1},
86 {utc_system_info_h_res_p, 1},
87 {utc_system_info_w_res_p, 1},
88 {utc_system_info_platform_name_p, 1},
89 {utc_system_info_platform_ver_p, 1},
90 {utc_system_info_screen_DPI_p, 1},
91 {utc_system_info_core_cpu_arch_p, 1},
92 {utc_system_info_core_freq_p, 1},
93 {utc_system_info_physical_screen_height_p, 1},
94 {utc_system_info_physical_screen_width_p, 1},
95 {utc_system_info_build_string_p, 1},
96 {utc_system_info_build_date_p, 1},
97 {utc_system_info_build_time_p, 1},
98 {utc_system_info_manufacturer_p, 1},
99 {utc_system_info_tethering_support_key_p, 1},
100 {utc_system_info_get_platform_bool, 1},
101 {utc_system_info_get_platform_int, 1},
102 {utc_system_info_get_platform_double, 1},
103 {utc_system_info_get_platform_string, 1},
104 {utc_system_info_get_custom_bool, 1},
105 {utc_system_info_get_custom_int, 1},
106 {utc_system_info_get_custom_double, 1},
107 {utc_system_info_get_custom_string, 1},
108 {utc_system_info_get_internal_value, 1},
112 static void startup(void)
117 static void cleanup(void)
122 /****************************************************************/
123 /* check if all defined types for results are accessible */
124 static void utc_system_info_get_int_p(void)
128 int retcode = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, &value);
130 if (retcode == SYSTEM_INFO_ERROR_NONE)
131 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
133 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
136 static void utc_system_info_get_int_n(void)
138 int retcode = system_info_get_value_int(SYSTEM_INFO_KEY_CAMERA_COUNT, NULL);
140 if (retcode != SYSTEM_INFO_ERROR_NONE)
141 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
143 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
146 static void utc_system_info_get_bool_p(void)
150 int retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, &value);
152 if (retcode == SYSTEM_INFO_ERROR_NONE)
153 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
155 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
158 static void utc_system_info_get_bool_n(void)
160 int retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_BLUETOOTH_SUPPORTED, NULL);
162 if (retcode != SYSTEM_INFO_ERROR_NONE)
163 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
165 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
168 static void utc_system_info_get_string_p(void)
172 int retcode = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &value);
178 if (retcode == SYSTEM_INFO_ERROR_NONE)
179 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
181 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
184 static void utc_system_info_get_string_n(void)
186 int retcode = system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, NULL);
188 if (retcode != SYSTEM_INFO_ERROR_NONE)
189 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
191 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
195 static void utc_system_info_get_double_p(void)
199 int retcode = system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, &value);
201 if (retcode == SYSTEM_INFO_ERROR_NONE)
202 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
204 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
207 static void utc_system_info_get_double_n(void)
209 int retcode = system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, NULL);
211 if (retcode != SYSTEM_INFO_ERROR_NONE)
212 dts_pass(API_NAME_SYSINFO_ACCESSIBLE, "passed");
214 dts_fail(API_NAME_SYSINFO_ACCESSIBLE, "failed");
217 /****************************************************************/
218 /* check if all particular informations have reasonable values */
220 static void utc_system_info_model_p(void)
226 system_info_get_value_string(SYSTEM_INFO_KEY_MODEL, &string);
229 string_len = strlen(string);
233 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
235 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
238 static void utc_system_info_tizen_ver_p(void)
244 system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION, &string);
247 string_len = strlen(string);
251 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
253 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
256 static void utc_system_info_h_res_p(void)
261 system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &h);
263 result = (h > 0) && (h < 10000);
265 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
268 static void utc_system_info_w_res_p(void)
273 system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &w);
275 result = (w > 0) && (w < 10000);
277 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
280 static void utc_system_info_platform_name_p(void)
286 system_info_get_value_string(SYSTEM_INFO_KEY_PLATFORM_NAME, &string);
289 string_len = strlen(string);
293 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
295 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
298 static void utc_system_info_platform_ver_p(void)
304 system_info_get_value_string(SYSTEM_INFO_KEY_TIZEN_VERSION_NAME, &string);
307 string_len = strlen(string);
311 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
313 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
316 static void utc_system_info_screen_DPI_p(void)
321 system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_DPI, &w);
323 result = (w > 0) && (w < 10000);
325 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
328 static void utc_system_info_core_cpu_arch_p(void)
332 int result = system_info_get_value_string(SYSTEM_INFO_KEY_CORE_CPU_ARCH, &string);
338 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 0);
341 static void utc_system_info_core_freq_p(void)
346 system_info_get_value_double(SYSTEM_INFO_KEY_CORE_CPU_FREQ, &w);
348 result = (w > 0) && (w < 10000);
350 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
353 static void utc_system_info_physical_screen_height_p(void)
358 system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_HEIGHT, &w);
360 result = (w > 0) && (w < 10000);
362 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
365 static void utc_system_info_physical_screen_width_p(void)
370 system_info_get_value_int(SYSTEM_INFO_KEY_PHYSICAL_SCREEN_WIDTH, &w);
372 result = (w > 0) && (w < 10000);
374 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
377 static void utc_system_info_build_string_p(void)
383 system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_STRING, &string);
386 string_len = strlen(string);
390 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
392 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
395 static void utc_system_info_build_date_p(void)
401 system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_DATE, &string);
404 string_len = strlen(string);
408 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
410 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
413 static void utc_system_info_build_time_p(void)
419 system_info_get_value_string(SYSTEM_INFO_KEY_BUILD_TIME, &string);
422 string_len = strlen(string);
426 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
428 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
431 static void utc_system_info_manufacturer_p(void)
437 system_info_get_value_string(SYSTEM_INFO_KEY_MANUFACTURER, &string);
440 string_len = strlen(string);
444 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
446 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
449 static void utc_system_info_tethering_support_key_p(void)
455 retcode = system_info_get_value_bool(SYSTEM_INFO_KEY_TETHERING_SUPPORTED, &supported);
457 if (retcode == SYSTEM_INFO_ERROR_NONE)
458 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
460 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
463 static void utc_system_info_get_platform_bool(void)
468 retcode = system_info_get_platform_bool("tizen.org/feature/fmradio", &supported);
470 if (retcode == SYSTEM_INFO_ERROR_NONE)
471 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
473 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
476 static void utc_system_info_get_platform_int(void)
481 system_info_get_value_int("tizen.org/feature/screen.bpp", &value);
483 result = (value > 0) && (value < 10000);
485 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
488 static void utc_system_info_get_platform_double(void)
493 retcode = system_info_get_platform_double("tizen.org/feature/double", &value);
495 if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
496 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
498 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
501 static void utc_system_info_get_platform_string(void)
507 system_info_get_platform_string("tizen.org/system/platform.name", &string);
510 string_len = strlen(string);
514 result = (string_len < HUGE_STRING_LEN) && (string_len > 0);
516 dts_check_eq(API_NAME_SYSINFO_GOOD_VALUE, result, 1);
519 static void utc_system_info_get_custom_bool(void)
524 retcode = system_info_get_custom_bool("tizen.org/feature/double", &value);
526 if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
527 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
529 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
532 static void utc_system_info_get_custom_int(void)
537 retcode = system_info_get_custom_int("tizen.org/feature/double", &value);
539 if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
540 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
542 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
545 static void utc_system_info_get_custom_double(void)
550 retcode = system_info_get_custom_double("tizen.org/feature/double", &value);
552 if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
553 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
555 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
558 static void utc_system_info_get_custom_string(void)
563 retcode = system_info_get_custom_string("tizen.org/feature/double", &value);
568 if (retcode == SYSTEM_INFO_ERROR_IO_ERROR)
569 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
571 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");
574 static void utc_system_info_get_internal_value(void)
579 retcode = system_info_get_internal_value("board.display.height_mm", &value);
584 if (retcode == SYSTEM_INFO_ERROR_NONE)
585 dts_pass(API_NAME_SYSINFO_SUPPORT_CHECK(i), "passed");
587 dts_fail(API_NAME_SYSINFO_SUPPORT_CHECK(i), "failed");