Message ID | 20211123124348.31073-3-rpalethorpe@suse.com |
---|---|
State | Accepted |
Headers | show |
Series | tools/sparse: Add static check | expand |
Hi Richie, ... > +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_. BTW It'd be nice to have some check for shell library (maybe shellcheck would be able to do it). ... > +2.1.1 LTP-004: Test executable symbols are marked static > +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Test executables should not export symbols unecessarily. This means typo s/unecessarily/unnecessarily/ > +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. > + Reviewed-by: Petr Vorel <pvorel@suse.cz> Kind regards, Petr
Hi! > BTW It'd be nice to have some check for shell library (maybe shellcheck would be > able to do it). Actually the check is in the shell library script.
> Hi! > > BTW It'd be nice to have some check for shell library (maybe shellcheck would be > > able to do it). > Actually the check is in the shell library script. I'm avare only about the check in tst_run() which check that tests are not using variables starting with TST or _tst_ prefix, which is important. My remark was about "LTP-003: Externally visible library symbols have the tst_ prefix", which is slightly different think. Not sure if can be scripted, thus feel free to ignore it. I have more remarks on shell checking, but post it as a separate thread. Kind regards, Petr
Hi!
Withe the typos fixed:
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
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 ^^^^^^^^^^^^^^^^^^^^^^
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(+)