Hi!
> > Here you are expecting that the testcase is executed with the working
> > directory is LTPROOT, which may not be the case if somebody adds
> > tst_tmpdir to the test. Let's use
> > LD_LIBRARY_PATH="$LTPROOT/datafiles/:$LD_LIBRARY_PATH" instead.
> >
> > Otherwise the auto detection is really nice to have. Maybe we can do
> > this even better and add a LTP_DATAROOT to test.sh which will
> > automatically point to a directory with the datafiles. If we define that
> > datafiles must be stored in subdirectory named 'datafiles' we can just
> > set the variable in test.sh and then do just:
> >
> > export LD_LIBRARY_PATH="$LTP_DATAROOT:$LD_LIBRARY_PATH"
> >
> > in the testcase. What do you think?
>
> I think it's good idea - then we can avoid doing that in every testcase.
> Is this close to what you had in mind?
Yes, a few comments below.
> diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
> index a59fdd9..d157419 100644
> --- a/doc/test-writing-guidelines.txt
> +++ b/doc/test-writing-guidelines.txt
> @@ -181,10 +181,14 @@ IMPORTANT: The runtest files should have one entry per
> a test. Creating a
> ^^^^^^^^^^^^^^^
>
> If your test needs datafiles to work, these should be generally put into a
> -subdirectory named test name ('TCID' see below) and install it into the
> -'testcases/data/' directory. The datafiles can be accessed as
> -'$LTPROOT/testcases/data/TCID/...'. See
> -'testcases/network/rpc/basic_tests/rpc01/' for example.
> +subdirectory named "datafiles" and installed into the 'testcases/data/$TCID'
> +directory.
> +
> +If your test includes "test.sh" you can use LTP_DATAROOT
> + '$LTP_DATAROOT/...'
> +The datafiles can also be accessed as
> + '$LTPROOT/testcases/data/$TCID/...'
Maybe note here that LTP_DATAROOT is prefered because it works both in
the git checkout as well as after installation.
> +See 'testcases/network/rpc/basic_tests/rpc01/' for example.
>
> NOTE: There may be some convenience interface added later.
This note should be removed because with the LTP_DATAROOT we added
convenient way to get the path to the datafiles.
And ideally we should add similar interface to the C library as well,
but I'm not sure how we should shape the API. Maybe just a const char
*tst_dataroot(void) function that would return pointer to a static
string initialized on frist call and stored in the test library. But I'm
open to anything else if you have a better idea.
> diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
> index 10282f4..49e3d83 100644
> --- a/testcases/lib/test.sh
> +++ b/testcases/lib/test.sh
> @@ -144,4 +144,8 @@ export TST_TOTAL="$TST_TOTAL"
> # Setup LTPROOT, default to current directory if not set
> if [ -z "$LTPROOT" ]; then
> export LTPROOT="$PWD"
> + export LTP_DATAROOT="$LTPROOT/datafiles"
> +else
> + export LTP_DATAROOT="$LTPROOT/testcases/data/$TCID"
> fi
> +
--
Cyril Hrubis
[email protected]
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list