[LTP] [PATCH 2/2] doc: Mention tst_get_tmpdir() need to be freed
Petr Vorel
pvorel@suse.cz
Fri Mar 8 00:25:11 CET 2024
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
doc/C-Test-API.asciidoc | 8 ++++++++
doc/Maintainer-Patch-Review-Checklist.asciidoc | 2 ++
2 files changed, 10 insertions(+)
diff --git a/doc/C-Test-API.asciidoc b/doc/C-Test-API.asciidoc
index 90cf1df43..2bc3d6255 100644
--- a/doc/C-Test-API.asciidoc
+++ b/doc/C-Test-API.asciidoc
@@ -2446,6 +2446,14 @@ static struct tst_test test = {
};
-------------------------------------------------------------------------------
+1.44 Path to the temporary directory
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+'tst_get_tmpdir()' returns a path to the test temporary directory in a newly
+allocated buffer. Therefore it's needed to either 1) call it only once in the setup,
+or 2) free the variable after use if it's reused (i.e. run in the test function).
+Alternatively '"."' (relative path) can be used (test chdir to the temporary directory).
+
2. Common problems
------------------
diff --git a/doc/Maintainer-Patch-Review-Checklist.asciidoc b/doc/Maintainer-Patch-Review-Checklist.asciidoc
index 452de0d49..12d323171 100644
--- a/doc/Maintainer-Patch-Review-Checklist.asciidoc
+++ b/doc/Maintainer-Patch-Review-Checklist.asciidoc
@@ -126,6 +126,8 @@ New test should
* When rewriting old tests, https://en.wikipedia.org/wiki/%CE%9CClinux[uClinux]
support should be removed (project has been discontinued).
E.g. remove `#ifdef UCLINUX`, replace `FORK_OR_VFORK()` with simple `fork()` or `SAFE_FORK()`.
+* 'tst_get_tmpdir()' should be called in the setup function or the variable must be freed after use
+ (more in https://github.com/linux-test-project/ltp/wiki/C-Test-API#144-path-to-the-temporary-directory[C API]).
### Shell tests
* Use new https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#23-writing-a-testcase-in-shell[shell API]
--
2.43.0
More information about the ltp
mailing list