Signed-off-by: Stanislav Kholmanskikh <stanislav.kholmansk...@oracle.com> --- doc/test-writing-guidelines.txt | 17 +++++++++++++++++ tools/apicmds/.gitignore | 1 + tools/apicmds/Makefile | 2 +- tools/apicmds/ltpapicmd.c | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt index 2c40e3d..e35ec34 100644 --- a/doc/test-writing-guidelines.txt +++ b/doc/test-writing-guidelines.txt @@ -1195,6 +1195,7 @@ Following functions similar to the LTP C interface are available. * tst_tmpdir() * tst_rmdir() * tst_fs_has_free() +* tst_fs_type() There is one more function called 'tst_check_cmds()' that gets unspecified number of parameters and asserts that each parameter is a name of an @@ -1249,6 +1250,22 @@ satisfied, 1 if not, and 2 on error. The second argument supports suffixes kB, MB and GB, the default unit is Byte. +.tst_fs_type +[source,sh] +------------------------------------------------------------------------------- +#!/bin/sh + +... + +# whether the current directory is on NFS +if [ $(tst_fs_type .) = "NFS" ]; then + tst_brkm TCONF "Not supported on NFS" +fi + +... +------------------------------------------------------------------------------- + + 2.3.3 Cleanup ^^^^^^^^^^^^^ diff --git a/tools/apicmds/.gitignore b/tools/apicmds/.gitignore index b4f7922..c77ba02 100644 --- a/tools/apicmds/.gitignore +++ b/tools/apicmds/.gitignore @@ -11,3 +11,4 @@ tst_ncpus_max tst_res tst_resm tst_fs_has_free +tst_fs_type diff --git a/tools/apicmds/Makefile b/tools/apicmds/Makefile index 9c9472d..e8ee78c 100644 --- a/tools/apicmds/Makefile +++ b/tools/apicmds/Makefile @@ -28,7 +28,7 @@ CPPFLAGS += -D_GNU_SOURCE MAKE_TARGETS := $(addprefix tst_,brk brkm exit flush kvercmp \ kvercmp2 res resm ncpus ncpus_conf ncpus_max \ - get_unused_port fs_has_free) + get_unused_port fs_has_free fs_type) include $(top_srcdir)/include/mk/generic_leaf_target.mk diff --git a/tools/apicmds/ltpapicmd.c b/tools/apicmds/ltpapicmd.c index 5238328..ed59f6a 100644 --- a/tools/apicmds/ltpapicmd.c +++ b/tools/apicmds/ltpapicmd.c @@ -77,6 +77,7 @@ #include "test.h" #include "usctest.h" #include "safe_macros.h" +#include "tst_fs_type.h" char *TCID; /* Name of the testcase */ int TST_TOTAL; /* Total number of testcases */ @@ -359,6 +360,20 @@ fs_has_free_err: exit(2); } +const char *apicmd_fs_type(int argc, char *argv[]) +{ + long fs_type; + + if (argc != 2) { + fprintf(stderr, "Usage: tst_fs_type path\n"); + exit(2); + } + + fs_type = tst_fs_type(NULL, argv[0]); + + return tst_fs_type_name(fs_type); +} + /* * Function: main - entry point of this program * @@ -449,6 +464,8 @@ int main(int argc, char *argv[]) printf("%u\n", apicmd_get_unused_port(argc, argv)); } else if (strcmp(cmd_name, "tst_fs_has_free") == 0) { apicmd_fs_has_free(argc, argv); + } else if (strcmp(cmd_name, "tst_fs_type") == 0) { + printf("%s\n", apicmd_fs_type(argc, argv)); } exit(0); -- 1.7.1 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list