From 3f03224e135244ec40f20b86159a65a5b8199b52 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Mon, 8 Feb 2021 10:40:56 +0100 Subject: [PATCH] CI: run autohelp. Run freeciv-manual on each tested ruleset to catch some potential crashes in the automatic help text generation. See osdn #41518 --- configure.ac | 2 ++ scripts/ci-build.sh | 4 ++++ tests/.gitignore | 1 + tests/Makefile.am | 1 + tests/rulesets_autohelp.sh.in | 28 ++++++++++++++++++++++++++++ 5 files changed, 36 insertions(+) create mode 100644 tests/rulesets_autohelp.sh.in diff --git a/configure.ac b/configure.ac index a787af1088..05231333c1 100644 --- a/configure.ac +++ b/configure.ac @@ -1829,6 +1829,8 @@ AC_CONFIG_FILES([tests/rulesets_save.sh], [chmod +x tests/rulesets_save.sh]) AC_CONFIG_FILES([tests/rs_test_res/ruleset_loads.sh], [chmod +x tests/rs_test_res/ruleset_loads.sh]) +AC_CONFIG_FILES([tests/rulesets_autohelp.sh], + [chmod +x tests/rulesets_autohelp.sh]) AC_OUTPUT diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh index 27979c87f2..503be779b8 100755 --- a/scripts/ci-build.sh +++ b/scripts/ci-build.sh @@ -127,6 +127,10 @@ echo "Checking ruleset upgrade" FREECIV_DATA_PATH="../tests/rs_test_res/upgrade_rulesets:$FREECIV_DATA_PATH" \ ./tests/rulesets_save.sh `cat ../tests/rs_test_res/upgrade_ruleset_list.txt` +# Check ruleset autohelp generation +echo "Checking ruleset auto help generation" +./tests/rulesets_autohelp.sh + echo "Running Freeciv server autogame" cd ${HOME}/freeciv/default/bin/ ./freeciv-server --Announce none -e --read ${basedir}/scripts/test-autogame.serv diff --git a/tests/.gitignore b/tests/.gitignore index 93f0826050..d2eb7acd1f 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -4,3 +4,4 @@ /check-output /rulesets_not_broken.sh /rulesets_save.sh +/rulesets_autohelp.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 16c730ab1b..7a40ea184d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,4 +26,5 @@ EXTRA_DIST = check_macros.sh \ rs_test_res/ruleset_is.lua \ rs_test_res/ruleset_list.txt \ rs_test_res/ruleset_loads.sh.in \ + rulesets_autohelp.sh.in \ va_list.sh diff --git a/tests/rulesets_autohelp.sh.in b/tests/rulesets_autohelp.sh.in new file mode 100644 index 0000000000..c9f8e3e56a --- /dev/null +++ b/tests/rulesets_autohelp.sh.in @@ -0,0 +1,28 @@ +#!/bin/bash + +# rulesets_autohelp.sh [ruleset]... +# Exits with 0 when each specified ruleset or, if no rulesets are specified, +# each ruleset that is developed with Freeciv, are able to automatically +# generate help texts. Exits with 1 if autohelp fails for any ruleset. + +if test x$1 = x ; then + # Try to load all rulesets that are developed with Freeciv + rulesets=`cat @abs_top_srcdir@/tests/rs_test_res/ruleset_list.txt` +else + # Try to load the specified ruleset(s) + rulesets=$@ +fi + +if test "x$FREECIV_DATA_PATH" = "x" ; then + FREECIV_DATA_PATH=".@HOST_PATH_SEPARATOR@data" +fi +FREECIV_DATA_PATH="${FREECIV_DATA_PATH}@HOST_PATH_SEPARATOR@@top_builddir@@HOST_DIR_SEPARATOR@data@HOST_PATH_SEPARATOR@@top_srcdir@@HOST_DIR_SEPARATOR@data" +export FREECIV_DATA_PATH + +for ruleset in $rulesets; do + echo "Loading $ruleset" + @abs_top_builddir@/tools/freeciv-manual -r $ruleset || exit 1 +done + +echo "The automatic help text generation works for all tested rulesets." +exit 0 -- 2.20.1