source: doc/theses/andrew_beach_MMath/code/test.sh @ 605673f

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

Added a way to call the exception benchmark script so it is compatable with rmit.py.

  • Property mode set to 100755
File size: 2.8 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 == "$#" ]; then
41    TEST_LANG="$1"
42    TEST_CASE="$2"
43# Just a weird hack to make this work with rmit.py.
44elif [ 4 == "$#" ]; then
45    # -l TEST_LANG -t TEST_CASE
46    if [ "-l" = "$1" ]; then
47        TEST_LANG="$2"
48        TEST_CASE="$4"
49    # -t TEST_CASE -l TEST_LANG
50    else
51        TEST_LANG="$4"
52        TEST_CASE="$2"
53    fi
54else
55    echo "Unknown call pattern." >&2
56    exit 2
57fi
58
59# Run Test Programs:
60# Used in place of unsupported language/test combinations.
61unsupported() {
62        echo "Run-Time: NA"
63}
64
65case "$TEST_CASE" in
66cond-match-all)
67        CFAT="./cond-catch $ITERATIONS 1"
68        CFAR="./cond-fixup $ITERATIONS 1"
69        CPP="./cond-catch-cpp $ITERATIONS 1"
70        JAVA="java CondCatch $ITERATIONS 1"
71        ;;
72cond-match-none)
73        CFAT="./cond-catch $ITERATIONS 0"
74        CFAR="./cond-fixup $ITERATIONS 0"
75        CPP="./cond-catch-cpp $ITERATIONS 0"
76        JAVA="java CondCatch $ITERATIONS 0"
77        ;;
78cross-catch)
79        CFAT="./cross-catch $ITERATIONS"
80        CFAR="./cross-resume $ITERATIONS"
81        CPP="./cross-catch-cpp $ITERATIONS"
82        JAVA="java CrossCatch $ITERATIONS"
83        ;;
84cross-finally)
85        CFAT="./cross-finally $ITERATIONS"
86        CFAR=unsupported
87        CPP=unsupported
88        JAVA="java CrossFinally $ITERATIONS"
89        ;;
90raise-detor)
91        CFAT="./throw-detor $ITERATIONS $STACK_HEIGHT"
92        CFAR="./resume-detor $ITERATIONS $STACK_HEIGHT"
93        CPP="./throw-detor-cpp $ITERATIONS $STACK_HEIGHT"
94        JAVA=unsupported
95        ;;
96raise-empty)
97        CFAT="./throw-empty $ITERATIONS $STACK_HEIGHT"
98        CFAR="./resume-empty $ITERATIONS $STACK_HEIGHT"
99        CPP="./throw-empty-cpp $ITERATIONS $STACK_HEIGHT"
100        JAVA="java ThrowEmpty $ITERATIONS $STACK_HEIGHT"
101        ;;
102raise-finally)
103        CFAT="./throw-finally $ITERATIONS $STACK_HEIGHT"
104        CFAR="./resume-finally $ITERATIONS $STACK_HEIGHT"
105        CPP=unsupported
106        JAVA="java ThrowFinally $ITERATIONS $STACK_HEIGHT"
107        ;;
108raise-other)
109        CFAT="./throw-other $ITERATIONS $STACK_HEIGHT"
110        CFAR="./resume-other $ITERATIONS $STACK_HEIGHT"
111        CPP="./throw-other-cpp $ITERATIONS $STACK_HEIGHT"
112        JAVA="java ThrowOther $ITERATIONS $STACK_HEIGHT"
113        ;;
114*)
115        echo "No such test: $TEST_CASE" >&2
116        exit 2
117        ;;
118esac
119
120case "$TEST_LANG" in
121cfa-t) echo $CFAT; $CFAT;;
122cfa-r) echo $CFAR; $CFAR;;
123cpp) echo $CPP; $CPP;;
124java) echo $JAVA; $JAVA;;
125*)
126        echo "No such language: $TEST_LANG" >&2
127        exit 2
128esac
Note: See TracBrowser for help on using the repository browser.