[go: up one dir, main page]

File: test-compile.sh

package info (click to toggle)
findent 2.8.2-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 1,756 kB
  • sloc: sh: 3,365; cpp: 2,780; fortran: 1,214; lex: 324; yacc: 246; makefile: 155; python: 155; lisp: 52
file content (74 lines) | stat: -rwxr-xr-x 1,688 bytes parent folder | download | duplicates (3)
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
69
70
71
72
73
74
#!/bin/sh
export FINDENT_FLAGS="$TEST_FINDENT_FLAGS"
prog="$1"
echo "$0: $prog"
gfortran=gfortran
$gfortran -v > /dev/null 2>&1  || { echo "Cannot compile: gfortran not installed" ; gfortran=: ; }
rc=0
exe=${FINDENT:-../src/findent}
$exe -v
bprog="`basename $prog`"
rm -f "bprog.try.f"
echo -n "$bprog: "
case "$bprog" in
   *fixed*) 
      format="-ffixed-form -ffixed-line-length-none -fd-lines-as-comments"
      ;;
   *) 
      format="-ffree-form -ffree-line-length-none" 
      ;;
esac

$gfortran -fcoarray=single -cpp $format -o prog $prog >/dev/null 2>&1
if [ $? -ne 0 ] ; then
   echo -n " original program does not compile "
   rc=1
fi

parms=`head -n1 < $prog | tr '!' ' '|tr '\r' ' '`
$exe $parms < $prog > $bprog.try.f 2>/dev/null
if [ -f $prog.try.f.ref ]; then
   if [ "$WINDOWS" = yes ] ; then
      case $prog in
	 *dos*)
	    :
	    ;;
	 *)
	    sed -i 's/\r//' $bprog.try.f
	    ;;
      esac
   fi
   cmp -s $bprog.try.f $prog.try.f.ref >/dev/null 2>&1
   if [ "$?" -eq 0 ]; then
      echo -n "OK"
   else
      echo -n "WRONG"
      rc=1
   fi
   echo
else
   echo "cannot compare"
   rc=1
fi
case "$bprog" in
   *free*) 
      format="-ffree-form -ffree-line-length-none" 
      ;;
   *) 
      format="-ffixed-form -ffixed-line-length-none -fd-lines-as-comments"
      ;;
esac
$gfortran -fcoarray=single -cpp $format -o prog $bprog.try.f >/dev/null 2>&1
if [ $? -ne 0 ] ; then
   echo "        converted program does not compile "
   rc=1
fi

echo "END TESTING FINDENT rc=$rc"
if [ $rc -ne 0 ] ; then
   echo "if you are sure $prog.try.f is correct:"
   echo "cp $prog.try.f  $prog.try.f.ref"
   echo "cp $prog.try.f.ref $prog.try.f.ref.in"
fi
rm -f prog
exit $rc