Initialize Tizen 2.3
[framework/system/deviced.git] / src / auto-test / cpu-info.c
1 /*
2  * test
3  *
4  * Copyright (c) 2013 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  */
18
19 #include "test.h"
20
21 #define METHOD_GET_REVISION     "GetRevision"
22
23 static void get_revision(void)
24 {
25         DBusError err;
26         DBusMessage *msg;
27         int ret, val;
28
29         msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_SYSNOTI,
30                 DEVICED_INTERFACE_SYSNOTI, METHOD_GET_REVISION, NULL, NULL);
31         if (!msg) {
32                 _E("fail send message");
33                 return;
34         }
35         dbus_error_init(&err);
36
37         ret = dbus_message_get_args(msg, &err, DBUS_TYPE_INT32, &val, DBUS_TYPE_INVALID);
38
39         if (!ret) {
40                 _E("no message : [%s:%s]", err.name, err.message);
41                 return;
42         }
43         dbus_message_unref(msg);
44         dbus_error_free(&err);
45         _E("%s-%s : %d", DEVICED_INTERFACE_SYSNOTI, METHOD_GET_REVISION, val);
46         if(val >= 8) {
47                 _D("Rinato Neo");
48         } else {
49                 _D("Rinato");
50         }
51 }
52
53 static void cpuinfo_init(void *data)
54 {
55         _I("start test");
56         get_revision();
57 }
58
59 static void cpuinfo_exit(void *data)
60 {
61         _I("end test");
62 }
63
64 static int cpuinfo_unit(int argc, char **argv)
65 {
66         get_revision();
67         return 0;
68 }
69
70 static const struct test_ops cpuinfo_test_ops = {
71         .priority = TEST_PRIORITY_NORMAL,
72         .name     = "cpuinfo",
73         .init     = cpuinfo_init,
74         .exit    = cpuinfo_exit,
75         .unit    = cpuinfo_unit,
76 };
77
78 TEST_OPS_REGISTER(&cpuinfo_test_ops)