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
25 from tools.scons.RunTest import run_test
28 if env.get('RELEASE'):
29 env.AppendUnique(CCFLAGS = ['-Os'])
30 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
32 env.AppendUnique(CCFLAGS = ['-g'])
34 if env.get('LOGGING'):
35 env.AppendUnique(CPPDEFINES = ['TB_LOG'])
38 SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
40 ######################################################################
42 ######################################################################
43 src_dir = lib_env.get('SRC_DIR')
44 gtest_dir = src_dir + '/extlibs/gtest/gtest-1.7.0'
46 notification_wrapper_test_env = lib_env.Clone()
47 target_os = env.get('TARGET_OS')
49 ######################################################################
51 ######################################################################
52 GTest = File(gtest_dir + '/lib/.libs/libgtest.a')
53 GTest_Main = File(gtest_dir + '/lib/.libs/libgtest_main.a')
55 notification_wrapper_test_env.AppendUnique(LIBPATH = [lib_env.get('BUILD_DIR')])
56 notification_wrapper_test_env.AppendUnique(LIBS = [
57 'connectivity_abstraction', 'oc', 'octbstack', 'oc_logger', 'coap', 'resource_directory',
60 if env.get('WITH_TCP') == True:
61 notification_wrapper_test_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
62 if env.get('SECURED') == '1':
63 notification_wrapper_test_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
65 if target_os not in ['windows', 'winrt']:
66 notification_wrapper_test_env.AppendUnique(CXXFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
68 notification_wrapper_test_env.AppendUnique(LINKFLAGS = ['-Wl,--no-as-needed'])
70 notification_wrapper_test_env.AppendUnique(CXXFLAGS = ['-pthread'])
71 notification_wrapper_test_env.AppendUnique(LIBS = ['pthread'])
73 notification_wrapper_test_env.PrependUnique(CPPPATH = [ src_dir + '/extlibs/hippomocks-master', gtest_dir + '/include'])
74 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../provider/inc'])
75 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../consumer/inc'])
76 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../common'])
77 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../../include'])
78 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../../src/provider'])
79 notification_wrapper_test_env.AppendUnique(CPPPATH = ['../../src/consumer'])
81 ######################################################################
83 ######################################################################
85 notification_consumer_wrapper_test_env = notification_wrapper_test_env.Clone()
86 notification_consumer_wrapper_test_env.AppendUnique(LIBS = ['notification_consumer_wrapper','notification_consumer'])
88 notification_provider_wrapper_test_env = notification_wrapper_test_env.Clone()
89 notification_provider_wrapper_test_env.AppendUnique(LIBS = ['notification_provider_wrapper','notification_provider'])
91 notification_consumer_wrapper_test_src = env.Glob('./NSConsumerServiceTest.cpp')
92 notification_consumer_wrapper_test = notification_consumer_wrapper_test_env.Program('notification_consumer_wrapper_test', notification_consumer_wrapper_test_src)
93 Alias("notification_consumer_wrapper_test", notification_consumer_wrapper_test)
94 env.AppendTarget('notification_consumer_wrapper_test')
96 notification_provider_wrapper_test_src = env.Glob('./NSProviderServiceTest.cpp')
97 notification_provider_wrapper_test = notification_provider_wrapper_test_env.Program('notification_provider_wrapper_test', notification_provider_wrapper_test_src)
98 Alias("notification_provider_wrapper_test", notification_provider_wrapper_test)
99 env.AppendTarget('notification_provider_wrapper_test')
101 if env.get('TEST') == '1':
102 if env.get('SECURED') == '0':
103 # TODO: fix this test on linux and remove this comment line
104 if target_os in ['']:
105 run_test(notification_consumer_wrapper_test_env,
107 # 'service_notification_cpp-wrapper_unittest_notification_consumer_wrapper_test.memcheck',
108 'service/notification/cpp-wrapper/unittest/notification_consumer_wrapper_test')
109 run_test(notification_provider_wrapper_test_env,
111 # 'service_notification_cpp-wrapper_unittest_notification_provider_wrapper_test.memcheck',
112 'service/notification/cpp-wrapper/unittest/notification_provider_wrapper_test')