Re: [PATCH] docs: Makefile: Add a testdocs target for the documentation unit tests

From: Nicolas Schier

Date: Thu Sep 17 2026 - 02:40:29 EST


On Wed, Sep 16, 2026 at 11:41:11AM -0700, Kees Cook wrote:
> tools/unittests/run.py discovers and runs the unit tests there (which
> are primarily documentation tools), but nothing in the build calls it,
> so the tests are only run by whoever remembers that the script is there.
>
> Give it a target, next to the other checks that need no Sphinx. The name
> ends in "docs", so it matches the "%docs" pattern already in
> no-dot-config-targets and runs without a configured tree, and it sets
> PYTHONPYCACHEPREFIX as the other Python targets here do, to keep
> __pycache__ directories out of the source tree.
>
> $ make testdocs
> ...
> Ran 121 tests
>
> with "make dochelp" listing it between refcheckdocs and cleandocs.
>
> Tested with GNU Make 4.4.1 and Python 3.14.7, on a tree with no .config,
> where it ran 121 tests and left no __pycache__ behind.
>
> Assisted-by: LLM
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
> ---
> I debated the naming here, since "tools/unittests/" is such a general
> directory location, but figured I'd start with a target that made the most
> logical sense given what is actually being tested there? I dunno. Maybe
> "make testtools"? But that reads weird.
> ---
> Makefile | 2 +-
> Documentation/Makefile | 5 +++++
> 2 files changed, 6 insertions(+), 1 deletion(-)
>

I agree with Randy, 'testdocs' sounds good to me, too.

Tested-by: Nicolas Schier <n.schier@xxxxxxxxx>
Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>

--
Nicolas