Hi, I took a pattern with locking/unlocking nodes from other CLM tests, but I removed assert. The reason for removing assert is that lock and unlock node functions are there only to ensure that the testing node is in a correct state. If it's not, the test will fail. So, assert is not needed, and will not abort CLM test.
We can create a macro with Hans proposal and use it when system() is called. Thanks, Zoran -----Original Message----- From: Hans Nordebäck Sent: den 31 augusti 2016 13:33 To: Mathivanan Naickan Palanivelu; Venkata Mahesh Alla; Zoran Milinkovic Cc: opensaf-devel@lists.sourceforge.net Subject: Re: [devel] staging changeset: 7982 with gcc version 4.8.3 build failed Hi, I looked further down in this mail and noticed the build problem, if a function is declared with e.g: int foo() __attribute__ ((__warn_unused_result__)); and called: foo(); then compiling with -Wall will result in the warning/error, but: if (foo()) {} should solve the build problem/HansN On 08/31/2016 12:10 PM, Mathivanan Naickan Palanivelu wrote: > Iam looking into this. > > Thanks, > Mathi. > >> -----Original Message----- >> From: A V Mahesh >> Sent: Tuesday, August 30, 2016 2:10 PM >> To: Hans Nordebäck; Zoran Milinkovic >> Cc: opensaf-devel@lists.sourceforge.net >> Subject: Re: [devel] staging changeset: 7982 with gcc version 4.8.3 >> build failed >> >> Hi HansN, >> >> Thanks for the point , Zoran Milinkovic owner this code, jut to >> unblock the build issue, as workaround I pushed it , I will fw this comment >> to him. >> >> Zoran Milinkovic, >> >> Can you please incorporate the comment. >> >> -AVM >> >> On 8/30/2016 1:08 PM, Hans Nordebäck wrote: >>> Hi Mahesh, >>> >>> One question/comment below. /Thanks HansN >>> >>> -----Original Message----- >>> From: A V Mahesh [mailto:mahesh.va...@oracle.com] >>> Sent: den 30 augusti 2016 08:09 >>> To: praveen malviya <praveen.malv...@oracle.com>; >>> opensaf-devel@lists.sourceforge.net >>> Subject: Re: [devel] staging changeset: 7982 with gcc version 4.8.3 >>> build failed >>> >>> Ok, >>> >>> I just pushed >>> >>> changeset: 7989:4d6caf6903cd >>> tag: tip >>> user: A V Mahesh <mahesh.va...@oracle.com> >>> date: Tue Aug 30 11:05:31 2016 +0530 >>> summary: clm: test code build fix [#1906] >>> >>> -AVM >>> >>> On 8/30/2016 11:28 AM, praveen malviya wrote: >>>> Hi Mahesh, >>>> >>>> I think this patch can be pushed as a workaround patch. Any >>>> improvement on it can be taken up by CLM maintainers post FC tag. >>>> >>>> Thanks, >>>> Praveen >>>> >>>> On 30-Aug-16 11:17 AM, A V Mahesh wrote: >>>>> Hi Zoran Milinkovic, >>>>> >>>>> If below changes ok , we can push directly. >>>>> >>>>> >> ========================================================== >> ========== >>>>> = >>>>> ====== >>>>> >>>>> diff --git a/tests/clmsv/tet_ClmLongRdn.c >>>>> b/tests/clmsv/tet_ClmLongRdn.c >>>>> --- a/tests/clmsv/tet_ClmLongRdn.c >>>>> +++ b/tests/clmsv/tet_ClmLongRdn.c >>>>> @@ -188,19 +188,21 @@ static SaClmCallbacksT_4 clmCallback4 = >>>>> static SaClmCallbacksT clmCallback = { nodeGetCallBack, >>>>> clmTrackCallback }; >>>>> >>>>> static void unlock_node(char *nodename) { >>>>> + int rc; >>>>> char command[1024]; >>>>> >>>>> // Unlock the node >>>>> sprintf(command, "immadm -o 1 %s", nodename); >>>>> - system(command); >>>>> + assert(rc = system(command) != -1); >>> [HansN] >>> I know this is test code but side effects in asserts is to be >>> avoided, but, >> shouldn't the code be like: >>> rc = system(command); >>> int status = WEXITSTATUS(rc); >>> osaf_assert(status != SA_AIS_OK); ? >>> >>>>> + >>>>> } >>>>> >>>>> static void lock_node(char *nodename) { >>>>> + int rc; >>>>> char command[1024]; >>>>> - >>>>> // Lock the node >>>>> sprintf(command, "immadm -o 2 %s", nodename); >>>>> - system(command); >>>>> + assert(rc = system(command) != -1); >>>>> } >>>>> >>>>> static void remove_node(char *nodename) { @@ -209,7 +211,7 @@ >>>>> static void remove_node(char *nodename) >>>>> >>>>> // Lock the node >>>>> sprintf(command, "immadm -o 2 %s", nodename); >>>>> - system(command); >>>>> + assert(rc = system(command) != -1); >>>>> >>>>> // Remove the node >>>>> sprintf(command, "immcfg -d %s", nodename); >>>>> >> ========================================================== >> ========== >>>>> = >>>>> ====== >>>>> >>>>> >>>>> -AVM >>>>> >>>>> On 8/30/2016 10:46 AM, A V Mahesh wrote: >>>>>> Hi All, >>>>>> >>>>>> I just build http://hg.code.sf.net/p/opensaf/staging with >>>>>> following changeset as sanity test >>>>>> >>>>>> it build failed with . >>>>>> >>>>>> changeset: 7982:106230d848a6 >>>>>> tag: tip >>>>>> parent: 7979:aec46cc64cc8 >>>>>> user: Anders Widell <anders.wid...@ericsson.com> >>>>>> date: Mon Aug 29 19:29:55 2016 +0200 >>>>>> summary: uml: Update the UML environment [#1979] >>>>>> >>>>>> >> ========================================================== >> ========= >>>>>> = >>>>>> =============== >>>>>> >>>>>> >>>>>> /gcc -DHAVE_CONFIG_H -I. -I../.. -DSA_CLM_B01=1 -I../.. >>>>>> -I../../osaf/libs/saf/include -I../../osaf/libs/core/include >>>>>> -I../../osaf/libs/core/leap/include >>>>>> -I../../osaf/libs/core/mds/include >>>>>> -I../../osaf/libs/core/common/include >>>>>> -I../../osaf/libs/core/cplusplus -I../../tests/unit_test_fw/inc >>>>>> -std=gnu11 -Wall -fno-strict-aliasing -Werror -fPIC >>>>>> -D_FORTIFY_SOURCE=2 -fstack-protector - >> DINTERNAL_VERSION_ID='""' >>>>>> -O2 -g -m64 -fmessage-length=0 >>>>>> -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables >>>>>> -fasynchronous-unwind-tables -MT clmtest-tet_ClmLongRdn.o -MD - >> MP >>>>>> -MF .deps/clmtest-tet_ClmLongRdn.Tpo -c -o clmtest- >> tet_ClmLongRdn.o >>>>>> `test -f 'tet_ClmLongRdn.c' || echo './'`tet_ClmLongRdn.c >>>>>> tet_ClmLongRdn.c: In function ‘lock_node’: >>>>>> tet_ClmLongRdn.c:203:8: error: ignoring return value of >>>>>> ‘system’, declared with attribute warn_unused_result [- >> Werror=unused-result] >>>>>> system(command); >>>>>> ^ >>>>>> tet_ClmLongRdn.c: In function ‘unlock_node’: >>>>>> tet_ClmLongRdn.c:195:8: error: ignoring return value of >>>>>> ‘system’, declared with attribute warn_unused_result [- >> Werror=unused-result] >>>>>> system(command); >>>>>> ^ >>>>>> tet_ClmLongRdn.c: In function ‘remove_node’: >>>>>> tet_ClmLongRdn.c:212:8: error: ignoring return value of >>>>>> ‘system’, declared with attribute warn_unused_result [- >> Werror=unused-result] >>>>>> system(command); >>>>>> ^ >>>>>> cc1: all warnings being treated as errors >>>>>> make[3]: *** [clmtest-tet_ClmLongRdn.o] Error 1 >>>>>> make[3]: Leaving directory >>>>>> `/avm/staging-publish/rpms/BUILD/opensaf-5.1.M0/tests/clmsv' >>>>>> make[2]: *** [all-recursive] Error 1 >>>>>> make[2]: Leaving directory >>>>>> `/avm/staging-publish/rpms/BUILD/opensaf-5.1.M0' >>>>>> make[1]: *** [all] Error 2 >>>>>> make[1]: Leaving directory >>>>>> `/avm/staging-publish/rpms/BUILD/opensaf-5.1.M0' >>>>>> error: Bad exit status from >>>>>> /avm/staging-publish/rpms/tmp/rpm-tmp.13949 >>>>>> (%build) >>>>>> >>>>>> >>>>>> RPM build errors: >>>>>> Bad exit status from >>>>>> /avm/staging-publish/rpms/tmp/rpm-tmp.13949 >>>>>> (%build) >>>>>> make: *** [rpm] Error 1 >>>>>> SC-1:/avm/staging-publish # / >>>>>> >>>>>> >> ========================================================== >> ========= >>>>>> = >>>>>> =============== >>>>>> >>>>>> >>>>>> -AVM >>>>>> >>>>>> >>>>>> ----------------------------------------------------------------- >>>>>> -- >>>>>> - >>>>>> ---------- >>>>>> >>>>>> _______________________________________________ >>>>>> Opensaf-devel mailing list >>>>>> Opensaf-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel >>>>> ------------------------------------------------------------------ >>>>> -- >>>>> - >>>>> --------- >>>>> >>>>> _______________________________________________ >>>>> Opensaf-devel mailing list >>>>> Opensaf-devel@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel >>>>> >>> -------------------------------------------------------------------- >>> -- >>> -------- _______________________________________________ >>> Opensaf-devel mailing list >>> Opensaf-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel >> >> --------------------------------------------------------------------- >> --------- _______________________________________________ >> Opensaf-devel mailing list >> Opensaf-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel