diff options
author | Jan Stancek <jstancek@redhat.com> | 2014-10-02 14:18:20 +0200 |
---|---|---|
committer | Jan Stancek <jstancek@redhat.com> | 2014-10-15 14:56:39 +0200 |
commit | f423b1a7a034840f712e5a706b36dcabc88ced11 (patch) | |
tree | 8f8f9b2ba373cde0c23273211a980f2d793b8720 /doc | |
parent | 1a48719697065b1616facab9a820bbded07dd475 (diff) |
add LTP_DATAROOT and tst_dataroot()
LTP_DATAROOT (test.sh) and tst_dataroot (libltp) define directory
which holds test data files.
If LTPROOT is defined, it is $LTPROOT/testcases/data/$TCID
otherwise it's $CWD/datafiles (where CWD is current working
directory, before any call to tst_tmdir())
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/test-writing-guidelines.txt | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index a59fdd90e..165551a12 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -180,13 +180,26 @@ IMPORTANT: The runtest files should have one entry per a test. Creating a 2.1.2 Datafiles ^^^^^^^^^^^^^^^ -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. - -NOTE: There may be some convenience interface added later. +If your test needs datafiles to work, these should be put into a subdirectory +named "datafiles" and installed into the 'testcases/data/$TCID' directory. + +You can obtain path to datafiles via $LTP_DATAROOT provided by test.sh + '$LTP_DATAROOT/...' +or via C function tst_dataroot() provided by libltp + const char *dataroot = tst_dataroot(); + +Datafiles can also be accessed as '$LTPROOT/testcases/data/$TCID/...', +but $LTP_DATAROOT and tst_dataroot() are preffered as these can be used +when running testcases directly in git tree as well as from install +location. + +The path is constructed according to these rules: +1. if $LTPROOT is set, return '$LTPROOT/testcases/data/$TCID' +2. else if tst_tmpdir() was called return '$STARTWD/datafiles' + (where $STARTWD is initial working directory as recorded by tst_tmdir()) +3. else return '$CWD/datafiles' + +See 'testcases/commands/ade/ldd/ldd01' for example. 2.1.3 Subexecutables ^^^^^^^^^^^^^^^^^^^^ |