# // limitations under the License.
# //
# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-Import('env')
import os
import os.path
-sptest_env = env.Clone()
+# SConscript file for Local PKI google tests
+gtest_env = SConscript('#extlibs/gtest/SConscript')
+sptest_env = gtest_env.Clone()
src_dir = sptest_env.get('SRC_DIR')
+target_os = sptest_env.get('TARGET_OS')
######################################################################
# Build flags
######################################################################
sptest_env.PrependUnique(CPPPATH = [
- '../../../connectivity/inc',
- '../../../connectivity/api',
+ '../include',
'../../include',
- '../../../../../extlibs/tinydtls',
'../include/internal',
+ '../../../stack/include',
+ '../../../ocrandom/include',
'../../../logger/include',
'../../../stack/include',
+ '../../../security/include',
+ '../../../security/include/internal',
+ '../../../security/provisioning/include/internal',
'../../../../oc_logger/include',
- '../../../../../extlibs/gtest/gtest-1.7.0/include',
- '../include'
+ '../include/oxm',
+ '../../../../../extlibs/tinydtls',
+ '../../../../../extlibs/cjson',
+ '../../../../../extlibs/base64',
+ '../../../connectivity/inc',
+ '../../../connectivity/common/inc',
+ '../../../connectivity/lib/libcoap-4.1.1',
+ '../../../connectivity/api',
+ '../../../../../extlibs/tinydtls'
])
-sptest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
-sptest_env.AppendUnique(LIBS = ['-lpthread'])
-sptest_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-sptest_env.AppendUnique(LIBPATH = [src_dir + '/extlibs/gtest/gtest-1.7.0/lib/.libs'])
-sptest_env.PrependUnique(LIBS = [ 'ocspapi',
+sptest_env.AppendUnique(LIBPATH = [sptest_env.get('BUILD_DIR')])
+sptest_env.PrependUnique(LIBS = [ 'ocpmapi',
+ 'oc',
'ocsrm',
'octbstack',
'oc_logger',
'gtest',
'gtest_main'])
-if env.get('SECURED') == '1':
+if sptest_env.get('SECURED') == '1':
sptest_env.AppendUnique(LIBS = ['tinydtls'])
-if not env.get('RELEASE'):
+if sptest_env.get('DTLS_WITH_X509') == '1':
+ sptest_env.AppendUnique(LIBS = ['CKManager'])
+ sptest_env.AppendUnique(LIBS = ['asn1'])
+
+if not sptest_env.get('RELEASE'):
sptest_env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+if target_os not in ['msys_nt', 'windows']:
+ sptest_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+ sptest_env.AppendUnique(LIBS = ['dl', 'pthread'])
+
######################################################################
# Source files and Targets
######################################################################
-unittest = sptest_env.Program('unittest', ['provisioningmanager.cpp'])
+unittest = sptest_env.Program('unittest', ['pmutilitytest.cpp',
+ 'secureresourceprovider.cpp',
+ 'provisioningdatabasemanager.cpp',
+ 'ocprovisioningmanager.cpp', 'otmunittest.cpp',
+ 'credentialgeneratortest.cpp' ])
+
+sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
+sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
+
+provisioning_unittest_src_dir = src_dir + '/resource/csdk/security/provisioning/unittest/'
+provisioning_unittest_build_dir = sptest_env.get('BUILD_DIR') +'/resource/csdk/security/provisioning/unittest/'
+
+Alias("test", [unittest, sample_server1, sample_server2])
-Alias("test", [unittest])
-env.AppendTarget('test')
-if env.get('TEST') == '1':
- target_os = env.get('TARGET_OS')
- if target_os == 'linux':
- out_dir = env.get('BUILD_DIR')
- result_dir = env.get('BUILD_DIR') + '/test_out/'
+sptest_env.AppendTarget('test')
+if sptest_env.get('TEST') == '1':
+ if target_os in ['linux']:
+ out_dir = sptest_env.get('BUILD_DIR')
+ result_dir = os.path.join(sptest_env.get('BUILD_DIR'), 'test_out') + os.sep
if not os.path.isdir(result_dir):
os.makedirs(result_dir)
sptest_env.AppendENVPath('GTEST_OUTPUT', ['xml:'+ result_dir])
sptest_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
- sptest_env.AppendENVPath('LD_LIBRARY_PATH', ['./extlibs/gtest/gtest-1.7.0/lib/.libs'])
- ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/unittest/unittest')
+ sptest_env.AppendENVPath('PATH', sptest_env.get('BUILD_DIR'))
+ ut = sptest_env.Command ('ut', None, out_dir + '/resource/csdk/security/provisioning/unittest/unittest')
AlwaysBuild ('ut')