3 # Cup install and test script
6 # Last revision 7/3/96 (for v0.10a)
9 # Last revision 11/16/96 (for v0.10b)
12 # Updated version number 7/24/99 for 0.10k
15 echo "================================"
16 echo "Installing and testing Cup v0.10k"
17 echo "================================"
20 # check for this directory in CLASSPATH
23 set c_path = `printenv CLASSPATH`
24 if ($c_path !~ "*$cwd*") then
27 echo "WARNING: The current directory does not appear in your CLASSPATH"
28 echo "WARNING: it will be added for this install/test only"
31 setenv CLASSPATH $cwd':'$c_path
32 echo "CLASSPATH now set to "
36 # change to the demo directory
39 echo "changing to simple_calc subdirectory..."
40 echo "cd java_cup/simple_calc"
41 cd java_cup/simple_calc
43 # remove old copies of parser.java and sym.java
46 echo "removing any old copies of parser.java and sym.java..."
47 echo "rm -f parser.java sym.java"
48 rm -f parser.java sym.java
50 # compile java_cup and run it against the demo program
51 # the -cs (for "checksource") option here will force the
52 # java_cup and java_cup.runtime source to be compiled prior
56 echo "compiling java_cup then generating demo program..."
57 echo "java -cs java_cup.Main < parser.cup"
58 java -cs java_cup.Main < parser.cup
60 # make sure parser.java and sym.java now exist
62 if ( ! -e parser.java) then
64 echo "ERROR: for some reason parser.java was not created"
65 echo "ERROR: install was not successful"
68 if ( ! -e sym.java) then
70 echo "ERROR: for some reason sym.java was not created"
71 echo "ERROR: install was not successful"
76 # again, the -cs option will cause compilation of all the parts
77 # of the demo program (including parser.java and sym.java that
78 # should have been generated in the previous step).
80 echo "removing old test results..."
81 echo "rm -f test_results"
84 echo "executing the demo program..."
85 echo "echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results"
86 echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results
88 # compare with standard results
90 set res = `tail -1 test_results`
91 if ("$res" !~ "= 0") then
92 echo "ERROR: test program produced the wrong results"
93 echo "ERROR: output was:"
95 echo "ERROR: install was not successful"
104 echo "=============================="
105 echo "Install and test was successful"
106 echo "=============================="