source: doc/theses/andrew_beach_MMath/code/test.sh @ 6f27b67

ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 6f27b67 was 6f27b67, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Could not get rmit.py working with the exception benchmark, but I got one improvement along the way.

  • Property mode set to 100755
File size: 2.5 KB
Line 
1#!/usr/bin/env bash
2
3# Usage: LANGUAGE TEST | -b SOURCE_FILE
4
5readonly ITERATIONS=1000000 # 1 000 000, one million
6readonly STACK_HEIGHT=100
7
8# Build Test Programs:
9# Mini-Make: TARGET SOURCE COMMAND ARGS...
10mmake() (
11        if [ ! -e "$1" -o "$1" -ot "$2" ]; then
12                "${@:3}"
13        fi
14)
15
16build() (
17        case "$1" in
18        *.cfa)
19                # Requires a symbolic link.
20                mmake "${1%.cfa}" "$1" ./cfa "$1" -o "${1%.cfa}"
21                ;;
22        *.cpp)
23                mmake "${1%.cpp}-cpp" "$1" g++ "$1" -o "${1%.cpp}-cpp"
24                ;;
25        *.java)
26                mmake "${1%.java}.class" "$1" javac "$1"
27                ;;
28        *)
29                echo "Don't know how to build:" $1 >&2
30                exit 2
31                ;;
32        esac
33)
34
35if [ "-b" = "$1" ]; then
36        for file in "${@:2}"; do
37                build $file
38        done
39        exit 0
40elif [ 2 -eq "$#" ]; then
41    TEST_LANG="$1"
42    TEST_CASE="$2"
43else
44    echo "Unknown call pattern." >&2
45    exit 2
46fi
47
48# Run Test Programs:
49# Used in place of unsupported language/test combinations.
50unsupported() {
51        echo "Run-Time: NA"
52}
53
54case "$TEST_CASE" in
55cond-match-all)
56        CFAT="./cond-catch $ITERATIONS 1"
57        CFAR="./cond-fixup $ITERATIONS 1"
58        CPP="./cond-catch-cpp $ITERATIONS 1"
59        JAVA="java CondCatch $ITERATIONS 1"
60        ;;
61cond-match-none)
62        CFAT="./cond-catch $ITERATIONS 0"
63        CFAR="./cond-fixup $ITERATIONS 0"
64        CPP="./cond-catch-cpp $ITERATIONS 0"
65        JAVA="java CondCatch $ITERATIONS 0"
66        ;;
67cross-catch)
68        CFAT="./cross-catch $ITERATIONS"
69        CFAR="./cross-resume $ITERATIONS"
70        CPP="./cross-catch-cpp $ITERATIONS"
71        JAVA="java CrossCatch $ITERATIONS"
72        ;;
73cross-finally)
74        CFAT="./cross-finally $ITERATIONS"
75        CFAR=unsupported
76        CPP=unsupported
77        JAVA="java CrossFinally $ITERATIONS"
78        ;;
79raise-detor)
80        CFAT="./throw-detor $ITERATIONS $STACK_HEIGHT"
81        CFAR="./resume-detor $ITERATIONS $STACK_HEIGHT"
82        CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT"
83        JAVA=unsupported
84        ;;
85raise-empty)
86        CFAT="./throw-empty $ITERATIONS $STACK_HEIGHT"
87        CFAR="./resume-empty $ITERATIONS $STACK_HEIGHT"
88        CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT"
89        JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT"
90        ;;
91raise-finally)
92        CFAT="./throw-finally $ITERATIONS $STACK_HEIGHT"
93        CFAR="./resume-finally $ITERATIONS $STACK_HEIGHT"
94        CPP=unsupported
95        JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT"
96        ;;
97raise-other)
98        CFAT="./throw-other $ITERATIONS $STACK_HEIGHT"
99        CFAR="./resume-other $ITERATIONS $STACK_HEIGHT"
100        CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT"
101        JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT"
102        ;;
103*)
104        echo "No such test: $TEST_CASE" >&2
105        exit 2
106        ;;
107esac
108
109case "$TEST_LANG" in
110cfa-t) echo $CFAT; $CFAT;;
111cfa-r) echo $CFAR; $CFAR;;
112cpp) echo $CPP; $CPP;;
113java) echo $JAVA; $JAVA;;
114*)
115        echo "No such language: $TEST_LANG" >&2
116        exit 2
117esac
Note: See TracBrowser for help on using the repository browser.