From 03e3d0aa3f41ef47a58087b301ff22c7fe301249 Mon Sep 17 00:00:00 2001 From: Daniel Rainer Date: Wed, 11 Jun 2025 19:00:32 +0200 Subject: [PATCH] Split up sphinx HTML and MAN file generation This test is the one with the longest runtime. Splitting the two targets into separate tests allows them to run in parallel, which can speed up the tests. --- tests/checks/check-sphinx.fish | 33 --------------------------- tests/checks/sphinx-html.fish | 7 ++++++ tests/checks/sphinx-man.fish | 7 ++++++ tests/test_functions/sphinx-shared.sh | 28 +++++++++++++++++++++++ 4 files changed, 42 insertions(+), 33 deletions(-) delete mode 100644 tests/checks/check-sphinx.fish create mode 100644 tests/checks/sphinx-html.fish create mode 100644 tests/checks/sphinx-man.fish create mode 100755 tests/test_functions/sphinx-shared.sh diff --git a/tests/checks/check-sphinx.fish b/tests/checks/check-sphinx.fish deleted file mode 100644 index 6b3df6e27..000000000 --- a/tests/checks/check-sphinx.fish +++ /dev/null @@ -1,33 +0,0 @@ -#RUN: fish_indent=%fish_indent fish=%fish %fish %s -#REQUIRES: command -v sphinx-build - -set -g tmp_dir (mktemp -d) - -function build_docs --argument-names builder - set -l repo_root (status dirname)/../.. - set -l docsrc $repo_root/doc_src - set -l doctree $tmp_dir/doctree - set -l output_dir $tmp_dir/$builder - # sphinx-build needs fish_indent in $PATH - set -lxp PATH (path dirname $fish_indent) - sphinx-build \ - -j auto \ - -q \ - -W \ - -E \ - -b $builder \ - -c $docsrc \ - -d $doctree \ - $docsrc \ - $output_dir -end - -set -l success true -build_docs man || set -l success false -build_docs html || set -l success false - -rm -r $tmp_dir - -if test $success = false - exit 1 -end diff --git a/tests/checks/sphinx-html.fish b/tests/checks/sphinx-html.fish new file mode 100644 index 000000000..ef725cfab --- /dev/null +++ b/tests/checks/sphinx-html.fish @@ -0,0 +1,7 @@ +#RUN: fish_indent=%fish_indent fish=%fish %fish %s +#REQUIRES: command -v sphinx-build + +set -l build_script (status dirname)/../test_functions/sphinx-shared.sh +# sphinx-build needs fish_indent in $PATH +set -lxp PATH (path dirname $fish_indent) +$build_script html diff --git a/tests/checks/sphinx-man.fish b/tests/checks/sphinx-man.fish new file mode 100644 index 000000000..932d9ebcb --- /dev/null +++ b/tests/checks/sphinx-man.fish @@ -0,0 +1,7 @@ +#RUN: fish_indent=%fish_indent fish=%fish %fish %s +#REQUIRES: command -v sphinx-build + +set -l build_script (status dirname)/../test_functions/sphinx-shared.sh +# sphinx-build needs fish_indent in $PATH +set -lxp PATH (path dirname $fish_indent) +$build_script man diff --git a/tests/test_functions/sphinx-shared.sh b/tests/test_functions/sphinx-shared.sh new file mode 100755 index 000000000..c1ebd14bc --- /dev/null +++ b/tests/test_functions/sphinx-shared.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +cleanup () { + if [ -n "$tmp_dir" ] && [ -e "$tmp_dir" ]; then + rm -r "$tmp_dir" + fi +} + +trap cleanup EXIT INT TERM HUP + +repo_root=$(dirname "$0")/../.. +builder=$1 +docsrc=$repo_root/doc_src +tmp_dir=$(mktemp -d) +doctree=$tmp_dir/doctree +output_dir=$tmp_dir/$builder +sphinx-build \ + -j auto \ + -q \ + -W \ + -E \ + -b "$builder" \ + -c "$docsrc" \ + -d "$doctree" \ + "$docsrc" \ + "$output_dir"