git @ Cat's Eye Technologies Pixley / 0d531f3
Refactor test driver a bit to accomodate Pifxley. catseye 13 years ago
3 changed file(s) with 79 addition(s) and 40 deletion(s). Raw diff Collapse all Expand all
2121 # of the function will be output.
2222
2323 # This script requires a Scheme implementation which can run
24 # Scheme programs from the command line. plt-r5rs does the trick.
24 # Scheme programs from the command line. plt-r5rs, from the Racket
25 # distribution (sudo apt-get install racket), does the trick.
2526 # If you want to use a different Scheme implementation, you can set
2627 # the environment variable R5RS before running this.
28
29 # The environment variable PIXLEY can also be set to point to a different
30 # implementation of Pixley (written in (some subset of) R5RS). As a
31 # special, setting it to the value R5RS will run source.pix directly in
32 # Scheme (just as scheme.sh does.)
2733
2834 if [ "${R5RS}x" = "x" ]; then
2935 R5RS=plt-r5rs
3743 PIXLEY=pixley.pix
3844 fi
3945
40 cat >driver.scm <<EOF
46 if [ "${PIXLEY}x" = "R5RSx" ]; then
47 cat >driver.scm <<EOF
48 (define program
49 EOF
50 cat >>driver.scm <$1
51 cat >>driver.scm <<EOF
52 )
53 EOF
54 if [ "${2}x" = "x" ]; then
55 cat >>driver.scm <<EOF
56 program
57 EOF
58 else
59 cat >>driver.scm <<EOF
60 (program (quote
61 EOF
62 cat >>driver.scm <$2
63 cat >>driver.scm <<EOF
64 ))
65 EOF
66 fi
67 else
68 cat >driver.scm <<EOF
4169 (define pixley
4270 EOF
43 cat ${PIXLEYDIR}/${PIXLEY} >>driver.scm
44 cat >>driver.scm <<EOF
71 cat ${PIXLEYDIR}/${PIXLEY} >>driver.scm
72 cat >>driver.scm <<EOF
4573 )
74 EOF
75 cat >>driver.scm <<EOF
4676 (define program (quote
4777 EOF
48 cat >>driver.scm <$1
49 cat >>driver.scm <<EOF
78 cat >>driver.scm <$1
79 cat >>driver.scm <<EOF
5080 ))
5181 EOF
52 if [ "${2}x" = "x" ]; then
53 cat >>driver.scm <<EOF
82 if [ "${2}x" = "x" ]; then
83 cat >>driver.scm <<EOF
5484 (pixley pixley program '())
5585 EOF
56 else
57 cat >>driver.scm <<EOF
86 else
87 cat >>driver.scm <<EOF
5888 (define foonction (pixley pixley program '()))
5989 (foonction (list (quote
6090 EOF
61 cat >>driver.scm <$2
62 cat >>driver.scm <<EOF
91 cat >>driver.scm <$2
92 cat >>driver.scm <<EOF
6393 )))
6494 EOF
95 fi
6596 fi
6697
6798 $R5RS driver.scm
33 -> Tests for functionality "Interpret Pixley Program"
44
55 -> Functionality "Interpret Pixley Program" is implemented by
6 -> shell command "(cat >foo.pix && ../script/scheme.sh foo.pix)"
7
8 -> Functionality "Interpret Pixley Program" is implemented by
96 -> shell command "(cat >foo.pix && ../script/pixley.sh foo.pix)"
10
11 -> Functionality "Interpret Pixley Program" is implemented by
12 -> shell command "(PIXLEY=../dialect/pixley.pifx cat >foo.pix && ../script/pixley.sh foo.pix)"
137
148 Constructing and Manipulating Data
159 ----------------------------------
00 #!/bin/sh
1
2 echo "Running Falderal tests for Pixley..."
3
4 cd src && falderal test tests.falderal
5 rm -f foo.pix
6 cd ..
71
82 echo "Sanity-testing scheme.sh and pixley.sh..."
93
2519 diff -u expected.sexp out.sexp
2620 rm -f expected.sexp out.sexp
2721
22 echo "Testing Pixley programs as Scheme programs..."
23
24 cd src && PIXLEY=R5RS falderal test tests.falderal
25 rm -f foo.pix
26 cd ..
27
28 echo "Testing Pixley programs on reference interpreter..."
29
30 cd src && falderal test tests.falderal
31 rm -f foo.pix
32 cd ..
33
34 echo "Running Falderal tests for P-Normalizer..."
35
36 cd dialect && falderal test p-normal.falderal
37 rm -f foo.pix
38 cd ..
39
40 echo "P-Normalizing Pixley interpreter..."
41
42 script/pixley.sh dialect/p-normal.pix src/pixley.pix > src/p-normal-pixley.pix
43
44 echo "Testing Pixley programs on P-Normalized interpreter..."
45
46 cd src && PIXLEY=p-normal-pixley.pix falderal test tests.falderal
47 rm -f foo.pix p-normal-pixley.pix
48 cd ..
49
50 echo "Testing Pixley programs on Pixley interpreter in Pifxley..."
51
52 cd src && PIXLEY=../dialect/pixley.pifx falderal test tests.falderal
53 rm -f foo.pix p-normal-pixley.pix
54 cd ..
55
56 # Optional Mini-Scheme tests
57
2858 echo 'quit' | miniscm >/dev/null 2>&1
2959 if [ $? = 0 ]
3060 then
4171 else
4272 echo "miniscm not installed, skipping. Your loss I guess."
4373 fi
44
45 echo "Running Falderal tests for P-Normalizer..."
46
47 cd dialect && falderal test p-normal.falderal
48 rm -f foo.pix
49 cd ..
50
51 echo "P-Normalizing Pixley interpreter..."
52
53 script/pixley.sh dialect/p-normal.pix src/pixley.pix > src/p-normal-pixley.pix
54
55 echo "Testing Pixley programs on P-Normalized interpreter..."
56
57 cd src && PIXLEY=p-normal-pixley.pix falderal test tests.falderal
58 rm -f foo.pix p-normal-pixley.pix
59 cd ..