Debian Codegraph @

tests/tests2montage

raw
1 #!/bin/sh
2
3 if [ -z $OUTPUTS ]; then
4 OUTPUTS=outputs
5 fi
6
7 if [ -d ../.git ]; then
8 revision=$(git describe --tags)
9 revision="$revision""$TEST_SUFFIX"
10
11 echo "Generating images for revision $revision"
12 fi
13
14 # A dir specific for outputs
15 mkdir -p "$OUTPUTS"
16
17 total=0
18 for f in "$@"; do
19 echo "Running $f";
20
21 if [ "$revision" ]; then
22 output="$OUTPUTS"/${f%%.sh}-$revision
23 else
24 output="$OUTPUTS"/${f%%.sh}
25 fi
26 basepdf=${f%%.sh}
27
28 export CT_ADD="--name ${basepdf}-%03d"
29 NOXPDF=1 sh $f
30 if [ -r ${basepdf}-000.pdf ]; then
31 nb=0
32 for f in ${basepdf}-*.pdf; do
33 pp=${f%%.pdf}.ppm
34 pdftoppm $f > $pp
35 total=$(($total + 1))
36 nb=$(($nb+1))
37 done
38
39 echo "$nb PDF files were generated"
40 echo " -> producing montage outputs"
41
42 if [ -z $BIG ]; then
43 geometry=340x340+4+4
44 density=150
45 else
46 geometry=500x500+4+4
47 density=250
48 fi
49 montage -label %f -frame 5 -background '#336699' \
50 -geometry $geometry -density $density ${basepdf}-*.ppm ${output}.png
51 if [ -z $KEEP ]; then
52 echo " -> removing PDF files"
53 rm -f ${basepdf}-*.pdf
54 rm -f ${basepdf}-*.ppm
55 fi
56 display ${output}.png &
57 fi
58 done
59
60 echo "Generated a total of $total PDF files"