From c3f7db0390c15abf510215c7be1782755e4932a8 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Sun, 17 Nov 2019 04:18:58 +0100 Subject: [PATCH 16/17] rulesets_save.sh: test ruleset saving stability. Check that loading an already upgraded ruleset saved by rulesave and saving it again won't change it. Changing the result could indicate bugs like compatibility code running on already updated rulesets. Idea had during conversation with Marko Lindqvist See gna patch #7283 See osdn #41515 --- tests/rulesets_save.sh.in | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/rulesets_save.sh.in b/tests/rulesets_save.sh.in index 9521909c1f..f3dd5c690c 100644 --- a/tests/rulesets_save.sh.in +++ b/tests/rulesets_save.sh.in @@ -26,16 +26,35 @@ fi for ruleset in $rulesets; do resaved="rs_${ruleset}_resaved" resaved_path="${tmpdir}/${resaved}" + reresaved="resaved_rs_${ruleset}" + reresaved_path="${tmpdir}/${reresaved}" echo "Loading $ruleset and saving it as $resaved" @abs_top_builddir@/fcruleup -F -r $ruleset \ --output "$resaved_path" \ || exit 1 - echo "Trying to load $ruleset resaved as $resaved" + echo "Trying to load $ruleset saved as $resaved" FREECIV_DATA_PATH=$tmpdir \ @abs_top_builddir@/tests/rs_test_res/ruleset_loads.sh "$resaved" \ || exit 1 + + echo "Checking ruleset saving stability for $ruleset" + + echo "Resaving resaved $ruleset" + FREECIV_DATA_PATH=$tmpdir @abs_top_builddir@/fcruleup -r "$resaved" \ + --output "$reresaved_path" \ + || exit 1 + if [ ! -d "$reresaved_path" ] ; then + echo "Missing $reresaved_path means that resaving must have failed." + exit 1 + fi + result="`diff -u \"${resaved_path}\" \"${reresaved_path}\"`" + if test "x$result" != "x" ; then + echo "$result" + echo "Unstable ruleset saving." + exit 1 + fi done rm -rf "${tmpdir}" -- 2.20.1