I suppose you mean the commented out printouts in logtest.c, init_logrootpath(). I will remove.
/Lennart > -----Original Message----- > From: Hans Feldt > Sent: den 4 september 2013 15:27 > To: Lennart Lund; [email protected] > Cc: [email protected] > Subject: RE: [PATCH 1 of 4] logtest: Replace hard coded root path with root > path fetched from log service IMM config object [#541] > > Ack but please remove code commented out /Hans > > > -----Original Message----- > > From: Lennart Lund > > Sent: den 3 september 2013 10:11 > > To: [email protected]; Hans Feldt > > Cc: [email protected] > > Subject: [PATCH 1 of 4] logtest: Replace hard coded root path with > > root path fetched from log service IMM config object [#541] > > > > tests/logsv/Makefile.am | 4 ++- > > tests/logsv/logtest.c | 55 > ++++++++++++++++++++++++++++++++++++++++++++++ > > tests/logsv/logtest.h | 3 +- > > tests/logsv/tet_LogOiOps.c | 28 +++++++++++++++++++---- > > 4 files changed, 83 insertions(+), 7 deletions(-) > > > > > > Testcases must work with different system configurations (#541) part > > 01 > > > > diff --git a/tests/logsv/Makefile.am b/tests/logsv/Makefile.am > > --- a/tests/logsv/Makefile.am > > +++ b/tests/logsv/Makefile.am > > @@ -25,11 +25,13 @@ noinst_HEADERS = \ > > > > logtest_CPPFLAGS = \ > > $(AM_CPPFLAGS) \ > > - -I$(top_srcdir)/tests/unit_test_fw/inc > > + -I$(top_srcdir)/tests/unit_test_fw/inc \ > > + -I$(top_srcdir)/osaf/libs/common/immsv/include > > > > logtest_SOURCES = \ > > $(top_srcdir)/tests/unit_test_fw/src/utest.c \ > > $(top_srcdir)/tests/unit_test_fw/src/util.c \ > > + $(top_srcdir)/osaf/tools/safimm/src/immutil.c \ > > logtest.c \ > > tet_saLogInitialize.c \ > > tet_saLogSelectionObjectGet.c \ > > diff --git a/tests/logsv/logtest.c b/tests/logsv/logtest.c > > --- a/tests/logsv/logtest.c > > +++ b/tests/logsv/logtest.c > > @@ -17,6 +17,11 @@ > > > > #include <sys/time.h> > > #include <unistd.h> > > +#include <limits.h> > > +#include <configmake.h> > > +#include <saImmOm.h> > > +#include <immutil.h> > > +#include <saImm.h> > > > > #include "logtest.h" > > > > @@ -93,16 +98,62 @@ SaLogRecordT genLogRecord = }; > > > > SaVersionT logVersion = {'A', 0x02, 0x01}; > > +SaVersionT immVersion = {'A', 2, 11}; > > SaAisErrorT rc; > > SaLogHandleT logHandle; > > SaLogStreamHandleT logStreamHandle; > > SaLogCallbacksT logCallbacks = {NULL, NULL, NULL}; > > SaSelectionObjectT selectionObject; > > +char log_root_path[PATH_MAX]; > > + > > +void init_logrootpath(void) > > +{ > > + SaImmHandleT omHandle; > > + SaNameT objectName = { > > + .value = "logConfig=1,safApp=safLogService", > > + .length = strlen("logConfig=1,safApp=safLogService") > > + }; > > + SaImmAccessorHandleT accessorHandle; > > + SaImmAttrValuesT_2 *attribute; > > + SaImmAttrValuesT_2 **attributes; > > + SaAisErrorT ais_rc = SA_AIS_OK; > > + const char logRootDirectory_name[] = "logRootDirectory"; > > + SaImmAttrNameT attributeNames[2] = {(char *) > logRootDirectory_name, NULL}; > > + void *value; > > + > > +#if 0 > > + printf("logRootDirectory_name \"%s\"\n",logRootDirectory_name); > > + printf("objectName.value \"%s\"\n",objectName.value); > > + printf("objectName.length = %d\n",objectName.length); #endif > > + > > + /* NOTE: immutil init osaf_assert if error */ > > + (void) immutil_saImmOmInitialize(&omHandle, NULL, > &immVersion); > > + (void) immutil_saImmOmAccessorInitialize(omHandle, > &accessorHandle); > > + > > + /* Get all attributes of the object */ > > + ais_rc = immutil_saImmOmAccessorGet_2(accessorHandle, > &objectName, > > + > attributeNames, &attributes); > > + if (ais_rc == SA_AIS_OK) { > > + attribute = attributes[0]; > > + value = attribute->attrValues[0]; > > + strncpy(log_root_path, *((char **) value), PATH_MAX); > > + } else { > > + /* We didn't get a root path from IMM. Use default */ > > + strncpy(log_root_path, PKGLOGDIR, PATH_MAX); > > + } > > + (void) immutil_saImmOmFinalize(omHandle); > > + > > +#if 0 > > + printf("log_root_path \"%s\"\n\n",log_root_path); #endif } > > > > int main(int argc, char **argv) > > { > > int suite = ALL_SUITES, tcase = ALL_TESTS; > > > > + init_logrootpath(); > > srandom(getpid()); > > > > if (argc > 1) > > @@ -120,6 +171,10 @@ int main(int argc, char **argv) > > test_list(); > > return 0; > > } > > + > > + if (suite == 999) { > > + return 0; > > + } > > > > return test_run(suite, tcase); > > } > > diff --git a/tests/logsv/logtest.h b/tests/logsv/logtest.h > > --- a/tests/logsv/logtest.h > > +++ b/tests/logsv/logtest.h > > @@ -33,7 +33,7 @@ > > #define DEFAULT_APP_LOG_REC_SIZE 128 > > #define DEFAULT_APP_LOG_FILE_SIZE 1024 * 1024 #define > > DEFAULT_FORMAT_EXPRESSION "@Cr @Ch:@Cn:@Cs @Cm/@Cd/@CY > @Sv @Sl \"@Cb\"" > > -#define SA_LOG_STREAM_APPLICATION1 "safLgStr=saLogApplication1" > > +//#define SA_LOG_STREAM_APPLICATION1 "safLgStr=saLogApplication1" > > #define DEFAULT_ALM_LOG_REC_SIZE 1024 #define > DEFAULT_ALM_LOG_BUFFER > > "Alarm stream test" > > #define DEFAULT_NOT_LOG_REC_SIZE 1024 @@ -60,5 +60,6 @@ extern > > SaLogBufferT notificationStreamBu extern SaSelectionObjectT > > selectionObject; extern SaNameT logSvcUsrName; extern SaLogRecordT > > genLogRecord; > > +extern char log_root_path[]; > > > > #endif > > diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c > > --- a/tests/logsv/tet_LogOiOps.c > > +++ b/tests/logsv/tet_LogOiOps.c > > @@ -19,6 +19,7 @@ > > #include <sys/wait.h> > > #include <saImm.h> > > #include <saImmOm.h> > > +#include <limits.h> > > #include "logtest.h" > > > > static SaLogFileCreateAttributesT_2 appStreamLogFileCreateAttributes > > = @@ -44,13 +45,24 @@ void saLogOi_01(void) > > test_validate(WEXITSTATUS(rc), 0); } > > > > +/** > > + * CCB Object Modify saLogStreamPathName, ERR not allowed */ > > void saLogOi_02(void) > > { > > int rc; > > char command[256]; > > + > > + /* Create an illegal path name (log_root_path> cd ../) */ > > + char tststr[PATH_MAX]; > > + char *tstptr; > > + strcpy(tststr,log_root_path); > > + tstptr = strrchr(tststr, '/'); > > + *tstptr = '\0'; > > > > - sprintf(command, "immcfg -a saLogStreamPathName=/var/log %s 2> > /dev/null", > > - SA_LOG_STREAM_ALARM); > > + sprintf(command, "immcfg -a saLogStreamPathName=/%s %s 2> > /dev/null", > > + tststr, > > + SA_LOG_STREAM_ALARM); > > rc = system(command); > > test_validate(WEXITSTATUS(rc), 1); } @@ -597,14 +609,17 @@ void > > saLogOi_47() > > test_validate(WEXITSTATUS(rc), 0); } > > > > +/** > > + * CCB Object Modify, root directory > > + */ > > void saLogOi_48() > > { > > int rc; > > char command[256]; > > - > > - sprintf(command, "mkdir -p /var/log/opensaf/saflog/xxtest"); > > + > > + sprintf(command, "mkdir -p %s/xxtest",log_root_path); > > rc = system(command); > > - sprintf(command, "immcfg -a > logRootDirectory=/var/log/opensaf/saflog/xxtest > logConfig=1,safApp=safLogService"); > > + sprintf(command, "immcfg -a logRootDirectory=%s/xxtest > > + logConfig=1,safApp=safLogService",log_root_path); > > rc = system(command); > > test_validate(WEXITSTATUS(rc), 0); } @@ -655,6 +670,9 @@ static > > int get_filter_cnt_attr(const SaN > > return filter_cnt; > > } > > > > +/** > > + * saflogtest, writing to saLogApplication1, severity filtering check > > +*/ > > void saLogOi_51(void) > > { > > int rc; ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
