summaryrefslogtreecommitdiffstats
path: root/test/etc/reference-run-test-classes
blob: 6f10f5a82c9e399c943248371108ab51b5f4f958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
#
# Run the code in a classes directory on a host-local reference virtual
# machine. The jar should contain a top-level class named Main to run.
#
# Options:
#   --quiet       -- don't chatter
#   --debug       -- wait for debugger to attach
#   --no-verify   -- turn off verification (on by default)
#   --dev         -- development mode

msg() {
    if [ "$QUIET" = "n" ]; then
        echo "$@"
    fi
}

DEBUG="n"
QUIET="n"
VERIFY="y"

while true; do
    if [ "x$1" = "x--quiet" ]; then
        QUIET="y"
        shift
    elif [ "x$1" = "x--debug" ]; then
        DEBUG="y"
        shift
    elif [ "x$1" = "x--no-verify" ]; then
        VERIFY="n"
        shift
    elif [ "x$1" = "x--dev" ]; then
        # not used; ignore
        shift
    elif [ "x$1" = "x--" ]; then
        shift
        break
    elif expr "x$1" : "x--" >/dev/null 2>&1; then
        echo "unknown $0 option: $1" 1>&2
        exit 1
    else
        break
    fi
done

if [ "$VERIFY" = "y" ]; then
    VERIFY_ARG="-Xverify:all"
    msg "Performing verification"
else
    VERIFY_ARG="-Xverify:none"
    msg "Skipping verification"
fi

if [ "$DEBUG" = "y" ]; then
    PORT=8000
    msg "Waiting for jdb to connect:"
    msg "    jdb -attach localhost:$PORT"
    DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,address=$PORT,server=y,suspend=y"
fi

${JAVA} ${DEBUG_OPTS} ${VERIFY_ARG} -classpath classes Main "$@"