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

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

Added helper script for exception benchmarks.

  • Property mode set to 100755
File size: 2.3 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
40fi
41
42# Run Test Programs:
43# Used in place of unsupported language/test combinations.
44unsupported() {
45        echo "Run-Time: NA"
46}
47
48case "$2" in
49cond-match-all)
50        CFAT="./cond-catch $ITERATIONS 1"
51        CFAR="./cond-fixup $ITERATIONS 1"
52        CPP="./cond-catch-cpp $ITERATIONS 1"
53        JAVA="java CondCatch $ITERATIONS 1"
54        ;;
55cond-match-none)
56        CFAT="./cond-catch $ITERATIONS 0"
57        CFAR="./cond-fixup $ITERATIONS 0"
58        CPP="./cond-catch-cpp $ITERATIONS 0"
59        JAVA="java CondCatch $ITERATIONS 0"
60        ;;
61cross-catch)
62        CFAT="./cross-catch $ITERATIONS"
63        CFAR="./cross-resume $ITERATIONS"
64        CPP="./cross-catch-cpp $ITERATIONS"
65        JAVA="java CrossCatch $ITERATIONS"
66        ;;
67cross-finally)
68        CFAT="./cross-finally $ITERATIONS"
69        CFAR=unsupported
70        CPP=unsupported
71        JAVA="java CrossFinally $ITERATIONS"
72        ;;
73raise-detor)
74        CFAT="./throw-detor $ITERATIONS $STACK_HEIGHT"
75        CFAR="./resume-detor $ITERATIONS $STACK_HEIGHT"
76        CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT"
77        JAVA=unsupported
78        ;;
79raise-empty)
80        CFAT="./throw-empty $ITERATIONS $STACK_HEIGHT"
81        CFAR="./resume-empty $ITERATIONS $STACK_HEIGHT"
82        CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT"
83        JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT"
84        ;;
85raise-finally)
86        CFAT="./throw-finally $ITERATIONS $STACK_HEIGHT"
87        CFAR="./resume-finally $ITERATIONS $STACK_HEIGHT"
88        CPP=unsupported
89        JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT"
90        ;;
91raise-other)
92        CFAT="./throw-other $ITERATIONS $STACK_HEIGHT"
93        CFAR="./resume-other $ITERATIONS $STACK_HEIGHT"
94        CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT"
95        JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT"
96        ;;
97*)
98        echo "No such test." >&2
99        exit 2
100        ;;
101esac
102
103case "$1" in
104cfa-t) echo $CFAT; $CFAT;;
105cfa-r) echo $CFAR; $CFAR;;
106cpp) echo $CPP; $CPP;;
107java) echo $JAVA; $JAVA;;
108esac
Note: See TracBrowser for help on using the repository browser.