-
Notifications
You must be signed in to change notification settings - Fork 206
Ccanlint
Rusty Russell edited this page Feb 28, 2014
·
6 revisions
ccanlint is a complex tool, whose main job is to help you write better modules. It runs a series of tests, each of which has a score associated with it. Without any options, it simply reports the total score for your module in the current directory, unless something fails badly.
See also, the ccanlint man page.
Here's a brief synopsis of ccanlint common options:
- -v: verbose. This shows the score for each test which wasn't perfect. Specified multiple times gives more information (above -vv is mainly for debugging ccanlint itself).
- -s: score mode. Simply report the score, don't try to help.
- <directory>...: the directory/directories the module is in, rather than the current directory.
- -l: list all the tests and a simple description.
Useful options for diagnosing a particular failure:
- -x : don't run a testname (or any tests which depend on it)
- --target : only run a specific test (and its prerequisites)
- -k : keep the temporary files for this test, or "all" for everything.
Note that you can also suppress or add options to certain tests in your _info file.
Here are the current ccanlint tests:
###Compulsory tests:
- main_header_exists: Module has main header file
- info_exists: Module has _info file
- depends_exist: Module's CCAN dependencies can be found
- objects_build: Module object files can be built
- module_builds: Module can be built from object files
- main_header_compiles: Modules main header compiles
- depends_build: Module's CCAN dependencies can be found or built
- module_links: Module can be linked against trivial program
- tests_exist: Module has test directory with Tests in it
- tests_helpers_compile: Module test helper objects compile
- tests_compile: Module tests compile
- tests_pass: Module's run and api tests pass
- tests_pass_valgrind: Module's run and api tests succeed under valgrind
- tests_pass_valgrind_noleaks: Module's run and api tests have no memory leaks
- tests_compile_coverage: Module tests compile with -fprofile-arcs -ftest-coverage
- tests_coverage: Module's tests cover all the code
- reduce_features: Produce config.h with reduced features
- objects_build_with_stringchecks: Module compiles with extra ctype.h and str function checks
- objects_build_without_features: Module object files can be built (without features)
- no_trailing_whitespace: Module's source code has no trailing whitespace
- license_exists: Module has License: entry in _info, and LICENSE symlink/file
- license_file_compat: Source files don't contain incompatible licenses
- license_depends_compat: CCAN dependencies don't contain incompatible licenses
- license_comment: Source and header files refer to LICENSE
- info_summary_single_line: Module has a single line summary in _info
- info_documentation_exists: Module has documentation in _info
- headers_idempotent: Module headers are #ifndef/#define wrapped
- hash_if: Features are checked with #if not #ifdef
- examples_exist: info and main header file have Example: sections
- examples_relevant: Example: sections demonstrate appropriate function
- examples_compile: Module examples compile
- examples_run: Module examples with expected output give that output
- depends_build_without_features: Module's CCAN dependencies can be found or built (reduced features)
- tests_helpers_compile_without_features: Module tests helpers compile (without features)
- tests_compile_without_features: Module tests compile (without features)
- tests_pass_without_features: Module's run and api tests pass (without features)
- depends_accurate: Module's CCAN dependencies are the only CCAN files #included
- avoids_cpp_reserved: Modules main header compiles without C++ reserved words