Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / qa / ooxml / watch-generated-code.sh
blobd7026be82b0cafe409e65753260291ffeba5da19
1 #!/usr/bin/env bash
3 if [ ! -e bin/get_config_variables ]; then
4 cd ../../..
5 fi
7 . bin/get_config_variables SRCDIR
9 if [ "$PWD" != "$SRCDIR" ]; then
10 echo "error: not in the expected SRCDIR"
11 exit 1
14 cd writerfilter
15 echo 'include Makefile' > watch.mk
16 echo 'watch:' >> watch.mk
17 echo $'\techo $(writerfilter_ALL)' >> watch.mk
18 mydir=workdir/CustomTarget/writerfilter
19 writerfilter_ALL=$(make -sr -f watch.mk watch|sed "s|$SRCDIR/$mydir/||g")
20 rm watch.mk
21 cd - >/dev/null
23 case $1 in
24 reference)
25 rm -rf $mydir-reference
26 mkdir -p $mydir-reference/source/ooxml
27 for i in $writerfilter_ALL
29 cp $mydir/"$i" $mydir-reference/"$i"
30 done
32 compare)
33 for i in $writerfilter_ALL
35 if [ "$(basename "$i")" == "model_preprocessed.xml" ]; then
36 continue
38 diff -u $mydir-reference/"$i" $mydir/"$i"
39 done
42 echo "usage: $0 [ reference | compare ]"
43 echo
44 echo "$0 first saves a reference output of all generated files by writerfilter, then"
45 echo "allows comparing against it. This helps seeing the effect of changes made on"
46 echo "the code generator scripts."
48 esac
50 # vi:set shiftwidth=4 expandtab: