1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#!/bin/bash
set -eu
# When running this script, the current directory
# must be the directory of the script, i.e. tests/scripts/
# in pasdoc's sources.
#
# See ../README.md file for docs for this script.
# functions ------------------------------------------------------------
run_echo ()
{
echo "$@"
scripts/find_all_tests_for_check_cache.sh | "$@" \
> scripts/check_cache_format_independent_tmp/pasdoc_output.txt
}
pasdoc_call ()
{
echo 'Running pasdoc:'
run_echo "${PASDOC_BIN}" -S - --exclude-generator "$@"
}
# ------------------------------------------------------------
# Assume pasdoc is on $PATH, if PASDOC_BIN not set.
PASDOC_BIN="${PASDOC_BIN:-pasdoc}"
OUTPUT_FORMAT_1="$1"
OUTPUT_FORMAT_2="$2"
shift 2
rm -Rf check_cache_format_independent_tmp/
mkdir -p \
check_cache_format_independent_tmp/cache/ \
check_cache_format_independent_tmp/1/ \
check_cache_format_independent_tmp/2/ \
check_cache_format_independent_tmp/3/
cd ..
echo "Checking cache-independent between formats ${OUTPUT_FORMAT_1} and ${OUTPUT_FORMAT_2}"
# No cache, format 1
pasdoc_call \
--output=scripts/check_cache_format_independent_tmp/1/ \
--format="$OUTPUT_FORMAT_1"
# Make cache while making format 2
pasdoc_call \
--output=scripts/check_cache_format_independent_tmp/2/ \
--format="$OUTPUT_FORMAT_2" \
--cache-dir=scripts/check_cache_format_independent_tmp/cache/
# Use cache with format 1
pasdoc_call \
--output=scripts/check_cache_format_independent_tmp/3/ \
--format="$OUTPUT_FORMAT_1" \
--cache-dir=scripts/check_cache_format_independent_tmp/cache/
echo 'Comparing two outputs:'
diff -ur \
scripts/check_cache_format_independent_tmp/1/ \
scripts/check_cache_format_independent_tmp/3/
echo 'OK, test passed.'
rm -Rf scripts/check_cache_format_independent_tmp/
|