s/stx/benchmark-runner.sh
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 20 Nov 2013 12:52:07 +0000
changeset 198 ac6fe48a684d
parent 181 8b5d11633206
child 221 4d5089f4fe81
permissions -rwxr-xr-x
Fixed --cgdb option for Smalltalk/X benchmark-runner.sh.

#!/bin/sh

TOP=$(dirname $0)/../../../..

DEBUGGER=
PROFILER=
SMALLTALK_OPTS=
PROFILER_OPTS=
VM_OPTS=
VM=$TOP/stx/projects/smalltalk/stx

# On Windows use stx.com rather than stx.exe as exe has co
# console output

if [ ! -z "$OS" ]; then
    if [ "$OS" == "Windows_NT" ]; then
        VM=$VM.com
    fi
fi

if [ "$1" = "--help" ]
then    
    "$VM" -I  --execute "$DIR/benchmark-runner.rc" ${1+"$@"}
# .........................
fi


while [ ! -z "$1" ]; do
    case "$1" in
        --gdb)
            DEBUGGER=gdb
            ;;
        --cgdb)
            DEBUGGER=cgdb
            ;;
        --callgrind)
            PROFILER="valgrind -v --smc-check=all-non-file --tool=callgrind --instr-atstart=no --collect-jumps=yes --cache-sim=yes --branch-sim=yes"
            ;;
        -T*)
            VM_OPTS="$VM_OPTS $1"
            ;;
        -M*)
            VM_OPTS="$VM_OPTS $1"
            ;;
        *)
            SMALLTALK_OPTS="$SMALLTALK_OPTS $1"
            ;;
    esac
    shift
done




DIR=`dirname $0`
if [ ! -z "$DEBUGGER" ]; then
    exec $DEBUGGER $VM
fi
if [ ! -z "$PROFILER" ]; then
    exec $PROFILER $VM \
        $VM_OPTS \
        -I --execute "$DIR/benchmark-runner.rc" \
        $SMALLTALK_OPTS
fi


exec "$VM" \
    $VM_OPTS \
    -I  --execute "$DIR/benchmark-runner.rc" \
    $SMALLTALK_OPTS