[LTP] [PATCH 2/3] doc: Add LTP-003 and LTP-004 static and tst API prefix rules

Richard Palethorpe rpalethorpe@suse.com
Tue Nov 23 13:43:47 CET 2021


Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
 doc/library-api-writing-guidelines.txt | 10 ++++++++++
 doc/rules.tsv                          |  2 ++
 doc/test-writing-guidelines.txt        |  8 ++++++++
 3 files changed, 20 insertions(+)

diff --git a/doc/library-api-writing-guidelines.txt b/doc/library-api-writing-guidelines.txt
index 2819d4177..c82053681 100644
--- a/doc/library-api-writing-guidelines.txt
+++ b/doc/library-api-writing-guidelines.txt
@@ -39,6 +39,16 @@ The macros which are clearly intended to update these variables. That
 is +TEST+ and those in 'tst_test_macros.h'. Are of course allowed to
 update these variables.
 
+2.3 LTP-003: Externally visible library symbols have the tst_ prefix
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Functions, types and variables in the public test API should have the
+tst_ prefix. With some exceptions for symbols already prefixed with
+safe_ or ltp_.
+
+Static (private) symbols should not have the prefix.
+
+
 3. Shell API
 ------------
 
diff --git a/doc/rules.tsv b/doc/rules.tsv
index d4081ce0f..2dfeca9f9 100644
--- a/doc/rules.tsv
+++ b/doc/rules.tsv
@@ -1,3 +1,5 @@
 ID	DESCRIPTION
 LTP-001	Library source files have tst_ prefix
 LTP-002	TST_RET and TST_ERR are never modified by test library functions
+LTP-003 Externally visible library symbols have the tst_ prefix
+LTP-004 Test executable symbols are marked static
diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index b87446d1b..98fdb4d8d 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -133,6 +133,14 @@ script from kernel git tree.
 NOTE: If `make check` does not report any problems, the code still may be wrong
       as all tools used for checking only look for common mistakes.
 
+2.1.1 LTP-004: Test executable symbols are marked static
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Test executables should not export symbols unecessarily. This means
+that all top-level variables and functions should be marked with the
+static keyword. The only visible symbols should be those included from
+shared object files.
+
 2.2 Shell coding style
 ^^^^^^^^^^^^^^^^^^^^^^
 
-- 
2.33.1



More information about the ltp mailing list