Merge branch '1.3-rel' (112a21c5) 29/21129/7
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 30 Jun 2017 17:49:57 +0000 (19:49 +0200)
committerPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 30 Jun 2017 18:55:15 +0000 (20:55 +0200)
Conflicts:
  auto_build.py
  build_common/SConscript
  build_common/android/SConscript
  build_common/arduino/SConscript
  build_common/windows/SConscript
  extlibs/gtest/SConscript
  resource/c_common/SConscript
  resource/c_common/unittests/SConscript
  resource/csdk/connectivity/build/android/SConscript
  resource/csdk/connectivity/src/SConscript
  resource/csdk/connectivity/test/SConscript
  resource/csdk/security/SConscript
  resource/csdk/security/provisioning/unittest/SConscript
  resource/csdk/security/provisioning/unittest/otmunittest.cpp
  resource/csdk/security/provisioning/unittest/sampleserver2.cpp
  resource/csdk/security/unittest/base64tests.cpp
  resource/csdk/stack/SConscript
  resource/csdk/stack/samples/tizen/build/SConscript
  resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
  resource/csdk/stack/samples/tizen/build/scons/SConscript
  resource/csdk/stack/test/SConscript
  run.bat
  service/easy-setup/mediator/richsdk/unittests/SConscript
  service/notification/cpp-wrapper/unittest/SConscript
  service/notification/unittest/SConscript
  service/resource-container/unittests/SConscript
  service/resource-encapsulation/src/common/SConscript
  service/resource-encapsulation/src/common/primitiveResource/unittests/SConscript
  service/resource-encapsulation/src/serverBuilder/SConscript
  service/resource-encapsulation/unittests/SConscript
  service/third_party_libs.scons

Bug: https://jira.iotivity.org/browse/IOT-2453
Change-Id: Ic7d9c3881bf50102a1acccc60262c9545de468ad
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
28 files changed:
1  2 
auto_build.py
build_common/android/SConscript
build_common/arduino/SConscript
build_common/windows/SConscript
extlibs/libcoap/SConscript
resource/IPCA/SConscript
resource/IPCA/unittests/SConscript
resource/c_common/SConscript
resource/csdk/connectivity/SConscript
resource/csdk/connectivity/build/android/SConscript
resource/csdk/connectivity/test/SConscript
resource/csdk/resource-directory/src/rd_client.c
resource/csdk/resource-directory/src/rd_server.c
resource/csdk/security/provisioning/src/multipleownershiptransfermanager.c
resource/csdk/security/provisioning/src/ownershiptransfermanager.c
resource/csdk/security/provisioning/unittest/SConscript
resource/csdk/security/provisioning/unittest/otmunittest.cpp
resource/csdk/security/provisioning/unittest/sampleserver.cpp
resource/csdk/security/src/credresource.c
resource/csdk/stack/include/ocpayload.h
resource/csdk/stack/samples/linux/SimpleClientServer/ocserver.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocservercoll.cpp
resource/csdk/stack/samples/linux/SimpleClientServer/ocserverslow.cpp
resource/src/InProcServerWrapper.cpp
service/notification/unittest/SConscript
service/resource-encapsulation/src/common/primitiveResource/unittests/PrimitiveResourceTest.cpp
service/resource-encapsulation/src/serverBuilder/SConscript
service/resource-encapsulation/unittests/SConscript

diff --cc auto_build.py
Simple merge
@@@ -160,39 -162,35 +162,36 @@@ for flags in p.stdout.readlines()
          env.Replace(AR=prefix + 'ar')
          env.Replace(RANLIB=prefix + 'ranlib')
  
-     elif cmp(flags[0:7], 'CFLAGS=') == 0:
-         env.AppendUnique(CFLAGS=Split(flags[7:]))
 +
-     elif cmp(flags[0:9], 'CXXFLAGS=') == 0:
-         env.AppendUnique(CXXFLAGS=Split(flags[9:]))
+     elif flags.startswith('CFLAGS='):
+         env.AppendUnique(CFLAGS=Split(flags.replace('CFLAGS=', '')))
+     elif flags.startswith('CXXFLAGS='):
+         env.AppendUnique(CXXFLAGS=Split(flags.replace('CXXFLAGS=', '')))
  
-     elif cmp(flags[0:8], 'CPPPATH=') == 0:
+     elif flags.startswith('CPPPATH='):
          ndk_arch = 'arch-'
-         if cmp(target_arch, 'x86') == 0:
+         if target_arch in ['x86']:
              ndk_arch += 'x86'
-         elif cmp(target_arch, 'x86_64') == 0:
+         elif target_arch in ['x86_64']:
              ndk_arch += 'x86_64'
-         elif cmp(target_arch, 'armeabi') == 0:
-             ndk_arch += 'arm'
-         elif cmp(target_arch, 'armeabi-v7a') == 0:
-             ndk_arch += 'arm'
-         elif cmp(target_arch, 'armeabi-v7a-hard') == 0:
+         elif target_arch in ['armeabi', 'armeabi-v7a', 'armeabi-v7a-hard']:
              ndk_arch += 'arm'
-         elif cmp(target_arch, 'arm64-v8a') == 0:
+         elif target_arch in ['arm64-v8a']:
              ndk_arch += 'arm64'
  
-         env.AppendUnique(CPPPATH = android_ndk + '/platforms/android-21/' + ndk_arch + '/usr/include')
-         env.AppendUnique(CPPPATH = Split(flags[8:]))
+         env.AppendUnique(CPPPATH=android_ndk + '/platforms/android-21/' + ndk_arch + '/usr/include')
+         env.AppendUnique(CPPPATH=Split(flags.replace('CPPPATH=', '')))
  
-     elif cmp(flags[0:8], 'SYSROOT=') == 0:
-         sysroot = flags[8:].strip()
+     elif flags.startswith('SYSROOT='):
+         sysroot = flags.replace('SYSROOT=', '').strip()
          env.AppendUnique(LINKFLAGS=['--sysroot=' + sysroot])
  
-     elif cmp(flags[0:8], 'LDFLAGS=') == 0:
-         env.AppendUnique(LINKFLAGS=Split(flags[8:]))
+     elif flags.startswith('LDFLAGS='):
+         env.AppendUnique(LINKFLAGS=Split(flags.replace('LDFLAGS=', '')))
  
-     elif cmp(flags[0:7], 'TC_VER=') == 0:  # set gnustl library path
-         ver = flags[7:].strip()
+     elif flags.startswith('TC_VER='):  # set gnustl library path
+         ver = flags.replace('TC_VER=', '').strip()
          stl_path = android_ndk + '/sources/cxx-stl/gnu-libstdc++/' + ver + '/libs/' + target_arch
          #if target_arch in ['armeabi', 'armeabi-v7a', 'armeabi-v7a-hard']:
          #    stl_path = stl_path + '/thumb/'
Simple merge
Simple merge
Simple merge
@@@ -27,11 -27,8 +27,8 @@@ Import('env'
  
  ipca_env = env.Clone()
  
- if ipca_env['CC'] == 'cl':
-     ipca_env.AppendUnique(CCFLAGS=['/W4'])
  # c_common calls into mbedcrypto and ipca calls into c_common
 -ipca_env.AppendUnique(LIBS = ['mbedcrypto'])
 +ipca_env.AppendUnique(LIBS=['mbedcrypto'])
  
  # Build ipca lib
  SConscript('src/SConscript', 'ipca_env')
@@@ -29,11 -28,7 +29,8 @@@ Import('test_env'
  ipcatest_env = test_env.Clone()
  src_dir = ipcatest_env.get('SRC_DIR')
  target_os = ipcatest_env.get('TARGET_OS')
 +with_cloud = ipcatest_env.get('WITH_CLOUD')
  
- if ipcatest_env['CC'] == 'cl':
-     ipcatest_env.AppendUnique(CCFLAGS=['/W4'])
  ######################################################################
  # Build flags
  ######################################################################
@@@ -226,9 -216,10 +219,13 @@@ common_env.AppendUnique(CPPPATH=['#reso
  commonlib = common_env.StaticLibrary('c_common', common_src)
  common_env.InstallTarget(commonlib, 'c_common')
  common_env.UserInstallTargetLib(commonlib, 'c_common')
- common_env.UserInstallTargetHeader('iotivity_commontypes.h', 'c_common', 'iotivity_commontypes.h')
- common_env.UserInstallTargetHeader('iotivity_debug.h', 'c_common', 'iotivity_debug.h')
- common_env.UserInstallTargetHeader('platform_features.h', 'c_common', 'platform_features.h')
++
++common_env.UserInstallTargetHeader(
++    'iotivity_commontypes.h', 'c_common', 'iotivity_commontypes.h')
+ common_env.UserInstallTargetHeader(
+     'iotivity_debug.h', 'c_common', 'iotivity_debug.h')
+ common_env.UserInstallTargetHeader(
+     'platform_features.h', 'c_common', 'platform_features.h')
  
  Clean(commonlib, config_h_file_path)
  
Simple merge
@@@ -186,6 -189,6 +190,7 @@@ if env.get('SECURED') == '1'
  # If we add those flags to CFLAGS or CCFLAGS, scons will also apply them
  # to building objects for shared libraries.
  # The workaround chosen here is to rewrite the cc/cxx build rule
 +# Also notice the code doesn't match the comment (no -pie option)
  env.Replace(CCCOM='$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM -fPIE $SOURCES')
  env.Replace(CXXCOM='$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM -fPIE $SOURCES')
+ env.Replace(LINKCOM='$LINK -o $TARGET -pie $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS')
@@@ -88,13 -81,10 +88,10 @@@ if 'SERVER' in rd_mode
      if target_os in ['linux', 'tizen']:
          catest_env.ParseConfig('pkg-config --cflags --libs sqlite3')
      elif target_os in ['msys_nt', 'windows']:
 -        catest_env.PrependUnique(LIBS = ['sqlite3'])
 +        catest_env.PrependUnique(LIBS=['sqlite3'])
  
  if target_os not in ['msys_nt', 'windows']:
-     catest_env.AppendUnique(LIBS=['m'])
- else:
-     catest_env.AppendUnique(CCFLAGS=['/W4'])
+     catest_env.AppendUnique(LIBS = ['m'])
  ######################################################################
  # Source files and Targets
  ######################################################################
@@@ -35,28 -131,29 +131,29 @@@ def run_test(target, source, env)
  ######################################################################
  with_upstream_libcoap = sptest_env.get('WITH_UPSTREAM_LIBCOAP')
  if with_upstream_libcoap == '1':
 -      sptest_env.AppendUnique(CPPPATH = ['#extlibs/libcoap/libcoap/include'])
 +    sptest_env.AppendUnique(CPPPATH=['#extlibs/libcoap/libcoap/include'])
  else:
 -      sptest_env.AppendUnique(CPPPATH = ['../../../connectivity/lib/libcoap-4.1.1/include'])
 -
 -sptest_env.PrependUnique(CPPPATH = [
 -              '../include',
 -              '../../include',
 -              '../include/internal',
 -              '../../../include',
 -              '../../../ocrandom/include',
 -              '../../../logger/include',
 -              '../../../stack/include',
 -              '../../../security/include',
 -              '../../../security/include/internal',
 -              '../../../security/provisioning/include/internal',
 -              '../../../../oc_logger/include',
 -              '../include/oxm',
 -              '../../../../../extlibs/base64',
 -              '../../../connectivity/inc',
 -              '../../../connectivity/inc/pkix',
 -              '../../../connectivity/common/inc',
 -              '../../../connectivity/api'
 -              ])
 +    sptest_env.AppendUnique(CPPPATH=['../../../connectivity/lib/libcoap-4.1.1/include'])
 +
 +sptest_env.PrependUnique(CPPPATH=[
 +    '../include',
 +    '../../include',
-     '../include/internal', '../../../include',
++    '../include/internal',
++     '../../../include',
 +    '../../../ocrandom/include',
 +    '../../../logger/include',
 +    '../../../stack/include',
 +    '../../../security/include',
 +    '../../../security/include/internal',
 +    '../../../security/provisioning/include/internal',
 +    '../../../../oc_logger/include',
 +    '../include/oxm',
 +    '../../../../../extlibs/base64',
 +    '../../../connectivity/inc',
 +    '../../../connectivity/inc/pkix',
 +    '../../../connectivity/common/inc',
 +    '../../../connectivity/api'
 +])
  
  sptest_env.PrependUnique(LIBS=[
      'ocpmapi_internal',
@@@ -92,37 -188,20 +189,21 @@@ else
  ######################################################################
  # Source files and Targets
  ######################################################################
- unittest_src = [
-     'pmutilitytest.cpp',
-     'secureresourceprovider.cpp',
-     'provisioningdatabasemanager.cpp',
-     'ocprovisioningmanager.cpp',
-     'credentialgeneratortest.cpp',
- ]
- if target_os not in ['windows']:
-     unittest_src += ['otmunittest.cpp']
 +
- unittest = sptest_env.Program('unittest', unittest_src)
+ unittest_src = ['pmutilitytest.cpp',
+                 'secureresourceprovider.cpp',
+                 'provisioningdatabasemanager.cpp',
+                 'ocprovisioningmanager.cpp',
+                 'credentialgeneratortest.cpp',
+                 'otmunittest.cpp'
+                 ]
  
- if target_os not in ['windows']:
-     sample_server1 = sptest_env.Program('sample_server1', ['sampleserver1.cpp'])
-     sample_server2 = sptest_env.Program('sample_server2', ['sampleserver2.cpp'])
-     Alias("test", [sample_server1, sample_server2])
+ tests = sptest_env.Program(unittest_bin, unittest_src)
+ server = sptest_env.Program(server_bin, ['sampleserver.cpp'])
  
- Alias("test", [unittest])
+ Alias('build', [tests, server])
  
- sptest_env.AppendTarget('test')
- # TODO: fix test for all supported configurations
- if sptest_env.get('TEST') == '1' and sptest_env.get('SECURED') != '1':
+ if sptest_env.get('TEST') == '1':
      if target_os in ['linux', 'windows']:
-         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('PATH', sptest_env.get('BUILD_DIR'))
-         run_test(sptest_env,
-                  'resource_csdk_security_provisioning_unittest.memcheck',
-                  'resource/csdk/security/provisioning/unittest/unittest')
+         print "Start tests"
+         sptest_env.Command('start', [server_bin, unittest_bin], Action(run_test))
@@@ -19,8 -19,7 +19,7 @@@
   * *****************************************************************/
  #include <stdio.h>
  #include <stdlib.h>
- #include <unistd.h>
 -#include "gtest/gtest.h"
 +#include <gtest/gtest.h>
  #include "ocstack.h"
  #include "utlist.h"
  #include "logger.h"
Simple merge
@@@ -66,7 -66,8 +66,6 @@@ if target_os not in ['windows', 'winrt'
          CXXFLAGS=['-O2', '-g', '-Wall', '-fmessage-length=0', '-std=c++0x'])
  
  notification_test_env.AppendUnique(LINKFLAGS=['-Wl,--no-as-needed'])
 -
--
  notification_test_env.AppendUnique(CXXFLAGS=['-pthread'])
  notification_test_env.AppendUnique(LIBS=['pthread'])
  
@@@ -99,9 -99,10 +99,11 @@@ else
  ######################################################################
  if target_os in ['linux']:
      server_builder_test_env = server_builder_env.Clone()
-     server_builder_test_env.AppendUnique(
-         CPPPATH=['#/extlibs/hippomocks/hippomocks', '../common/utils/include'])
 +
+     server_builder_test_env.AppendUnique(CPPPATH=[
+         '#/extlibs/hippomocks/hippomocks',
+         '../common/utils/include'
+ ])
  
      if server_builder_test_env.get('SECURED') == '1':
          server_builder_test_env.AppendUnique(