1 #******************************************************************
3 # Copyright 2016 Samsung Electronics All Rights Reserved.
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 # http://www.apache.org/licenses/LICENSE-2.0
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.
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 # Notification Unit Test build script
27 if env.get('RELEASE'):
28 env.AppendUnique(CCFLAGS = ['-Os'])
29 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
31 env.AppendUnique(CCFLAGS = ['-g'])
33 if env.get('LOGGING'):
34 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
37 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
39 ######################################################################
41 ######################################################################
42 src_dir = lib_env.get('SRC_DIR')
43 gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0'
45 notification_test_env = lib_env.Clone()
46 target_os = env.get('TARGET_OS')
48 ######################################################################
50 ######################################################################
51 GTest = File(gtest_dir + '/lib/.libs/libgtest.a')
52 GTest_Main = File(gtest_dir + '/lib/.libs/libgtest_main.a')
54 notification_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
55 notification_test_env.AppendUnique(LIBS = [
56 'connectivity_abstraction', 'oc', 'octbstack', 'oc_logger', 'coap',
59 if target_os not in ['windows', 'winrt']:
60 notification_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
62 notification_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
63 notification_test_env.AppendUnique(LIBS = ['pthread'])
65 notification_test_env.PrependUnique(CPPPATH = [ src_dir + '/extlibs/hippomocks-master', gtest_dir + '/include'])
66 notification_test_env.AppendUnique(CPPPATH = ['../include'])
68 ######################################################################
70 ######################################################################
72 notification_consumer_test_env = notification_test_env.Clone()
73 notification_consumer_test_env.AppendUnique(LIBS = ['notification_consumer'])
75 notification_provider_test_env = notification_test_env.Clone()
76 notification_provider_test_env.AppendUnique(LIBS = ['notification_provider'])
78 notification_consumer_test_src = env.Glob('./NSConsumerTest.cpp')
79 notification_consumer_test = notification_consumer_test_env.Program('notification_consumer_test', notification_consumer_test_src)
80 Alias("notification_consumer_test", notification_consumer_test)
81 env.AppendTarget('notification_consumer_test')
83 notification_provider_test_src = env.Glob('./NSProviderTest.cpp')
84 notification_provider_test = notification_provider_test_env.Program('notification_provider_test', notification_provider_test_src)
85 Alias("notification_provider_test", notification_provider_test)
86 env.AppendTarget('notification_provider_test')
88 if env.get('TEST') == '1':
89 if target_os == 'linux':
90 from tools.scons.RunTest import *
91 run_test(notification_consumer_test_env, '', 'service/notification/unittest/notification_consumer_test')
92 run_test(notification_provider_test_env, '', 'service/notification/unittest/notification_provider_test')