Well, the solution I have working right now is to assume the file is stored 
under /tmp, and if not there, search for it and copy it to /tmp.
/Carl

-----Original Message-----
From: Lennart Lund 
Sent: den 26 september 2013 16:27
To: Hans Feldt; Carl Johannesson; [email protected]
Cc: [email protected]
Subject: RE: [devel] [PATCH 1 of 1] ntf/test: use stat on 
ntfsv_test_classes.xml before immcfg [#575]

I agree with Hans. It's a good idea to use a config file. This file can contain 
a predefined path to a place to put the test classes xml file. This gives the 
user an option to either copy the xml file to the predefined path (documented 
in the README file) or if that's not suitable change the path.

Thanks'
Lennart

> -----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

Reply via email to