summaryrefslogtreecommitdiff
path: root/web/yacco2/qa/o2testdriver_tests.sh
blob: d29331b2a05ef2b68acc6bdd08981398562558e0 (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#! /bin/sh
# file: testdriver_tests.bat
# test suite for o2
echo "////////////////////////////////////////"
echo "////////////o2testdriver_tests.bat /////"
echo "/////// test lexical components of o2///"
echo "////////////////////////////////////////"
echo "////////////////////////////////////////"
testdriver=/usr/local/yacco2/bin/testdriver
#o2=/usr/local/yacco2/bin/testdriver
qa="/usr/local/yacco2/qa/"
tmp=/tmp/o2
if [ ! -e "$tmp" ] 
then
  mkdir $tmp
fi
cd $tmp
prt_pdf=0
delete_files=1
#echo '\input eplain' > $tmp/eplain.txt
cont=n
ccresult=0

sw1=$1
sw2=$2
sw3=$3
sw4=$4

file_no=$((0))
file_pos=$((1))
cc_lex()
{
  echo "    =====Grammar=> $1 <===File==="
  sed -n -f '/usr/local/yacco2/qa/qa_echo.sedt' "$1" | sh
  file_name_only="`basename $2`"
  dir_only="`dirname $2`"
  #echo "%%%%%%%%%%%%%%%%target directory $dir_only"
  echo "	executing command line=>: $o2 $sw1 $sw2 $sw3 $sw4 $1"
  eval "$testdriver $1"
  echo "------------------------------------------------"
  echo " "
  # once gened is enough for the various T gening
  sw1=
  sw2=
  sw3=
  sw4=
  if test $ccresult -eq 1; then
    echo -n "grammar in error: continue y or n: ";
    read cont;
    if test $cont -eq n; then
      echo "Error in grammar exiting";
      exit 1;
    fi
  fi 
  if test $prt_pdf -eq 1; then
   eval "mpost $file_name_only.mp"
   eval "cweave $file_name_only.w"
   ##eval "cat eplain.txt $file_name_only.tex > $file_name_only.tex1"
   eval "pdftex $file_name_only.tex"
   xref="$file_name_only""_idx"
   echo "%%%%%%%%%%%%%%%%% index file: $xref to cweave and pdftex"
   eval "cweave $xref.w"
   eval "pdftex $xref.tex"
   pdftops "$file_name_only.pdf"
   pdftops "$xref"".pdf"
  fi
if test $delete_files -eq 1; then
  for k in `ls * `;
  do
   #echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!Casing on $k"
   case $k in
    *.cpp|*.h) 
      eval "cp $k $dir_only/$k";
      #echo "-----Copying--------> $k to $dir_only/$k"
      eval "rm -f $k" 
;;
    *.fsc) 
      eval "cp $k $dir_only/$k";
      #echo "-------------> Deleting $k"
      eval "rm -f $k" ;;
    *.scn|*.idx|*.log|*.toc)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" 
;;
    Err.w|T.w) # error and terminal documents to be cweave then pdftex printed by xpdf
      #echo "-------------> Deleting $k"
      #eval "rm -f $k" eof
;;
    *.w)
      #echo "-------------> Deleting $k"
      #eval "rm -f $k" 
;;
    *.tex)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" 
;;
    *.mp)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" 
;;
    *.tex1)
      #echo "-------------> Deleting $k"
      eval "rm -f $k" 
;;
    *.[1-9])
      #echo "-------------> Deleting Mpost diagrams $k"
      eval "rm -f $k" 
;;
     *.[1-9][0-9]*)
      #echo "-------------> Deleting Mpost diagrams $k"
      eval "rm -f $k"
 ;;
   esac
  done
fi
}
cc_lex "$qa"unquoted_string.dat  "$qa"unquoted_string 
cc_lex "$qa"xc_str.dat  "$qa"xc_str
cc_lex  "$qa"comment.dat  "$qa"comment
cc_lex  "$qa"comment1.dat  "$qa"comment1
cc_lex  "$qa"c_literal.dat  "$qa"c_literal
cc_lex  "$qa"c_literal1.dat  "$qa"c_literal1
cc_lex  "$qa"c_string.dat  "$qa"c_string
cc_lex  "$qa"c_string1.dat  "$qa"c_string1
cc_lex  "$qa"esc_seq.dat  "$qa"esc_seq
cc_lex  "$qa"identifier.dat  "$qa"identifier
cc_lex  "$qa"keyword.dat  "$qa"keyword
cc_lex  "$qa"keyword1.dat  "$qa"keyword1
cc_lex  "$qa"angled_string.dat  "$qa"angled_string
cc_lex  "$qa"b.dat  "$qa"b
cc_lex  "$qa"dbl_colon.dat  "$qa"dbl_colon 
cc_lex  "$qa"esc_seq.dat  "$qa"esc_seq
cc_lex  "$qa"int_no.dat  "$qa"int_no