File: check_cache.sh

package info (click to toggle)
pasdoc 0.16.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 33,536 kB
  • sloc: pascal: 28,894; javascript: 7,665; xml: 2,597; makefile: 519; sh: 417
file content (51 lines) | stat: -rwxr-xr-x 1,181 bytes parent folder | download
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
#!/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 file for docs for this script.

# functions ------------------------------------------------------------

run_echo ()
{
  echo "$@"
  scripts/find_all_tests_for_check_cache.sh | "$@" \
    > scripts/check_cache_tmp/pasdoc_output.txt
}

pasdoc_call ()
{
  echo 'Running pasdoc:'
  run_echo "${PASDOC_BIN}" \
    --format="$OUTPUT_FORMAT" -S - \
    --exclude-generator \
    --cache-dir=scripts/check_cache_tmp/cache/ \
    "$@"
}

# ------------------------------------------------------------

# Assume pasdoc is on $PATH, if PASDOC_BIN not set.
PASDOC_BIN="${PASDOC_BIN:-pasdoc}"

OUTPUT_FORMAT="$1"
shift 1

rm -Rf check_cache_tmp/
mkdir -p check_cache_tmp/cache/ check_cache_tmp/1/ check_cache_tmp/2/

cd ..

echo "Checking cache for format ${OUTPUT_FORMAT}"

pasdoc_call --output=scripts/check_cache_tmp/1/
pasdoc_call --output=scripts/check_cache_tmp/2/

echo 'Comparing two outputs:'
diff -u scripts/check_cache_tmp/1/ scripts/check_cache_tmp/2/
echo 'OK, test passed.'

rm -Rf scripts/check_cache_tmp/