Fix build issue about unittest and cloud interface
authorch79.cho <ch79.cho@samsung.com>
Thu, 18 Aug 2016 13:43:03 +0000 (22:43 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 19 Aug 2016 01:25:53 +0000 (01:25 +0000)
When notification service unittest build with '-Wl, --as-needed' LDFLAGS,
some build machine returns build fail.(this flag is default option.)
The default of passing --as-needed can be undone by passing --no-as-needed to the linker.
So, 'Wl, --no-as-needed' flag is added in notification unittest SConscript.

CloudPublish is removed, because it is not used by sample application.

Change-Id: Ibeeb0ec60d80da1e216c43ba635e2efc0f193b7e
Signed-off-by: ch79.cho <ch79.cho@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10627
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/examples/linux/cloud_connector.c
service/notification/unittest/SConscript

index 1312ff3..9f09bd3 100644 (file)
@@ -152,141 +152,3 @@ OCStackResult OCCloudLogout(const char *host, const char *auth_session,
 {
     return OCCloudLoginout(host, DEFAULT_AUTH_LOGOUT, auth_session, response);
 }
-
-OCStackResult OCCloudPublish(const char *host, const char *query,
-                             OCClientResponseHandler response, int numArg, ...)
-{
-    char    targetUri[MAX_URI_LENGTH * 2] = { 0, };
-    snprintf(targetUri, MAX_URI_LENGTH * 2, "%s%s", host, query);
-
-    // Gather all resources locally and do publish
-    OCCallbackData cbData;
-    memset(&cbData, 0, sizeof(OCCallbackData));
-    cbData.cb = response;
-    cbData.cd = NULL;
-    cbData.context = (void *)DEFAULT_CONTEXT_VALUE;
-
-    OCTagsPayload *tagsPayload = NULL;
-    OCLinksPayload *linksPayload = NULL;
-    OCStringLL *rt = NULL;
-    OCStringLL *itf = NULL;
-    OCStringLL *mt = NULL;
-
-    OCRDPayload *rdPayload = OCRDPayloadCreate();
-    if (!rdPayload)
-    {
-        goto no_memory;
-    }
-
-    const unsigned char *id = (unsigned char *)OCGetServerInstanceIDString();
-    tagsPayload = OCCopyTagsResources(NULL, id,
-                                      NULL, OC_DISCOVERABLE, 0, 0, NULL, NULL, OC_RD_PUBLISH_TTL);
-    if (!tagsPayload)
-    {
-        goto no_memory;
-    }
-
-    va_list arguments;
-    va_start(arguments, numArg);
-
-    for (int j = 0; j < numArg; j++)
-    {
-        OCResourceHandle handle = va_arg(arguments, OCResourceHandle);
-        if (handle)
-        {
-            rt = itf = mt = NULL;
-            const char *uri = OCGetResourceUri(handle);
-            uint8_t numElement;
-            if (OC_STACK_OK == OCGetNumberOfResourceTypes(handle, &numElement))
-            {
-                OCStackResult res = createStringLL(numElement, handle, OCGetResourceTypeName, &rt);
-                if (res != OC_STACK_OK || !rt)
-                {
-                    goto no_memory;
-                }
-            }
-
-            if (OC_STACK_OK == OCGetNumberOfResourceInterfaces(handle, &numElement))
-            {
-                OCStackResult res = createStringLL(numElement, handle, OCGetResourceInterfaceName, &itf);
-                if (res != OC_STACK_OK || !itf)
-                {
-                    goto no_memory;
-                }
-            }
-
-            mt = (OCStringLL *)OICCalloc(1, sizeof(OCStringLL));
-            if (!mt)
-            {
-                goto no_memory;
-            }
-            mt->value = OICStrdup("application/cbor");
-            if (!mt->value)
-            {
-                goto no_memory;
-            }
-
-            if (!linksPayload)
-            {
-                linksPayload = OCCopyLinksResources(uri, rt, itf, NULL, 0, NULL,
-                                                    NULL, j, mt);;
-                if (!linksPayload)
-                {
-                    goto no_memory;
-                }
-            }
-            else
-            {
-                OCLinksPayload *temp = linksPayload;
-                while (temp->next)
-                {
-                    temp = temp->next;
-                }
-                temp->next = OCCopyLinksResources(uri, rt, itf, NULL, 0, NULL,
-                                                  NULL, j, mt);
-                if (!temp->next)
-                {
-                    goto no_memory;
-                }
-            }
-            OCFreeOCStringLL(rt);
-            OCFreeOCStringLL(itf);
-            OCFreeOCStringLL(mt);
-        }
-    }
-    va_end(arguments);
-
-    rdPayload->rdPublish = OCCopyCollectionResource(tagsPayload, linksPayload);
-    if (!rdPayload->rdPublish)
-    {
-        goto no_memory;
-    }
-
-    return OCDoResource(NULL, OC_REST_POST, targetUri, NULL, (OCPayload *)rdPayload,
-                        CT_ADAPTER_TCP, OC_LOW_QOS, &cbData, NULL, 0);
-
-no_memory:
-    va_end(arguments);
-    if (rt)
-    {
-        OCFreeOCStringLL(rt);
-    }
-    if (itf)
-    {
-        OCFreeOCStringLL(itf);
-    }
-    if (mt)
-    {
-        OCFreeOCStringLL(mt);
-    }
-    if (tagsPayload)
-    {
-        OCFreeTagsResource(tagsPayload);
-    }
-    if (linksPayload)
-    {
-        OCFreeLinksResource(linksPayload);
-    }
-    OCRDPayloadDestroy(rdPayload);
-    return OC_STACK_NO_MEMORY;
-}
index 3c77952..e089f42 100644 (file)
@@ -59,6 +59,8 @@ notification_test_env.AppendUnique(LIBS = [
 if target_os not in ['windows', 'winrt']:
     notification_test_env.AppendUnique(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'])
 
@@ -89,4 +91,4 @@ if env.get('TEST') == '1':
     if target_os == 'linux':
             from tools.scons.RunTest import *
             run_test(notification_consumer_test_env, '', 'service/notification/unittest/notification_consumer_test')
-            run_test(notification_provider_test_env, '', 'service/notification/unittest/notification_provider_test')
\ No newline at end of file
+            run_test(notification_provider_test_env, '', 'service/notification/unittest/notification_provider_test')