Skip to content

ts: add cookbook testsuite to validate documented recipes - #671

Merged
xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:cookbook-testsuite
Aug 14, 2026
Merged

ts: add cookbook testsuite to validate documented recipes#671
xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:cookbook-testsuite

Conversation

@xdelaruelle

@xdelaruelle xdelaruelle commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator
  • Add a cookbook DejaGnu tool, alongside modules/install/lint/completion, that builds a sandboxed fixture from the exact files a cookbook recipe ships under doc/example/<name>/, then runs the commands demonstrated in the recipe's "Usage example" documentation in order and checks that similar output is obtained, parsed straight out of the recipe's .rst file rather than a hand-copied duplicate that could silently drift from it.
  • Implements the first recipe test, sync-remote-appdir.exp, which caught (and fixed) a real inaccuracy in the recipe doc itself: module load was shown printing a "Loading foo/2.1" banner it does not actually print at normal verbosity — now reflected by adding -v to the doc's load commands instead.
  • Wired into make testcookbook and script/mt cook, documented in doc/source/devel/testsuite.rst.
  • Also includes ts: anchor tcsh initial prompt match to a fresh output line, fixing a race in the tcsh completion testsuite (from issue-tcsh-completion-timeout).

completion_tcsh_start expects the prompt right after "set prompt=..."
using a bare "$completion_prompt\$" pattern. That command own echoed-
back input already contains the exact prompt text ("set prompt=
'MODULESTEST> '"), so under load Expect can match that mid-flight echo
before tcsh has even processed Enter, once a partial read happens to
land right after it. That races the rest of session setup and can leave
the completion script not fully sourced, surfacing later as a hang on
the first real completion listing. Require the same leading
carriage-return-plus-newline prefix completion_tcsh_raw already relies
on for its own matching, so this only matches the real prompt tcsh
prints once the command is done.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Add a 'cookbook' DejaGnu tool, alongside modules/install/lint/completion,
that builds a sandboxed fixture from the exact files a cookbook recipe
ships under doc/example/<name>/, then runs the commands demonstrated in
the recipe's "Usage example" documentation in the order and against the
output parsed straight out of the recipe's .rst file, rather than a
hand-copied duplicate that could silently drift from it.

cookbook_parse_transcript (005-init_ts.exp) walks a recipe's
'.. parsed-literal::' blocks and returns {command output} pairs, with
role markup stripped from the output. cookbook_output_re turns one such
illustrated output into a regexp a sandboxed run's real output is
checked against, widening the two kinds of detail a doc transcript
cannot reproduce as-is: a run of '-' padding of unpredictable width, and
whatever placeholder path a recipe test maps to its own sandbox path.

Implements the first recipe test, sync-remote-appdir.exp, which also
fixed the recipe doc's own inaccuracy caught along the way: 'module
load' was shown printing a "Loading foo/2.1" banner it does not actually
print at normal verbosity, now reflected by adding '-v' to the doc's
load commands instead.

Wired into 'make testcookbook' and 'script/mt cook'. Documented in
doc/source/devel/testsuite.rst.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit 432e048 into envmodules:main Aug 14, 2026
20 checks passed
@xdelaruelle
xdelaruelle deleted the cookbook-testsuite branch August 14, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant