Update Snapshot(2018-12-12)
[platform/upstream/iotivity.git] / resource / unit_tests.scons
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # 'unit_test' script for building unit tests and libs
23 #
24 ##
25
26 Import('env')
27
28 target_os = env.get('TARGET_OS')
29 src_dir = env.get('SRC_DIR')
30 build_dir = env.get('BUILD_DIR')
31
32 if target_os in ['linux']:
33         # Verify that 'google unit test' library is installed.  If not,
34         # get it and install it
35         SConscript('#extlibs/gtest/SConscript')
36
37         # Verify that 'hippomocks' mocking code is installed.  If not,
38         # get it and install it
39         SConscript('#extlibs/hippomocks.scons')
40
41     # Build Common unit tests
42         SConscript('c_common/oic_string/test/SConscript')
43         SConscript('c_common/oic_malloc/test/SConscript')
44         SConscript('c_common/oic_time/test/SConscript')
45         SConscript('c_common/ocrandom/test/SConscript')
46
47         # Build C unit tests
48         SConscript('csdk/stack/test/SConscript')
49
50         SConscript('csdk/connectivity/test/SConscript')
51
52         # Build Security Resource Manager unit tests
53         if env.get('SECURED') == '1':
54                 SConscript('csdk/security/unittest/SConscript')
55
56         # Build C++ unit tests
57         SConscript('unittests/SConscript')
58
59         # Build Provisioning API unit test
60         if env.get('SECURED') == '1':
61                 SConscript('csdk/security/provisioning/unittest/SConscript')
62                 SConscript('provisioning/unittests/SConscript')
63
64 elif target_os == 'windows' and env.get('TEST') == '1':
65         # Verify that 'google unit test' library is installed.  If not,
66         # get it and install it
67         SConscript('#extlibs/gtest/SConscript')
68
69         # Build Common unit tests
70         SConscript('c_common/windows/test/SConscript')
71
72         # Build C stack's unit tests.
73         SConscript('csdk/stack/test/SConscript')
74         SConscript('csdk/connectivity/test/SConscript')
75
76         # Build Security Resource Manager unit tests
77         if env.get('SECURED') == '1':
78                 SConscript('csdk/security/unittest/SConscript')
79
80         # Build Provisioning API unit test
81         if env.get('SECURED') == '1':
82                 SConscript('csdk/security/provisioning/unittest/SConscript')
83
84 elif target_os in ['darwin', 'msys_nt']:
85         # Verify that 'google unit test' library is installed.  If not,
86         # get it and install it
87         SConscript('#extlibs/gtest/SConscript')
88
89         # Build C stack's unit tests.
90         SConscript('csdk/stack/test/SConscript')
91         SConscript('csdk/connectivity/test/SConscript')