source: doc/theses/andrew_beach_MMath/code/test.sh @ 63e3ed8

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

Added Python versions of the exception benchmarks.

  • Property mode set to 100755
File size: 2.9 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 -DNDEBUG -nodebug -O3 "$1" -o "${1%.cfa}"
21                ;;
22        *.cpp)
23                mmake "${1%.cpp}-cpp" "$1" g++ -DNDEBUG -O3 "$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        PYTHON="./cond_catch.py $ITERATIONS 1"
61        ;;
62cond-match-none)
63        CFAT="./cond-catch $ITERATIONS 0"
64        CFAR="./cond-fixup $ITERATIONS 0"
65        CPP="./cond-catch-cpp $ITERATIONS 0"
66        JAVA="java CondCatch $ITERATIONS 0"
67        PYTHON="./cond_catch.py $ITERATIONS 0"
68        ;;
69cross-catch)
70        CFAT="./cross-catch $ITERATIONS"
71        CFAR="./cross-resume $ITERATIONS"
72        CPP="./cross-catch-cpp $ITERATIONS"
73        JAVA="java CrossCatch $ITERATIONS"
74        PYTHON="./cross_catch.py $ITERATIONS"
75        ;;
76cross-finally)
77        CFAT="./cross-finally $ITERATIONS"
78        CFAR=unsupported
79        CPP=unsupported
80        JAVA="java CrossFinally $ITERATIONS"
81        PYTHON="./cross_finally.py $ITERATIONS"
82        ;;
83raise-detor)
84        CFAT="./throw-detor $ITERATIONS $STACK_HEIGHT"
85        CFAR="./resume-detor $ITERATIONS $STACK_HEIGHT"
86        CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT"
87        JAVA=unsupported
88        PYTHON=unsupported
89        ;;
90raise-empty)
91        CFAT="./throw-empty $ITERATIONS $STACK_HEIGHT"
92        CFAR="./resume-empty $ITERATIONS $STACK_HEIGHT"
93        CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT"
94        JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT"
95        PYTHON="./throw_empty.py $ITERATIONS $STACK_HEIGHT"
96        ;;
97raise-finally)
98        CFAT="./throw-finally $ITERATIONS $STACK_HEIGHT"
99        CFAR="./resume-finally $ITERATIONS $STACK_HEIGHT"
100        CPP=unsupported
101        JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT"
102        PYTHON="./throw_finally.py $ITERATIONS $STACK_HEIGHT"
103        ;;
104raise-other)
105        CFAT="./throw-other $ITERATIONS $STACK_HEIGHT"
106        CFAR="./resume-other $ITERATIONS $STACK_HEIGHT"
107        CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT"
108        JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT"
109        PYTHON="./throw_other.py $ITERATIONS $STACK_HEIGHT"
110        ;;
111*)
112        echo "No such test: $TEST_CASE" >&2
113        exit 2
114        ;;
115esac
116
117case "$TEST_LANG" in
118cfa-t) echo $CFAT; $CFAT;;
119cfa-r) echo $CFAR; $CFAR;;
120cpp) echo $CPP; $CPP;;
121java) echo $JAVA; $JAVA;;
122python) echo $PYTHON; $PYTHON;;
123*)
124        echo "No such language: $TEST_LANG" >&2
125        exit 2
126        ;;
127esac
Note: See TracBrowser for help on using the repository browser.