Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / resource / csdk / ocrandom / test / SConscript
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 Import('env')
22 import os
23 import os.path
24 randomtest_env = env.Clone()
25
26 src_dir = randomtest_env.get('SRC_DIR')
27
28 ######################################################################
29 # Build flags
30 ######################################################################
31 randomtest_env.PrependUnique(CPPPATH = [
32         '../include',
33                 '../../logger/include',
34                 '../../../oc_logger/include',
35                 '../../../../extlibs/gtest/gtest-1.7.0/include'
36                 ])
37
38 randomtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
39 randomtest_env.AppendUnique(LIBS = ['-lpthread'])
40 randomtest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
41 randomtest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
42 randomtest_env.PrependUnique(LIBS = ['m',
43                                     'octbstack',
44                                     'uuid',
45                                     'gtest',
46                                     'gtest_main'])
47
48
49 if env.get('LOGGING'):
50         randomtest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
51
52 ######################################################################
53 # Source files and Targets
54 ######################################################################
55 randomtests = randomtest_env.Program('randomtests', ['linux/randomtest.cpp'])
56
57 Alias("test", [randomtests])
58
59 env.AppendTarget('test')
60 if env.get('TEST') == '1':
61         target_os = env.get('TARGET_OS')
62         if target_os == 'linux':
63                 from tools.scons.RunTest import *
64                 run_test(randomtest_env,
65                          'resource_csdk_random_test.memcheck',
66                          'resource/csdk/ocrandom/test/randomtests')