Of course you can hardcode it but then in a location where "make install" has put it. That would just be a change in Makefile.am. You should not have a hardcoded path which is not specified by FHS. /Hans
On 09/26/2013 10:13 AM, Carl Johannesson wrote: > Well, I certainly don't agree, the problem is that we hardcode too little and > parameterize too much. > The intelligent way is to hardcode as much as possible and avoid pointless > environment variables. > Of course I could parameterize this, but is it really worth the effort? > /Carl > > -----Original Message----- > From: Hans Feldt > Sent: den 26 september 2013 09:56 > To: Carl Johannesson; Lennart Lund; [email protected] > Cc: [email protected] > Subject: Re: [devel] [PATCH 1 of 1] ntf/test: use stat on > ntfsv_test_classes.xml before immcfg [#575] > > Nack. > > The hardcoded path needs to be removed completely! A test program should not > require a special environment. Aim for making it portable instead. > > I suggest you either specify the file as a program parameter and/or use an > environment variable that specifies the location of the file. > > Thanks, > Hans > > > On 09/26/2013 09:45 AM, Carl Johannesson wrote: >> tests/ntfsv/test_ntf_imcn.c | 15 +++++++++------ >> 1 files changed, 9 insertions(+), 6 deletions(-) >> >> >> Do not use a negative response from immcfg as an implicit method to >> find the ntfsv_test_classes.xml file. A negative command response is >> interpreted by the test framework as if the whole test case failed. >> Instead, use stat() to check if the file is located in the most >> probable place, then proceed with immcfg, and if not found then try >> the alternative location. >> >> diff --git a/tests/ntfsv/test_ntf_imcn.c b/tests/ntfsv/test_ntf_imcn.c >> --- a/tests/ntfsv/test_ntf_imcn.c >> +++ b/tests/ntfsv/test_ntf_imcn.c >> @@ -4259,13 +4259,16 @@ void objectDeleteTest_3404(void) >> >> __attribute__((constructor)) static void >> notificationFilterVerification_constructor(void) >> { >> - int rc = system("immcfg -f >> //hostfs//repl-opensaf//ntfsv_test_classes.xml"); >> + struct stat buf; >> + int rc = 0; >> + if (stat("//hostfs//ntfsv_test_classes.xml", &buf) == 0) { >> + rc = system("immcfg -f //hostfs//ntfsv_test_classes.xml"); >> + } else { >> + rc = system("immcfg -f >> //hostfs//repl-opensaf//ntfsv_test_classes.xml"); >> + } >> if (rc != 0) { >> - rc = system("immcfg -f //hostfs//ntfsv_test_classes.xml"); >> - if (rc != 0) { >> - printf("ntfsv_test_classes.xml file not installed (see >> README)"); >> - return; >> - } >> + printf("ntfsv_test_classes.xml file not installed (see README)"); >> + return; >> } >> test_suite_add(32, "CM notifications test"); >> test_case_add(32, objectCreateTest_01, "CREATE, runtime >> (OsafNtfCmTestRT) object"); >> >> ---------------------------------------------------------------------- >> -------- October Webinars: Code for Performance Free Intel webinars >> can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the >> most from the latest Intel processors and coprocessors. See abstracts >> and register > >> http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.c >> lktrk _______________________________________________ >> Opensaf-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/opensaf-devel >> >> > > ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
